add DepthButton
This commit is contained in:
parent
e758168757
commit
47234f1bc1
9 changed files with 304 additions and 62 deletions
|
@ -15,6 +15,9 @@ var fade_scale_factor = 0.9
|
|||
onready var popup = $"."
|
||||
onready var panel = $Panel
|
||||
onready var tween = $Tween
|
||||
onready var easy_button = $Panel/Difficulty/Easy
|
||||
onready var normal_button = $Panel/Difficulty/Normal
|
||||
onready var hard_button = $Panel/Difficulty/Hard
|
||||
|
||||
func _init():
|
||||
var err = preferences.load(pref_path)
|
||||
|
@ -45,11 +48,11 @@ func _on_Cancel_pressed():
|
|||
fade_out()
|
||||
|
||||
func _on_Start_pressed():
|
||||
if $Panel/HBoxContainer/Easy.pressed:
|
||||
if easy_button.pressed:
|
||||
preferences.set_value("game", "difficulty", "easy")
|
||||
if $Panel/HBoxContainer/Normal.pressed:
|
||||
if normal_button.pressed:
|
||||
preferences.set_value("game", "difficulty", "normal")
|
||||
if $Panel/HBoxContainer/Hard.pressed:
|
||||
if hard_button.pressed:
|
||||
preferences.set_value("game", "difficulty", "hard")
|
||||
|
||||
preferences.save(pref_path)
|
||||
|
@ -58,21 +61,10 @@ func _on_Start_pressed():
|
|||
fade_out()
|
||||
|
||||
func _on_NewGamePanel_about_to_show():
|
||||
$Panel/HBoxContainer/Easy.pressed = false
|
||||
$Panel/HBoxContainer/Normal.pressed = false
|
||||
$Panel/HBoxContainer/Hard.pressed = false
|
||||
|
||||
var difficulty = preferences.get_value("game", "difficulty", "normal")
|
||||
match difficulty:
|
||||
"easy":
|
||||
$Panel/HBoxContainer/Easy.pressed = true
|
||||
"normal":
|
||||
$Panel/HBoxContainer/Normal.pressed = true
|
||||
"hard":
|
||||
$Panel/HBoxContainer/Hard.pressed = true
|
||||
_:
|
||||
assert("Invalid value")
|
||||
$Panel/HBoxContainer/Normal.pressed = true
|
||||
easy_button.pressed = difficulty == "easy"
|
||||
normal_button.pressed = difficulty == "normal"
|
||||
hard_button.pressed = difficulty == "hard"
|
||||
|
||||
$Panel/Start.grab_focus()
|
||||
|
||||
|
@ -83,4 +75,3 @@ func _on_NewGamePanel_about_to_show():
|
|||
tween.interpolate_property(self, "rect_position", scaled_center_position, original_position, fade_duration, Tween.TRANS_LINEAR, Tween.EASE_IN)
|
||||
tween.interpolate_property(self, "modulate:a", 0.0, 1.0, fade_duration, Tween.TRANS_LINEAR, Tween.EASE_IN)
|
||||
tween.start()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue