diff options
author | quou <quou@disroot.org> | 2023-05-07 12:53:46 +1000 |
---|---|---|
committer | quou <quou@disroot.org> | 2023-05-07 12:54:06 +1000 |
commit | 5f341eacdf0d75a4b334969a2d8a4701d61e4d9e (patch) | |
tree | ee3a4c44b92e975530e1e6fed18c8852a6f70a93 /player.c | |
parent | 5ef6a71e935e2c3d1e5f9828e8cdbd78403a06a0 (diff) |
Add waves and stuff.
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 ); |