LD46/portals/OreSpawner.gd

16 lines
320 B
GDScript3
Raw Permalink Normal View History

extends Node2D
func _ready():
pass
func spawn_ore():
if len($DumpZone.get_overlapping_bodies()) <= 0:
var product = Constants.MATERIAL_SCENES[Constants.MATERIAL_TYPE.iORE].instance()
var outpos = position
product.position = outpos
$"../../Objects".add_child(product)
func _on_Timer_timeout():
spawn_ore()