mirror of
https://github.com/JHDev2006/Super-Mario-Bros.-Remastered-Public.git
synced 2025-10-22 07:28:14 +00:00
The speedrun timer, can now be paused (not fullgame marathons tho, cause uhhhhh yea)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=9 format=3 uid="uid://jv82ssp7gwn4"]
|
||||
[gd_scene load_steps=8 format=3 uid="uid://jv82ssp7gwn4"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://by48a8oa5hefr" path="res://Scripts/UI/StoryPause.gd" id="1_1nlpt"]
|
||||
[ext_resource type="StyleBox" uid="uid://comkghpj0djcl" path="res://Resources/UI/Panel.tres" id="2_37ia2"]
|
||||
@@ -6,7 +6,6 @@
|
||||
[ext_resource type="Script" uid="uid://cbal8ms2oe1ik" path="res://Scripts/Classes/Components/ResourceSetterNew.gd" id="4_r6n62"]
|
||||
[ext_resource type="JSON" path="res://Assets/Sprites/UI/Cursor.json" id="5_f5hk3"]
|
||||
[ext_resource type="Script" uid="uid://co6tjg3w6qpd8" path="res://Scripts/Parts/LabelFontChanger.gd" id="6_6v5ys"]
|
||||
[ext_resource type="Resource" uid="uid://8dcuxbc3h2u2" path="res://Resources/ThemedResources/Font.tres" id="7_g5edx"]
|
||||
[ext_resource type="PackedScene" uid="uid://dnksdgorle8su" path="res://Scenes/Prefabs/UI/SettingsMenu.tscn" id="8_s7xbe"]
|
||||
|
||||
[node name="PauseMenu" type="Control" node_paths=PackedStringArray("options")]
|
||||
@@ -89,7 +88,6 @@ metadata/_custom_type_script = "uid://cbal8ms2oe1ik"
|
||||
[node name="LabelFontChanger" type="Node" parent="." node_paths=PackedStringArray("labels")]
|
||||
script = ExtResource("6_6v5ys")
|
||||
labels = [NodePath("../Control/PanelContainer/MarginContainer/VBoxContainer/Label"), NodePath("../Control/PanelContainer/MarginContainer/VBoxContainer/Label2"), NodePath("../Control/PanelContainer/MarginContainer/VBoxContainer/Label3"), null]
|
||||
resource = ExtResource("7_g5edx")
|
||||
metadata/_custom_type_script = "uid://co6tjg3w6qpd8"
|
||||
|
||||
[node name="SettingsMenu" parent="." node_paths=PackedStringArray("disabled_containers") instance=ExtResource("8_s7xbe")]
|
||||
|
@@ -507,7 +507,7 @@ func do_i_frames() -> void:
|
||||
refresh_hitbox()
|
||||
|
||||
func die(pit := false) -> void:
|
||||
if state_machine.state.name == "Dead" or state_machine.state.name == "Pipe":
|
||||
if ["Dead", "Pipe", "LevelExit"].has(state_machine.state.name):
|
||||
return
|
||||
is_dead = true
|
||||
visible = not pit
|
||||
|
@@ -12,6 +12,8 @@ var show_timer := false
|
||||
|
||||
signal level_finished
|
||||
|
||||
var paused_time := 0.0
|
||||
|
||||
var start_time := 0.0
|
||||
|
||||
const GHOST_RECORDING_TEMPLATE := {
|
||||
@@ -147,12 +149,17 @@ const MEDAL_CONVERSIONS := [2, 1.5, 1]
|
||||
func _ready() -> void:
|
||||
process_mode = Node.PROCESS_MODE_ALWAYS
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
func _physics_process(delta: float) -> void:
|
||||
if timer_active:
|
||||
timer = abs(start_time - Time.get_ticks_msec()) / 1000
|
||||
if Global.game_paused and Global.current_game_mode != Global.GameMode.MARATHON:
|
||||
paused_time += delta
|
||||
else:
|
||||
timer = (abs(start_time - Time.get_ticks_msec()) / 1000) - paused_time
|
||||
if enable_recording:
|
||||
if get_tree().get_first_node_in_group("Players") != null:
|
||||
record_frame(get_tree().get_first_node_in_group("Players"))
|
||||
else:
|
||||
paused_time = 0
|
||||
Global.player_ghost.visible = ghost_visible
|
||||
if ghost_active and ghost_enabled:
|
||||
ghost_idx += 1
|
||||
@@ -163,6 +170,7 @@ func _physics_process(_delta: float) -> void:
|
||||
|
||||
func start_timer() -> void:
|
||||
timer = 0
|
||||
paused_time = 0
|
||||
timer_active = true
|
||||
show_timer = true
|
||||
start_time = Time.get_ticks_msec()
|
||||
|
@@ -28,8 +28,6 @@ func handle_inputs() -> void:
|
||||
selected_index = clamp(selected_index, 0, options.size() - 1)
|
||||
if Input.is_action_just_pressed("ui_accept"):
|
||||
option_selected()
|
||||
if Input.is_action_just_pressed("pause"):
|
||||
close()
|
||||
|
||||
func option_selected() -> void:
|
||||
emit_signal("option_" + str(selected_index + 1) + "_selected")
|
||||
|
Reference in New Issue
Block a user