#include "entityimpl.h" #include IMPL_INIT(part, 0) { this->width = this->height = 1 + rand() % 2; this->ignore_solids = true; this->part.life = 30 + rand() % 10; this->vel[0] = (float)(rand() % 1024) / 1023.0; this->vel[1] = (float)(rand() % 1024) / 1023.0; this->vel[0] *= 1 - 2 * (rand() % 2); this->vel[1] *= 1 - 2 * (rand() % 3); } IMPL(update) { this->part.life -= 1; if (this->part.life <= 0) { this->type = 0; return; } this->vel[1] += 0.1; entity_move(this, g); } IMPL(draw) { TZR_DrawSetColor(1, 1, 1, 1); TZR_DrawRectangle(true, this->pos[0], this->pos[1], this->width, this->height); }