Fix downward dash not damaging enemies and add post-dash invincibility
All checks were successful
CI / build (pull_request) Successful in 32s
All checks were successful
CI / build (pull_request) Successful in 32s
Stomping was guarded by the invincibility check, so during a downward dash the player could never deal stomp damage. Move the invincibility guard to only protect against taking damage, not dealing it. Extend dash invincibility by PLAYER_DASH_INV_GRACE (0.15s) past the dash duration so the player is briefly protected after landing. Closes #15
This commit is contained in:
@@ -306,8 +306,7 @@ static void handle_collisions(EntityManager *em) {
|
||||
}
|
||||
|
||||
/* ── Enemy contact damage to player ──── */
|
||||
if (player && !(player->flags & ENTITY_INVINCIBLE) &&
|
||||
entity_is_enemy(a) && !(a->flags & ENTITY_DEAD)) {
|
||||
if (player && entity_is_enemy(a) && !(a->flags & ENTITY_DEAD)) {
|
||||
if (physics_overlap(&a->body, &player->body)) {
|
||||
/* Check if player is stomping (falling onto enemy from above) */
|
||||
bool stomping = (player->body.vel.y > 0) &&
|
||||
@@ -319,7 +318,7 @@ static void handle_collisions(EntityManager *em) {
|
||||
damage_entity(a, 2);
|
||||
if (a->flags & ENTITY_DEAD) stats_record_kill();
|
||||
player->body.vel.y = -PLAYER_JUMP_FORCE * 0.7f;
|
||||
} else {
|
||||
} else if (!(player->flags & ENTITY_INVINCIBLE)) {
|
||||
/* Charger deals extra damage and knockback while charging */
|
||||
int dmg = a->damage;
|
||||
if (a->type == ENT_ENEMY_CHARGER) {
|
||||
|
||||
Reference in New Issue
Block a user