2024-10-01 15:56:30 +02:00
|
|
|
extends Node
|
|
|
|
|
|
|
|
func _ready() -> void:
|
2024-11-10 19:51:00 +01:00
|
|
|
$Fade/Animation.play_backwards("fade")
|
2024-10-01 15:56:30 +02:00
|
|
|
$Screen/Background/Floor/EasterEggFixCollision.disabled = false
|
2024-10-09 21:02:14 +02:00
|
|
|
$Gui/HiscoreContainer.show()
|
|
|
|
%ScoreContainer.hide()
|
2024-10-01 15:56:30 +02:00
|
|
|
|
|
|
|
func start_game():
|
|
|
|
$Screen/Background/Floor/EasterEggFixCollision.disabled = true
|
2024-11-04 19:10:10 +01:00
|
|
|
$Screen/HurdleSpawner.del_all()
|
2024-10-18 16:34:51 +02:00
|
|
|
$Gui/EastereggSpawner.del_all()
|
2024-10-01 15:56:30 +02:00
|
|
|
$Screen/SpawnTimer.start()
|
2024-11-04 19:10:10 +01:00
|
|
|
$Screen/CoinSpawnTimer.start()
|
2024-10-01 15:56:30 +02:00
|
|
|
$Screen/LevelUpTimer.start()
|
|
|
|
$Screen/Duck.start()
|
2024-10-09 21:02:14 +02:00
|
|
|
$Gui/HiscoreContainer.hide()
|
|
|
|
%ScoreContainer.show()
|
2024-10-01 15:56:30 +02:00
|
|
|
$"/root/Global".gamerunning = true
|
|
|
|
$"/root/Global".start.emit()
|
|
|
|
$"/root/Global".score = 0
|
|
|
|
$"/root/Global".speed = 100
|
2024-10-22 19:52:35 +02:00
|
|
|
print("game started")
|
2024-10-01 15:56:30 +02:00
|
|
|
|
|
|
|
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:
|
2024-10-09 21:02:14 +02:00
|
|
|
%ScoreContainer/score.text = ""
|
2024-10-01 15:56:30 +02:00
|
|
|
elif $Screen/Duck.alive:
|
|
|
|
$"/root/Global".score += 10
|
2024-10-09 21:02:14 +02:00
|
|
|
%ScoreContainer/score.text = str($"/root/Global".score)
|