48 lines
1.3 KiB
GDScript
48 lines
1.3 KiB
GDScript
extends Control
|
|
|
|
|
|
const DISABLED_COLOR := Color(0xb0b0b0ff)
|
|
|
|
|
|
onready var difficulty_buttons := [
|
|
$"%BeginnerButton",
|
|
$"%AdvancedButton",
|
|
$"%AdvancedButton",
|
|
$"%ProfessionalButton",
|
|
]
|
|
|
|
|
|
func _ready() -> void:
|
|
Fade.fade_in(0.4)
|
|
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.marathon_mode = true
|
|
Game.lives = Game.marathon_lives
|
|
Game.marathon_score = 0
|
|
Game.marathon_shards = 0
|
|
Game.marathon_deaths = 0
|
|
Game.current_level = LevelData.marathon_start
|
|
Game.change_map(LevelData.levels[Game.current_level].scene)
|
|
elif Input.is_action_just_pressed("ui_cancel"):
|
|
Game.marathon_mode = false
|
|
Game.current_level = 0
|
|
Fade.fade_out(Options.transition_speed_secs)
|
|
yield(Fade, "fade_finished")
|
|
SceneManager.change_scene(load("res://menus/main_menu.tscn").instance())
|
|
|
|
|
|
func _set_difficulty(difficulty: int) -> void:
|
|
var use_lives := Game.use_lives
|
|
Game.difficulty = difficulty
|
|
Game.use_lives = use_lives
|
|
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()
|