41 lines
997 B
GDScript
41 lines
997 B
GDScript
extends Control
|
|
|
|
|
|
const DISABLED_COLOR := Color(0xb0b0b0ff)
|
|
|
|
|
|
export var first_level: PackedScene
|
|
|
|
|
|
onready var difficulty_buttons := [
|
|
$"%BeginnerButton",
|
|
$"%AdvancedButton",
|
|
$"%AdvancedButton",
|
|
$"%ProfessionalButton",
|
|
]
|
|
|
|
|
|
func _ready() -> void:
|
|
Fade.fade_in(0.4)
|
|
Audio.play_music(load("res://audio/music/rumble_revolution_demo.ogg"))
|
|
yield(get_tree(), "idle_frame")
|
|
difficulty_buttons[Game.difficulty].grab_focus()
|
|
|
|
|
|
func _input(event: InputEvent) -> void:
|
|
if Input.is_action_just_pressed("ui_accept") or Input.is_action_just_pressed("pause"):
|
|
Game.lives = Game.marathon_lives
|
|
Game.marathon_score = 0
|
|
Game.marathon_shards = 0
|
|
Game.change_map(first_level)
|
|
|
|
|
|
func _set_difficulty(difficulty: int) -> void:
|
|
Game.difficulty = difficulty
|
|
for b in difficulty_buttons:
|
|
b.get_parent().modulate = DISABLED_COLOR
|
|
difficulty_buttons[difficulty].get_parent().modulate = Color.white
|
|
|
|
|
|
func _on_DifficultySelect_focus_entered() -> void:
|
|
difficulty_buttons[Game.difficulty].grab_focus()
|