diff options
Diffstat (limited to 'src/player.c')
-rw-r--r-- | src/player.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/player.c b/src/player.c index 5456d0f..9434b3c 100644 --- a/src/player.c +++ b/src/player.c @@ -5,6 +5,22 @@ #include "rotrect.h" #include <math.h> +IMPL_INIT(player) { + this->width = 10; + this->height = 10; + this->player.scale_x = 1.0; + this->player.scale_y = 1.0; + this->player.dirx = 1; +} + +IMPL(draw) { + LZY_DrawSetColor(BLACK); + const double width = this->width * this->player.scale_x + 2; + const double height = this->height * this->player.scale_y + 2; + rotrect(this->pos[0] - 1, this->pos[1] - 1, + width, height, this->player.angle); +} + IMPL(update) { const int on_ground = entity_collide(this, g, 0, 1); @@ -72,19 +88,3 @@ IMPL(update) { if (entity_place_meeting(this, g, entity_type("exit")) != NULL) g->queue_next_scene = true; } - -IMPL(draw) { - LZY_DrawSetColor(BLACK); - const double width = this->width * this->player.scale_x + 2; - const double height = this->height * this->player.scale_y + 2; - rotrect(this->pos[0] - 1, this->pos[1] - 1, - width, height, this->player.angle); -} - -IMPL_INIT(player) { - this->width = 10; - this->height = 10; - this->player.scale_x = 1.0; - this->player.scale_y = 1.0; - this->player.dirx = 1; -} IMPL_END |