Hey All,
I've been working on a little RPG and I'm trying to add an item drop system from dead enemies but am having trouble figuring out where to put the code. Originally I planned on using the following code:
extends enemy
func drop_item():
- var item = enemy .instance().
- add_child(item)
- var star_spawn_location = $Position2D
- star.position = star_spawn_location.position
If I put it on my enemy script, I don't think it will work because my enemy will already be dead so it will have no location to spawn the object.