Suppress stomp points shortly after a kick

This commit is contained in:
jdaster64
2025-09-24 00:54:44 -04:00
parent 8a62b37798
commit beea267f99
2 changed files with 32 additions and 20 deletions

View File

@@ -363,9 +363,9 @@ func is_actually_on_ceiling() -> bool:
return true return true
return false return false
func enemy_bounce_off(add_combo := true) -> void: func enemy_bounce_off(add_combo := true, award_score := true) -> void:
if add_combo: if add_combo:
add_stomp_combo() add_stomp_combo(award_score)
jump_cancelled = not Global.player_action_pressed("jump", player_id) jump_cancelled = not Global.player_action_pressed("jump", player_id)
await get_tree().physics_frame await get_tree().physics_frame
if Global.player_action_pressed("jump", player_id): if Global.player_action_pressed("jump", player_id):
@@ -375,18 +375,19 @@ func enemy_bounce_off(add_combo := true) -> void:
else: else:
velocity.y = -200 velocity.y = -200
func add_stomp_combo() -> void: func add_stomp_combo(award_score := true) -> void:
if stomp_combo >= 10: if stomp_combo >= 10:
if Global.current_game_mode == Global.GameMode.CHALLENGE or Settings.file.difficulty.inf_lives: if award_score:
Global.score += 10000 if Global.current_game_mode == Global.GameMode.CHALLENGE or Settings.file.difficulty.inf_lives:
score_note_spawner.spawn_note(10000) score_note_spawner.spawn_note(10000)
else: else:
Global.lives += 1 Global.lives += 1
AudioManager.play_global_sfx("1_up") AudioManager.play_global_sfx("1_up")
score_note_spawner.spawn_one_up_note() score_note_spawner.spawn_one_up_note()
else: else:
Global.score += COMBO_VALS[stomp_combo] if award_score:
score_note_spawner.spawn_note(COMBO_VALS[stomp_combo]) Global.score += COMBO_VALS[stomp_combo]
score_note_spawner.spawn_note(COMBO_VALS[stomp_combo])
stomp_combo += 1 stomp_combo += 1
func bump_ceiling() -> void: func bump_ceiling() -> void:

View File

@@ -25,6 +25,8 @@ var can_update := true
var can_air_kick := false var can_air_kick := false
var time_since_kicked := 0.0 ## For disabling stomp score if too close to a kick
func _ready() -> void: func _ready() -> void:
$Sprite.flip_v = flipped $Sprite.flip_v = flipped
if flipped: if flipped:
@@ -45,8 +47,14 @@ func on_player_stomped_on(stomped_player: Player) -> void:
DiscoLevel.combo_meter += 10 DiscoLevel.combo_meter += 10
moving = false moving = false
AudioManager.play_sfx("enemy_stomp", global_position) AudioManager.play_sfx("enemy_stomp", global_position)
stomped_player.enemy_bounce_off()
if Global.current_game_mode == Global.GameMode.CHALLENGE and stomped_player.stomp_combo >= 10: stomped_player.enemy_bounce_off(true, time_since_kicked > 0.1)
## TODO(jdaster64): Try to figure out a way to recreate the exact
## anti-farm method used in Deluxe (permanently increasing the points)
## without affecting normal scoring, and killing the Koopa only when
## an increased kick results in 8000 points.
if Global.current_game_mode == Global.GameMode.CHALLENGE and stomped_player.stomp_combo >= 8:
die_from_object(stomped_player) die_from_object(stomped_player)
func block_bounced(_block: Block) -> void: func block_bounced(_block: Block) -> void:
@@ -76,20 +84,22 @@ func award_score(award_level: int) -> void:
func get_kick_award(hit_player: Player) -> int: func get_kick_award(hit_player: Player) -> int:
var award_level = hit_player.stomp_combo + 2 var award_level = hit_player.stomp_combo + 2
if wake_meter > 6.96:
award_level = 9
elif wake_meter > 6.75:
award_level = 5
elif wake_meter > 6.25:
award_level = 3
if award_level > 10: if award_level > 10:
award_level = 10 award_level = 10
# Award special amounts of points if close to waking up.
if wake_meter > 7 - 0.04:
award_level = 9
elif wake_meter > 7 - 0.25:
award_level = 5
elif wake_meter > 7 - 0.75:
award_level = 3
return award_level return award_level
func kick(hit_player: Player) -> void: func kick(hit_player: Player) -> void:
update_hitbox() update_hitbox()
DiscoLevel.combo_meter += 25 DiscoLevel.combo_meter += 25
moving = true moving = true
time_since_kicked = 0.0
if can_air_kick: if can_air_kick:
$ScoreNoteSpawner.spawn_note(8000) $ScoreNoteSpawner.spawn_note(8000)
else: else:
@@ -102,6 +112,7 @@ func _physics_process(delta: float) -> void:
handle_block_collision() handle_block_collision()
if moving: if moving:
wake_meter = 0 wake_meter = 0
time_since_kicked += delta
$Sprite.play("Spin") $Sprite.play("Spin")
else: else:
combo = 0 combo = 0