gotta go fast, hit that BLJgit status

This commit is contained in:
Haze Weathers 2024-12-07 21:58:34 -05:00
parent b54e9272c6
commit 32189c29a4
10 changed files with 115 additions and 6 deletions

View file

@ -105,7 +105,7 @@ func get_sector(pos):
#Return the current Map
func get_map():
return get_tree().get_nodes_in_group("map")[0]
return get_tree().get_nodes_in_group("map").front()
## tally up scores

View file

@ -18,6 +18,7 @@ const TRANS_SPEEDS := [0.8, 0.4, 0.2, 0.0000001]
#Game
var rumble: int = RumbleMode.FULL
var gore: int = Gore.FULL
var speedrun_timer: bool = false setget _set_speedrun_timer
var scoreboard_name: String = "" setget _set_scoreboard_name
var scoreboard_id: int = -1
@ -64,7 +65,8 @@ func load_options() -> void:
# game
rumble = file.get_value("game", "rumble", defaults.rumble)
gore = file.get_value("game", "gore", defaults.gore)
scoreboard_name = file.get_value("game", "scoreboard_name", "")
_set_speedrun_timer(file.get_value("game", "speedrun_timer", defaults.speedrun_timer))
_set_scoreboard_name(file.get_value("game", "scoreboard_name", ""))
randomize()
scoreboard_id = file.get_value("game", "scoreboard_id", randi())
# video
@ -87,6 +89,7 @@ func load_defaults(section: int = Section.ALL) -> void:
Section.GAME, Section.ALL:
rumble = defaults.rumble
gore = defaults.gore
speedrun_timer = defaults.speedrun_timer
scoreboard_name = defaults.scoreboard_name
scoreboard_id = randi()
Section.VIDEO, Section.ALL:
@ -107,6 +110,7 @@ func save_options() -> void:
#Game
file.set_value("game", "rumble", rumble)
file.set_value("game", "gore", gore)
file.set_value("game", "speedrun_timer", speedrun_timer)
file.set_value("game", "scoreboard_name", scoreboard_name)
file.set_value("game", "scoreboard_id", scoreboard_id)
#Video
@ -129,9 +133,16 @@ func save_options() -> void:
# Setters
# game setters
func _set_speedrun_timer(value: bool) -> void:
speedrun_timer = value
if not speedrun_timer:
SpeedrunTimer.visible = false
SpeedrunTimer.timer_running = false
func _set_scoreboard_name(value: String) -> void:
scoreboard_name = value.substr(0, 10).to_lower()
# video setters
func _set_fullscreen(value: bool) -> void:
fullscreen = value

View file

@ -0,0 +1,28 @@
extends CanvasLayer
export var bonus_color: Color
var time: float = 0.0
var timer_running: bool = false
onready var time_counter: Label = $Box/TimeCounter
func _physics_process(delta: float) -> void:
if timer_running:
time += delta
func _process(delta: float) -> void:
if visible:
time_counter.text = Game.format_time(time)
var map = Game.get_map()
if is_instance_valid(map):
if (Game.has_collection_bonus() && Game.time <= map.target_time_100) or (!Game.has_collection_bonus() && Game.time <= map.target_time_any):
time_counter.modulate = bonus_color
return
time_counter.modulate = Color.white

View file

@ -0,0 +1,32 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://autoloads/speedrun_timer.gd" type="Script" id=1]
[ext_resource path="res://graphics/hud/hud.png" type="Texture" id=2]
[ext_resource path="res://ui/theme.tres" type="Theme" id=3]
[sub_resource type="AtlasTexture" id=1]
atlas = ExtResource( 2 )
region = Rect2( 0, 180, 58, 12 )
[node name="CanvasLayer" type="CanvasLayer" groups=["viewport_autoload"]]
pause_mode = 2
layer = 127
visible = false
script = ExtResource( 1 )
bonus_color = Color( 0.478431, 1, 0.47451, 1 )
[node name="Box" type="TextureRect" parent="."]
anchor_top = 1.0
anchor_bottom = 1.0
margin_top = -12.0
margin_right = 58.0
texture = SubResource( 1 )
[node name="TimeCounter" type="Label" parent="Box"]
modulate = Color( 0.478431, 1, 0.47451, 1 )
margin_left = 1.0
margin_top = 1.0
margin_right = 57.0
margin_bottom = 11.0
theme = ExtResource( 3 )
text = "00:00:00"

View file

@ -66,6 +66,7 @@ func _on_2083_energy_changed(amount,laser_energy) -> void:
func _on_Famira_died() -> void:
sg2083.state = sg2083.State.INACTIVE
SpeedrunTimer.timer_running = false
Game.can_pause = false
var tween = create_tween()
tween.set_trans(Tween.TRANS_CUBIC)

View file

@ -108,4 +108,7 @@ func _on_player_teleport_finished() -> void:
Fade.fade_out(Options.transition_speed_secs)
yield(Fade, "fade_finished")
get_tree().paused = false
if Options.speedrun_timer:
SpeedrunTimer.timer_running = true
SpeedrunTimer.visible = true
SceneManager.current_scene = load("res://cutscenes/intro_story.tscn").instance()

View file

