This repository has been archived on 2024-07-02. You can view files and clone it, but cannot push or open issues or pull requests.
HoppyEaster/Scripts/EntitySystem/BunnyGenerator.gd

17 lines
477 B
GDScript

extends Node
@export var bunny_prefab : Resource
@onready var BunnyPrefab : PackedScene = load(bunny_prefab.resource_path)
func spawn_bunny(x : float, y : float, team : int, health : int) -> Bunny:
var bunny = BunnyPrefab.instantiate()
self.add_child(bunny)
bunny.global_position = Vector2(x,y)
bunny.health = health
bunny.team = team
return bunny
func _ready():
var bunny = spawn_bunny(960, 512, TEAM.EVIL, 3)
bunny.sub_on_death(func(bunny): bunny.queue_free())