mirror of
https://github.com/JHDev2006/Super-Mario-Bros.-Remastered-Public.git
synced 2025-10-21 23:18:11 +00:00
Merge pull request #375 from jdaster64/main
Koopa shell scoring, Challenge Mode anti-infinite score reworks
This commit is contained in:
@@ -10,6 +10,8 @@ var fly_wave := PI
|
|||||||
|
|
||||||
var dead := false
|
var dead := false
|
||||||
|
|
||||||
|
var times_kicked := 0 ## For anti-infinite scoring in Challenge mode
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
if has_meta("fly_2"):
|
if has_meta("fly_2"):
|
||||||
fly_wave = 0
|
fly_wave = 0
|
||||||
@@ -64,6 +66,7 @@ func summon_shell(flipped := false, launch := false) -> void:
|
|||||||
DiscoLevel.combo_amount += 1
|
DiscoLevel.combo_amount += 1
|
||||||
var shell = load(shell_scene).instantiate()
|
var shell = load(shell_scene).instantiate()
|
||||||
shell.flipped = flipped
|
shell.flipped = flipped
|
||||||
|
shell.times_kicked = times_kicked
|
||||||
shell.old_entity = self.duplicate()
|
shell.old_entity = self.duplicate()
|
||||||
if launch:
|
if launch:
|
||||||
AudioManager.play_sfx("kick", global_position)
|
AudioManager.play_sfx("kick", global_position)
|
||||||
|
@@ -376,9 +376,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):
|
||||||
@@ -388,18 +388,20 @@ func enemy_bounce_off(add_combo := true) -> void:
|
|||||||
else:
|
else:
|
||||||
velocity.y = sign(gravity_vector.y) * -BOUNCE_HEIGHT
|
velocity.y = sign(gravity_vector.y) * -BOUNCE_HEIGHT
|
||||||
|
|
||||||
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)
|
Global.score += 10000
|
||||||
else:
|
score_note_spawner.spawn_note(10000)
|
||||||
Global.lives += 1
|
else:
|
||||||
AudioManager.play_global_sfx("1_up")
|
Global.lives += 1
|
||||||
score_note_spawner.spawn_one_up_note()
|
AudioManager.play_global_sfx("1_up")
|
||||||
|
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:
|
||||||
|
@@ -3,6 +3,8 @@ extends Enemy
|
|||||||
|
|
||||||
var moving := false
|
var moving := false
|
||||||
|
|
||||||
|
var moving_time := 0.0
|
||||||
|
|
||||||
const MOVE_SPEED := 192
|
const MOVE_SPEED := 192
|
||||||
const AIR_MOVE_SPEED := 64
|
const AIR_MOVE_SPEED := 64
|
||||||
|
|
||||||
@@ -15,7 +17,7 @@ var can_kick := false
|
|||||||
|
|
||||||
var player: Player = null
|
var player: Player = null
|
||||||
|
|
||||||
const COMBO_VALS := [500, 800, 1000, 2000, 4000, 5000, 8000, null]
|
const COMBO_VALS := [100, 200, 400, 500, 800, 1000, 2000, 4000, 5000, 8000, null]
|
||||||
|
|
||||||
var wake_meter := 0.0 ## SMB1R IS WOKE
|
var wake_meter := 0.0 ## SMB1R IS WOKE
|
||||||
|
|
||||||
@@ -25,6 +27,8 @@ var can_update := true
|
|||||||
|
|
||||||
var can_air_kick := false
|
var can_air_kick := false
|
||||||
|
|
||||||
|
var times_kicked := 0
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
$Sprite.flip_v = flipped
|
$Sprite.flip_v = flipped
|
||||||
if flipped:
|
if flipped:
|
||||||
@@ -40,14 +44,12 @@ func on_player_stomped_on(stomped_player: Player) -> void:
|
|||||||
return
|
return
|
||||||
if not moving:
|
if not moving:
|
||||||
direction = sign(global_position.x - stomped_player.global_position.x)
|
direction = sign(global_position.x - stomped_player.global_position.x)
|
||||||
kick()
|
kick(stomped_player)
|
||||||
else:
|
else:
|
||||||
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()
|
stomped_player.enemy_bounce_off(true, moving_time > 0.1)
|
||||||
if Global.current_game_mode == Global.GameMode.CHALLENGE and stomped_player.stomp_combo >= 10:
|
|
||||||
die_from_object(stomped_player)
|
|
||||||
|
|
||||||
func block_bounced(_block: Block) -> void:
|
func block_bounced(_block: Block) -> void:
|
||||||
velocity.y = -200
|
velocity.y = -200
|
||||||
@@ -59,19 +61,50 @@ func on_player_hit(hit_player: Player) -> void:
|
|||||||
return
|
return
|
||||||
if not moving:
|
if not moving:
|
||||||
direction = sign(global_position.x - hit_player.global_position.x )
|
direction = sign(global_position.x - hit_player.global_position.x )
|
||||||
kick()
|
kick(hit_player)
|
||||||
else:
|
else:
|
||||||
hit_player.damage()
|
hit_player.damage()
|
||||||
|
|
||||||
|
func award_score(award_level: int) -> void:
|
||||||
|
if award_level >= 10:
|
||||||
|
if Global.current_game_mode == Global.GameMode.CHALLENGE or Settings.file.difficulty.inf_lives:
|
||||||
|
$ScoreNoteSpawner.spawn_note(10000)
|
||||||
|
else:
|
||||||
|
AudioManager.play_global_sfx("1_up")
|
||||||
|
Global.lives += 1
|
||||||
|
$ScoreNoteSpawner.spawn_one_up_note()
|
||||||
|
else:
|
||||||
|
$ScoreNoteSpawner.spawn_note(COMBO_VALS[award_level])
|
||||||
|
|
||||||
|
func get_kick_award(hit_player: Player) -> int:
|
||||||
|
var award_level = hit_player.stomp_combo + 2
|
||||||
|
if 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
|
||||||
|
|
||||||
func kick() -> void:
|
func kick(hit_player: Player) -> void:
|
||||||
update_hitbox()
|
update_hitbox()
|
||||||
DiscoLevel.combo_meter += 25
|
DiscoLevel.combo_meter += 25
|
||||||
moving = true
|
moving = true
|
||||||
|
moving_time = 0.0
|
||||||
if can_air_kick:
|
if can_air_kick:
|
||||||
$ScoreNoteSpawner.spawn_note(8000)
|
$ScoreNoteSpawner.spawn_note(8000)
|
||||||
else:
|
else:
|
||||||
$ScoreNoteSpawner.spawn_note(400)
|
award_score(get_kick_award(hit_player))
|
||||||
AudioManager.play_sfx("kick", global_position)
|
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:
|
func _physics_process(delta: float) -> void:
|
||||||
handle_movement(delta)
|
handle_movement(delta)
|
||||||
@@ -79,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
|
||||||
|
moving_time += delta
|
||||||
$Sprite.play("Spin")
|
$Sprite.play("Spin")
|
||||||
else:
|
else:
|
||||||
combo = 0
|
combo = 0
|
||||||
@@ -94,6 +128,7 @@ func handle_waking(delta: float) -> void:
|
|||||||
|
|
||||||
func summon_original_entity() -> void:
|
func summon_original_entity() -> void:
|
||||||
old_entity.global_position = global_position
|
old_entity.global_position = global_position
|
||||||
|
old_entity.times_kicked = times_kicked
|
||||||
add_sibling(old_entity)
|
add_sibling(old_entity)
|
||||||
queue_free()
|
queue_free()
|
||||||
|
|
||||||
@@ -105,17 +140,13 @@ func handle_block_collision() -> void:
|
|||||||
i.shell_block_hit.emit(self)
|
i.shell_block_hit.emit(self)
|
||||||
|
|
||||||
func add_combo() -> void:
|
func add_combo() -> void:
|
||||||
if combo >= 7:
|
award_score(combo + 3)
|
||||||
if Global.current_game_mode == Global.GameMode.CHALLENGE or Settings.file.difficulty.inf_lives:
|
if combo < 7:
|
||||||
Global.score += 10000
|
|
||||||
$ScoreNoteSpawner.spawn_note(10000)
|
|
||||||
else:
|
|
||||||
AudioManager.play_global_sfx("1_up")
|
|
||||||
Global.lives += 1
|
|
||||||
$ScoreNoteSpawner.spawn_one_up_note()
|
|
||||||
else:
|
|
||||||
$ScoreNoteSpawner.spawn_note(COMBO_VALS[combo])
|
|
||||||
combo += 1
|
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:
|
func update_hitbox() -> void:
|
||||||
can_kick = false
|
can_kick = false
|
||||||
|
Reference in New Issue
Block a user