diff options
author | kdx <kdx.42@42l.fr> | 2023-03-26 07:26:47 +0000 |
---|---|---|
committer | kdx <kdx.42@42l.fr> | 2023-03-26 07:26:47 +0000 |
commit | 09438266c3987c89a1e7f0abf9042dd3528ac343 (patch) | |
tree | 5bc3888bfcdd122f8734cbb0414a71597fb2c254 /src/player.c | |
parent | 83f5fc33df8ea2b8df661f921f157080d472a0ae (diff) | |
download | hyperultra-09438266c3987c89a1e7f0abf9042dd3528ac343.tar.gz |
overengineer entityimpl a bit more
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 |