hyperultra/src/deathpart.c

34 lines
784 B
C

#include "entity.h"
#include "player.h"
#include "entityimpl.h"
#include <stdlib.h>
IMPL_UPDATE() {
if (this->deathpart.skip == 0) {
this->vel[1] *= AIR_RESISTANCE;
this->vel[1] += GRAVITY;
entity_move(this, g);
this->deathpart.skip = 3;
} else
this->deathpart.skip -= 1;
} IMPL_END
IMPL_DRAW() {
LZY_DrawSetColor(BLACK);
if (this->width == 1)
(void)LZY_DrawPoint(this->pos[0], this->pos[1]);
else
(void)LZY_DrawRect(this->pos[0], this->pos[1],
this->width, this->width);
} IMPL_END
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->width = 1 + rand() % 2;
} IMPL_END