18 lines
477 B
GDScript3
18 lines
477 B
GDScript3
|
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())
|
||
|
|