@ -7,6 +7,8 @@ func _ready():
Game.marathon_mode = false
Fade.fade_in(Options.transition_speed_secs)
#Grey out continue if no save files
SpeedrunTimer.visible = false
SpeedrunTimer.timer_running = false
yield(get_tree(),"idle_frame")
if Save.current_file and not Save.current_file.debug:
$Panel/Continue.grab_focus()

View file

@ -13,6 +13,7 @@ onready var select_tab: HBoxContainer = $"%SelectTab"
# options nodes
onready var rumble: HBoxContainer = $"%SelectRumble"
onready var gore: HBoxContainer = $"%SelectGore"
onready var speedrun_timer: HBoxContainer = $"%SelectSpeedrunTimer"
onready var fullscreen: HBoxContainer = $"%SelectFullscreen"
onready var window_size: HBoxContainer = $"%SelectWindowSize"
onready var scaling: HBoxContainer = $"%SelectScaling"
@ -47,6 +48,7 @@ func _init_values() -> void:
# game
rumble.selection = Options.rumble
gore.selection = Options.gore
speedrun_timer.selection = 1 if Options.speedrun_timer else 0
# video
fullscreen.selection = 1 if Options.fullscreen else 0
window_size.selection = int(Options.window_size) - 1
@ -81,6 +83,9 @@ func _on_Rumble_selected(selection) -> void:
func _on_Gore_selected(selection) -> void:
Options.gore = selection
func _on_SelectSpeedrunTimer_selected(selection) -> void:
Options.speedrun_timer = selection == 1
#
# VIDEO

View file

@ -160,16 +160,41 @@ margin_left = 39.0
margin_right = 218.0
margin_bottom = 12.0
focus_neighbour_top = NodePath("../../Rumble/SelectRumble")
focus_neighbour_bottom = NodePath("../../ScoreBoardName/PlayerNameInput")
focus_neighbour_bottom = NodePath("../../SpeedrunTimer/SelectSpeedrunTimer")
focus_mode = 2
size_flags_horizontal = 3
script = ExtResource( 3 )
options = [ "none", "no stains", "full" ]
[node name="ScoreBoardName" type="HBoxContainer" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Game"]
[node name="SpeedrunTimer" type="HBoxContainer" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Game"]
margin_top = 32.0
margin_right = 218.0
margin_bottom = 42.0
margin_bottom = 44.0
rect_min_size = Vector2( 0, 12 )
[node name="Label" type="Label" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Game/SpeedrunTimer"]
margin_top = 1.0
margin_right = 105.0
margin_bottom = 11.0
text = "Speedrun Timer:"
[node name="SelectSpeedrunTimer" type="HBoxContainer" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Game/SpeedrunTimer"]
unique_name_in_owner = true
margin_left = 109.0
margin_right = 218.0
margin_bottom = 12.0
focus_neighbour_top = NodePath("../../Gore/SelectGore")
focus_neighbour_bottom = NodePath("../../ScoreBoardName/PlayerNameInput")
focus_mode = 2
size_flags_horizontal = 3
script = ExtResource( 3 )
condense = true
options = [ "off", "on" ]
[node name="ScoreBoardName" type="HBoxContainer" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Game"]
margin_top = 48.0
margin_right = 218.0
margin_bottom = 58.0
[node name="Label" type="Label" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Game/ScoreBoardName"]
margin_right = 112.0
@ -181,7 +206,7 @@ margin_left = 130.0
margin_right = 203.0
margin_bottom = 10.0
rect_min_size = Vector2( 73, 0 )
focus_neighbour_top = NodePath("../../Gore/SelectGore")
focus_neighbour_top = NodePath("../../SpeedrunTimer/SelectSpeedrunTimer")
size_flags_horizontal = 6
custom_constants/line_spacing = 0
custom_styles/focus = SubResource( 5 )
@ -863,6 +888,7 @@ align = 1
[connection signal="selected" from="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/SelectTab" to="." method="_on_tab_selected"]
[connection signal="selected" from="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Game/Rumble/SelectRumble" to="." method="_on_Rumble_selected"]
[connection signal="selected" from="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Game/Gore/SelectGore" to="." method="_on_Gore_selected"]
[connection signal="selected" from="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Game/SpeedrunTimer/SelectSpeedrunTimer" to="." method="_on_SelectSpeedrunTimer_selected"]
[connection signal="focus_entered" from="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Game/ScoreBoardName/PlayerNameInput" to="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Game/ScoreBoardName/PlayerNameInput" method="_on_focus_entered"]
[connection signal="focus_exited" from="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Game/ScoreBoardName/PlayerNameInput" to="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Game/ScoreBoardName/PlayerNameInput" method="_on_focus_exited"]
[connection signal="gui_input" from="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Game/ScoreBoardName/PlayerNameInput" to="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/Tabs/Game/ScoreBoardName/PlayerNameInput" method="_on_gui_input"]

View file

@ -110,6 +110,7 @@ Console="*res://autoloads/console.tscn"
Fade="*res://autoloads/fade.tscn"
StainLayer="*res://autoloads/stain_layer.tscn"
ScoreBoard="*res://autoloads/scoreboard.gd"
SpeedrunTimer="*res://autoloads/speedrun_timer.tscn"
[debug]