mirror of
https://github.com/JHDev2006/Super-Mario-Bros.-Remastered-Public.git
synced 2025-10-22 15:38:14 +00:00
Rework anti-infinite scoring mechanisms for Challenge Mode
This commit is contained in:
@@ -10,6 +10,8 @@ var fly_wave := PI
|
||||
|
||||
var dead := false
|
||||
|
||||
var times_kicked := 0 ## For anti-infinite scoring in Challenge mode
|
||||
|
||||
func _ready() -> void:
|
||||
if has_meta("fly_2"):
|
||||
fly_wave = 0
|
||||
@@ -64,6 +66,7 @@ func summon_shell(flipped := false, launch := false) -> void:
|
||||
DiscoLevel.combo_amount += 1
|
||||
var shell = load(shell_scene).instantiate()
|
||||
shell.flipped = flipped
|
||||
shell.times_kicked = times_kicked
|
||||
shell.old_entity = self.duplicate()
|
||||
if launch:
|
||||
AudioManager.play_sfx("kick", global_position)
|
||||
|
@@ -3,6 +3,8 @@ extends Enemy
|
||||
|
||||
var moving := false
|
||||
|
||||
var moving_time := 0.0
|
||||
|
||||
const MOVE_SPEED := 192
|
||||
const AIR_MOVE_SPEED := 64
|
||||
|
||||
@@ -25,7 +27,7 @@ var can_update := true
|
||||
|
||||
var can_air_kick := false
|
||||
|
||||
var time_since_kicked := 0.0 ## For disabling stomp score if too close to a kick
|
||||
var times_kicked := 0
|
||||
|
||||
func _ready() -> void:
|
||||
$Sprite.flip_v = flipped
|
||||
@@ -47,15 +49,7 @@ func on_player_stomped_on(stomped_player: Player) -> void:
|
||||
DiscoLevel.combo_meter += 10
|
||||
moving = false
|
||||
AudioManager.play_sfx("enemy_stomp", global_position)
|
||||
|
||||
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)
|
||||
stomped_player.enemy_bounce_off(true, moving_time > 0.1)
|
||||
|
||||
func block_bounced(_block: Block) -> void:
|
||||
velocity.y = -200
|
||||
@@ -99,12 +93,18 @@ func kick(hit_player: Player) -> void:
|
||||
update_hitbox()
|
||||
DiscoLevel.combo_meter += 25
|
||||
moving = true
|
||||
time_since_kicked = 0.0
|
||||
moving_time = 0.0
|
||||
if can_air_kick:
|
||||
$ScoreNoteSpawner.spawn_note(8000)
|
||||
else:
|
||||
award_score(get_kick_award(hit_player))
|
||||
AudioManager.play_sfx("kick", global_position)
|
||||
|
||||
# Limit the number of times you can kick the same shell.
|
||||
if Global.current_game_mode == Global.GameMode.CHALLENGE:
|
||||
times_kicked += 1
|
||||
if times_kicked >= 7:
|
||||
die_from_object(hit_player)
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
handle_movement(delta)
|
||||
@@ -112,7 +112,7 @@ func _physics_process(delta: float) -> void:
|
||||
handle_block_collision()
|
||||
if moving:
|
||||
wake_meter = 0
|
||||
time_since_kicked += delta
|
||||
moving_time += delta
|
||||
$Sprite.play("Spin")
|
||||
else:
|
||||
combo = 0
|
||||
@@ -128,6 +128,7 @@ func handle_waking(delta: float) -> void:
|
||||
|
||||
func summon_original_entity() -> void:
|
||||
old_entity.global_position = global_position
|
||||
old_entity.times_kicked = times_kicked
|
||||
add_sibling(old_entity)
|
||||
queue_free()
|
||||
|
||||
@@ -142,6 +143,10 @@ func add_combo() -> void:
|
||||
award_score(combo + 3)
|
||||
if combo < 7:
|
||||
combo += 1
|
||||
|
||||
# Force limit on how long you can let a shell hit respawning enemies.
|
||||
if Global.current_game_mode == Global.GameMode.CHALLENGE and moving_time > 12.0:
|
||||
die()
|
||||
|
||||
func update_hitbox() -> void:
|
||||
can_kick = false
|
||||
|
Reference in New Issue
Block a user