forked from team-sg/hero-mark-2
the start of marathon mode
This commit is contained in:
parent
83f0bccd9a
commit
d06acf2522
18 changed files with 607 additions and 26 deletions
49
menus/marathon_start.gd
Normal file
49
menus/marathon_start.gd
Normal file
|
@ -0,0 +1,49 @@
|
|||
extends Control
|
||||
|
||||
|
||||
const DISABLED_COLOR := Color(0xb0b0b0ff)
|
||||
|
||||
|
||||
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.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()
|
Loading…
Add table
Add a link
Reference in a new issue