aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2024-09-30 22:29:08 +1000
committerquou <quou@disroot.org>2024-09-30 22:29:08 +1000
commit18468a0ae82adddd9973ae8b16a9d55dce61dbdb (patch)
treedb01dbae0f907a16179ef5a44a6d09765d6e6dd0
parentd2837633da48e3cc0530d718de5e0bbfcd4fcc34 (diff)
Player slash hitbox stays around for a few frames
-rw-r--r--player.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/player.c b/player.c
index e965c66..1ebe589 100644
--- a/player.c
+++ b/player.c
@@ -94,18 +94,16 @@ 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, vx;
+ int sx, sy = p->y >> fbits, 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;
@@ -113,7 +111,7 @@ void update_player_move(Player* p, const App* a, World* w) {
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);
+ inst_deathzone(w, &dz, vx, 0, player_slash_damage, 4, 1);
p->cooldown = 10;
p->slashing = get_animation(asset_id_guy_slash_left_anm)->fc;
}