My first 3D game with Godot 4.4
This commit is contained in:
20
game.gd
Normal file
20
game.gd
Normal file
@@ -0,0 +1,20 @@
|
||||
extends Node3D
|
||||
|
||||
@onready var score_label: Label = %ScoreLabel
|
||||
|
||||
var score = 0
|
||||
|
||||
func increase_score():
|
||||
score += 1
|
||||
score_label.text = "Score: " + str(score)
|
||||
|
||||
|
||||
func _on_mob_spawner_3d_mob_spawned(mob: Node) -> void:
|
||||
if mob.has_signal("died"):
|
||||
mob.died.connect(increase_score)
|
||||
else:
|
||||
print("this mob cannot die! (probably a bug)")
|
||||
|
||||
func _on_kill_plane_body_entered(body: Node3D) -> void:
|
||||
print("kill plane triggered")
|
||||
get_tree().reload_current_scene.call_deferred()
|
||||
Reference in New Issue
Block a user