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"