aboutsummaryrefslogtreecommitdiff
path: root/player.c
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2024-09-30 22:13:31 +1000
committerquou <quou@disroot.org>2024-09-30 22:13:31 +1000
commitee655819d44307d974fb27e1fa04d079a3810d63 (patch)
treefaa7c7c833dab0ed83dece311576b53bd2e4b840 /player.c
parentde9a4fd93343d4654dfe7e2a566704644a9f306f (diff)
enemy
Diffstat (limited to 'player.c')
-rw-r--r--player.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/player.c b/player.c
index 67a4817..e965c66 100644
--- a/player.c
+++ b/player.c
@@ -94,18 +94,26 @@ void update_player_move(Player* p, const App* a, World* w) {
play_sound(500);
}
if (p->cooldown <= 0 && btn_just_pressed(a, btn_shoot)) {
- int sx, sy;
+ int sx, sy, vx;
int anim;
+ Rect dz;
if (p->face == face_left) {
anim = asset_id_slash_left_anm;
sx = (p->x >> fbits) - 45;
sy = (p->y >> fbits);
+ vx = f1 * 3;
} else {
anim = asset_id_slash_right_anm;
sx = (p->x >> fbits) + 16;
sy = (p->y >> fbits);
+ vx = -f1 * 3;
}
+ dz.x = sx;
+ dz.y = sy;
+ dz.w = 45;
+ dz.h = 17;
inst_particle(w, sx, sy, anim, asset_id_arms_img);
+ inst_deathzone(w, &dz, vx, 0, player_slash_damage, 1, 1);
p->cooldown = 10;
p->slashing = get_animation(asset_id_guy_slash_left_anm)->fc;
}