1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#include "entityimpl.h"
IMPL(draw) {
TZR_DrawSetColor(1, 1, 1, 0.5);
TZR_DrawRectangle(this->pos[0] - this->width / 2,
this->pos[1] - this->height / 2,
this->width, this->height, .fill=true);
}
IMPL(update) {
this->vel[0] = 2 * TZR_IsKeyDown(SDL_SCANCODE_RIGHT)
- 2 * TZR_IsKeyDown(SDL_SCANCODE_LEFT);
entity_move(this, g);
entity_init(game_create_entity(g), entity_type("part"), NULL,
this->pos[0], this->pos[1], 0, 0);
}
IMPL_INIT(player, 0) {
this->height = this->width = 12;
}
|