DuckRun/code/main.gd
megamichi 431fb8220e - implementing biom change
- fixing typo in "highscore"
2024-10-18 16:34:51 +02:00

36 lines
966 B
GDScript

extends Node
func _ready() -> void:
$Screen/Background/Floor/EasterEggFixCollision.disabled = false
$Gui/HiscoreContainer.show()
%ScoreContainer.hide()
func start_game():
$Screen/Background/Floor/EasterEggFixCollision.disabled = true
$Screen/HindernissSpawner.del_all()
$Gui/EastereggSpawner.del_all()
$Screen/SpawnTimer.start()
$Screen/LevelUpTimer.start()
$Screen/Duck.start()
$Gui/HiscoreContainer.hide()
%ScoreContainer.show()
$"/root/Global".gamerunning = true
$"/root/Global".start.emit()
$"/root/Global".score = 0
$"/root/Global".speed = 100
func _on_level_up_timer_timeout() -> void:
if $"/root/Global".speed < $"/root/Global".maxspeed:
$"/root/Global".speed += 10
$"/root/Global".levelup.emit()
func _score() -> void:
if not $"/root/Global".gamerunning:
%ScoreContainer/score.text = ""
elif $Screen/Duck.alive:
$"/root/Global".score += 10
%ScoreContainer/score.text = str($"/root/Global".score)
func _process(delta):
pass