Game #3: Space Shooter

This commit is contained in:
Felipe M 2021-01-23 20:20:30 +01:00
parent a00e9b59c9
commit f785a24c14
Signed by: fmartingr
GPG key ID: 716BC147715E716F
45 changed files with 927 additions and 0 deletions

View file

@ -0,0 +1,21 @@
extends Node2D
const Enemy = preload("res://Scenes/Objects/Enemy.tscn")
onready var spawnPoints = $SpawnPoints
func get_random_spawnpoint():
var points = spawnPoints.get_children()
points.shuffle()
return points[0].global_position
func spawn_enemy():
var spawn_location = get_random_spawnpoint()
var enemy = Enemy.instance()
enemy.global_position = spawn_location
get_tree().current_scene.add_child(enemy)
func _on_Timer_timeout():
spawn_enemy()