diff options
Diffstat (limited to 'player.c')
-rw-r--r-- | player.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -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 ); |