diff options
author | kdx <kikoodx@paranoici.org> | 2023-03-18 23:40:10 +0100 |
---|---|---|
committer | kdx <kikoodx@paranoici.org> | 2023-03-18 23:41:16 +0100 |
commit | b796e0bea418cc541257e17274b6fb14d4cb5ee8 (patch) | |
tree | d87ce38493e6af3e5c75a3171981310a20b46920 /src/deathpart.c | |
parent | 297ee77f926197504f8e0d7d6fcf0bf602cccd66 (diff) | |
download | hyperultra-b796e0bea418cc541257e17274b6fb14d4cb5ee8.tar.gz |
death particles
Diffstat (limited to 'src/deathpart.c')
-rw-r--r-- | src/deathpart.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/src/deathpart.c b/src/deathpart.c index e7a9dab..e08f25b 100644 --- a/src/deathpart.c +++ b/src/deathpart.c @@ -1,14 +1,25 @@ +#include "entity.h" +#include "player.h" #include "entityimpl.h" +#include <stdlib.h> -IMPL_UPDATE() -} +IMPL_UPDATE() { + this->vel[1] *= AIR_RESISTANCE; + this->vel[1] += GRAVITY; + entity_move(this, g); +} IMPL_END -IMPL_DRAW() +IMPL_DRAW() { LZY_DrawSetColor(BLACK); - LZY_DrawRect(this->pos[0] - this->width / 2, - this->pos[1] - this->height / 2, - this->width, this->height); -} + LZY_DrawRect(this->pos[0], this->pos[1], this->width, this->height); +} IMPL_END -IMPL_INIT(deathpart) -} +IMPL_INIT(deathpart) { + this->ignore_solids = true; + this->vel[0] = (float)(rand() % 1024) / 1024; + this->vel[1] = -(float)(rand() % 1024) / 512; + this->vel[0] *= this->vel[0]; + if (rand() % 2) + this->vel[0] *= -1; + this->height = this->width = 1 + rand() % 2; +} IMPL_END |