aboutsummaryrefslogtreecommitdiff
path: root/player.c
diff options
context:
space:
mode:
Diffstat (limited to 'player.c')
-rw-r--r--player.c11
1 files changed, 8 insertions, 3 deletions
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
);