Shmup-01/scenes/main.gd
Henry 996a0bb8f7 Add basic enemy behavior and spawning system
The changes introduce enemy mechanics and management - including
spawning, movement patterns, shooting timers, and death handling.
2025-10-13 18:55:09 +01:00

20 lines
434 B
GDScript

extends Node2D
var enemy = preload("res://scenes/enemy.tscn")
var score = 0
func _ready():
spawn_enemies()
func spawn_enemies():
for x in range(9):
for y in range(3):
var e = enemy.instantiate()
var pos = Vector2(x * (16 + 8) + 24, 16 * 4 + y * 16)
add_child(e)
e.start(pos)
e.died.connect(_on_enemy_died)
func _on_enemy_died(value):
score += value