Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Rayu |
func _ready() -> void:
for i in range(3):
spawn_enemy()
func _on_sprite_pressed(): <--- Event
Score += 1
----> spawn a new Enemy <----
func spawn_enemy():
var rand2 = floor(rand_range(0, Enemy.size()))
var piece2 = Enemy[rand2].instance()
add_child(piece2)
This is my Code.
With Every Event there comes a new Scene and with a new Scene i want that a new Enemy is spawned.
I want that the Enemycount is the same with the Score. ( if Score is 10 = spawn 10 new Enemies)
Can someone please help ? with Codes if possible :S