Tutorial finished
This commit is contained in:
14
main.gd
14
main.gd
@@ -2,6 +2,9 @@ extends Node
|
||||
|
||||
@export var mob_scene: PackedScene
|
||||
|
||||
func _ready():
|
||||
$UserInterface/Retry.hide()
|
||||
|
||||
func _on_mob_timer_timeout():
|
||||
var mob = mob_scene.instantiate()
|
||||
|
||||
@@ -9,6 +12,17 @@ func _on_mob_timer_timeout():
|
||||
mob_spawn_location.progress_ratio = randf()
|
||||
|
||||
var player_position = $Player.position
|
||||
|
||||
mob.initialize(mob_spawn_location.position, player_position)
|
||||
|
||||
add_child(mob)
|
||||
|
||||
mob.squashed.connect($UserInterface/ScoreLabel._on_mob_squashed.bind())
|
||||
|
||||
func _on_player_hit():
|
||||
$MobTimer.stop()
|
||||
$UserInterface/Retry.show()
|
||||
|
||||
func _unhandled_input(event):
|
||||
if event.is_action_pressed("ui_accept") and $UserInterface/Retry.visible:
|
||||
get_tree().reload_current_scene()
|
||||
|
||||
Reference in New Issue
Block a user