From 5f341eacdf0d75a4b334969a2d8a4701d61e4d9e Mon Sep 17 00:00:00 2001 From: quou Date: Sun, 7 May 2023 12:53:46 +1000 Subject: Add waves and stuff. --- player.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'player.c') diff --git a/player.c b/player.c index ff3f53b..9075048 100644 --- a/player.c +++ b/player.c @@ -87,7 +87,7 @@ void update_player(Player* player, World* world) { if (dx || dy) { vec_nrmise(&dx, &dy); - if (dx) { + if (dx && !button_pressed(btn_shoot)) { face = dx < 0 ? 0 : 1; } else { face = player->face; @@ -117,13 +117,18 @@ void update_player(Player* player, World* world) { animation_player_walk_left; } + if (!button_pressed(btn_shoot)) { + player->sdx = player->ldx; + player->sdy = player->ldy; + } + if (button_pressed(btn_shoot) && player->shoot_countdown <= 0) { new_player_bullet( world, pos->x, pos->y, - (player->ldx * player_bullet_speed) >> fbits, - (player->ldy * player_bullet_speed) >> fbits, + (player->sdx * player_bullet_speed) >> fbits, + (player->sdy * player_bullet_speed) >> fbits, 100 ); -- cgit v1.2.3-54-g00ecf