implement marathon start screen
This commit is contained in:
parent
048d63a353
commit
db0a61e162
7 changed files with 267 additions and 53 deletions
49
menus/marathon_select_lives.gd
Normal file
49
menus/marathon_select_lives.gd
Normal file
|
@ -0,0 +1,49 @@
|
|||
extends Button
|
||||
|
||||
|
||||
const INFINITY_SIGIL := "▬↨"
|
||||
|
||||
|
||||
onready var back_arrow: TextureRect = $"../BackArrow"
|
||||
onready var next_arrow: TextureRect = $"../NextArrow"
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_update_display()
|
||||
|
||||
|
||||
func _update_display() -> void:
|
||||
if Game.use_lives:
|
||||
text = "%03d" % Game.marathon_lives
|
||||
else:
|
||||
text = INFINITY_SIGIL
|
||||
|
||||
|
||||
func _gui_input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("ui_left"):
|
||||
if Game.use_lives:
|
||||
Game.marathon_lives -= 1
|
||||
if Game.marathon_lives < 0:
|
||||
Game.use_lives = false
|
||||
else:
|
||||
Game.use_lives = true
|
||||
Game.marathon_lives = 999
|
||||
if event.is_action_pressed("ui_right"):
|
||||
if Game.use_lives:
|
||||
Game.marathon_lives += 1
|
||||
if Game.marathon_lives > 999:
|
||||
Game.use_lives = false
|
||||
else:
|
||||
Game.use_lives = true
|
||||
Game.marathon_lives = 0
|
||||
_update_display()
|
||||
|
||||
|
||||
func _on_focus_entered() -> void:
|
||||
back_arrow.visible = true
|
||||
next_arrow.visible = true
|
||||
|
||||
|
||||
func _on_focus_exited() -> void:
|
||||
back_arrow.visible = false
|
||||
next_arrow.visible = false
|
Loading…
Add table
Add a link
Reference in a new issue