2023-03-18 23:40:10 +01:00
|
|
|
#include "entity.h"
|
|
|
|
#include "player.h"
|
2023-03-18 21:54:01 +01:00
|
|
|
#include "entityimpl.h"
|
2023-03-18 23:40:10 +01:00
|
|
|
#include <stdlib.h>
|
2023-03-18 21:54:01 +01:00
|
|
|
|
2023-03-26 09:26:47 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2023-03-26 09:11:55 +02:00
|
|
|
IMPL(update) {
|
2023-03-19 05:52:04 +01:00
|
|
|
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;
|
2023-03-26 09:11:55 +02:00
|
|
|
}
|
2023-03-18 21:54:01 +01:00
|
|
|
|
2023-03-26 09:11:55 +02:00
|
|
|
IMPL(draw) {
|
2023-03-18 21:54:01 +01:00
|
|
|
LZY_DrawSetColor(BLACK);
|
2023-03-18 23:51:09 +01:00
|
|
|
if (this->width == 1)
|
2023-03-25 21:54:50 +01:00
|
|
|
(void)LZY_DrawPoint(this->pos[0], this->pos[1]);
|
2023-03-18 23:51:09 +01:00
|
|
|
else
|
2023-03-25 21:54:50 +01:00
|
|
|
(void)LZY_DrawRect(this->pos[0], this->pos[1],
|
|
|
|
this->width, this->width);
|
2023-03-26 09:11:55 +02:00
|
|
|
}
|