duncgibbs 99de9e8b40
Some checks failed
linting & formatting / build (push) Failing after 5s
itch.io publish action / build (linux64, x86_64) (push) Failing after 34s
itch.io publish action / build (osx, app) (push) Failing after 30s
itch.io publish action / build (win64, exe) (push) Failing after 31s
initial commit
2026-04-13 11:34:00 -05:00

32 lines
824 B
GDScript

class_name Spawn extends Tile
enum Size { SMALL, MEDIUM, LARGE }
const citizen_scene = preload("uid://bwx0lqtkd2jd7")
@export var spawn_size: Size = Size.SMALL
@export var direction: Board.Direction = Board.Direction.UP
var spawn_time: float = 0.5
var spawn_left: int
var current_time: float = 0
var board: Board
func _ready() -> void:
board = get_parent().get_parent()
match spawn_size:
Size.SMALL:
spawn_left = 10
func _process(delta: float) -> void:
current_time += delta
if current_time >= spawn_time and spawn_left > 0:
spawn_left -= 1
current_time = 0
var citizen: Citizen = citizen_scene.instantiate()
add_sibling(citizen)
citizen.board = board
citizen.position = position + (size/2)
citizen.set_offset(Vector2(randf_range(-40, 40), randf_range(-40, 40)))
citizen.direction = direction