mirror of
https://github.com/JHDev2006/Super-Mario-Bros.-Remastered-Public.git
synced 2025-10-22 07:28:14 +00:00
you can now have as MANY checkpoints as you want, in as many rooms as you want!
This commit is contained in:
@@ -160,7 +160,7 @@ func _physics_process(delta: float) -> void:
|
||||
elif current_state == EditorState.TILE_MENU:
|
||||
close_tile_menu()
|
||||
if Input.is_action_just_pressed("editor_play") and (current_state == EditorState.IDLE or current_state == EditorState.PLAYTESTING) and Global.current_game_mode == Global.GameMode.LEVEL_EDITOR:
|
||||
Checkpoint.passed = false
|
||||
Checkpoint.passed_checkpoints.clear()
|
||||
if current_state == EditorState.PLAYTESTING:
|
||||
stop_testing()
|
||||
else:
|
||||
|
@@ -10,7 +10,7 @@ func _ready() -> void:
|
||||
owner.queue_free()
|
||||
return
|
||||
owner.show()
|
||||
if Checkpoint.passed:
|
||||
if owner.passed:
|
||||
sprite.hide()
|
||||
activated.show()
|
||||
|
||||
|
@@ -159,7 +159,7 @@ func transition_to_next_level() -> void:
|
||||
first_load = true
|
||||
SaveManager.write_save()
|
||||
Global.transition_to_scene("res://Scenes/Levels/LevelTransition.tscn")
|
||||
Checkpoint.passed = false
|
||||
Checkpoint.passed_checkpoints.clear()
|
||||
|
||||
func reload_level() -> void:
|
||||
LevelTransition.level_to_transition_to = Level.start_level_path
|
||||
|
@@ -263,7 +263,7 @@ func activate_p_switch() -> void:
|
||||
|
||||
func reset_values() -> void:
|
||||
PlayerGhost.idx = 0
|
||||
Checkpoint.passed = false
|
||||
Checkpoint.passed_checkpoints.clear()
|
||||
Checkpoint.sublevel_id = 0
|
||||
Door.unlocked_doors = []
|
||||
Checkpoint.unlocked_doors = []
|
||||
|
@@ -8,7 +8,7 @@ extends Node2D
|
||||
signal crossed(player: Player)
|
||||
signal respawned
|
||||
|
||||
static var passed := false
|
||||
var passed := false
|
||||
static var respawn_position := Vector2.ZERO
|
||||
static var level := ""
|
||||
static var sublevel_id := 0
|
||||
@@ -16,10 +16,13 @@ static var keys_collected := 0
|
||||
static var old_state := [[], []]
|
||||
static var unlocked_doors := []
|
||||
|
||||
static var passed_checkpoints := []
|
||||
|
||||
var id := ""
|
||||
|
||||
func _enter_tree() -> void:
|
||||
if Global.level_editor != null:
|
||||
if sublevel_id != Global.level_editor.sub_level_id and passed:
|
||||
passed = false
|
||||
id = get_id()
|
||||
passed = passed_checkpoints.has(id)
|
||||
if passed:
|
||||
LevelPersistance.active_nodes = old_state.duplicate(true)
|
||||
|
||||
@@ -31,7 +34,7 @@ func _ready() -> void:
|
||||
hide()
|
||||
if Settings.file.difficulty.checkpoint_style != 0:
|
||||
queue_free()
|
||||
if passed and PipeArea.exiting_pipe_id == -1 and Global.current_game_mode != Global.GameMode.LEVEL_EDITOR and Level.vine_return_level == "":
|
||||
if passed and PipeArea.exiting_pipe_id == -1 and Global.current_game_mode != Global.GameMode.LEVEL_EDITOR and Level.vine_return_level == "" and passed_checkpoints[passed_checkpoints.size() - 1] == id:
|
||||
for i in nodes_to_delete:
|
||||
i.queue_free()
|
||||
for i in get_tree().get_nodes_in_group("Players"):
|
||||
@@ -50,6 +53,7 @@ func on_area_entered(area: Area2D) -> void:
|
||||
var player: Player = area.owner
|
||||
player.passed_checkpoint()
|
||||
passed = true
|
||||
passed_checkpoints.append(id)
|
||||
keys_collected = KeyItem.total_collected
|
||||
old_state = LevelPersistance.active_nodes.duplicate(true)
|
||||
unlocked_doors = Door.unlocked_doors.duplicate()
|
||||
@@ -62,6 +66,11 @@ func on_area_entered(area: Area2D) -> void:
|
||||
respawn_position = global_position
|
||||
crossed.emit(area.owner)
|
||||
|
||||
func get_id() -> String:
|
||||
if Global.level_editor != null:
|
||||
return str(Global.level_editor.sub_level_id) + "," + str(Vector2i(global_position)) + "," + get_parent().name
|
||||
else:
|
||||
return Global.current_level.scene_file_path + "," + str(Vector2i(global_position)) + "," + get_parent().name
|
||||
|
||||
func on_tree_exiting() -> void:
|
||||
pass # Replace with function body.
|
||||
|
@@ -41,7 +41,7 @@ func _ready() -> void:
|
||||
Global.p_switch_active = false
|
||||
Lakitu.present = false
|
||||
Global.p_switch_timer = -1
|
||||
if Checkpoint.passed:
|
||||
if Checkpoint.passed_checkpoints.is_empty() == false:
|
||||
Door.unlocked_doors = Checkpoint.unlocked_doors.duplicate()
|
||||
else:
|
||||
Door.unlocked_doors = []
|
||||
|
@@ -29,7 +29,7 @@ func update_visuals() -> void:
|
||||
func run_player_check(player: Player) -> void:
|
||||
if Global.player_action_pressed(get_input_direction(enter_direction), player.player_id) and can_enter:
|
||||
can_enter = false
|
||||
Checkpoint.passed = false
|
||||
Checkpoint.passed_checkpoints.clear()
|
||||
SpeedrunHandler.is_warp_run = true
|
||||
Global.reset_values()
|
||||
Level.first_load = true
|
||||
|
@@ -19,7 +19,7 @@ func _ready() -> void:
|
||||
ResourceSetterNew.cache.clear()
|
||||
ResourceSetter.cache.clear()
|
||||
Global.get_node("GameHUD").hide()
|
||||
Checkpoint.passed = false
|
||||
Checkpoint.passed_checkpoints.clear()
|
||||
Global.world_num = 1
|
||||
Global.level_num = 1
|
||||
Global.reset_values()
|
||||
|
Reference in New Issue
Block a user