var loot_timer
func _ready():
loot_timer = Timer.new()
loot_timer.wait_time = 5
loot_timer.one_shot = true
# here is where you can specify what function gets called
# when the timer timers out, in this case it's drop_one_loot
loot_timer.connect("timeout",self,"drop_one_loot")
self.add_child(loot_timer)
func some_func_to_start_timer():
do_some_stuff()
do_other_stuff()
loot_timer.start()
# called when loot_timer times out based on the connect() function above
func drop_one_loot():
var loot_to_drop = get_loot_to_drop()
drop_loot(loot_to_drop)
That code would go in your player class. Your implementation of get_loot_to_drop()
and drop_loot()
are entirely up to how you've structured your loot system and game as a whole though. I would need more information about how your code is structured if you need help with that part.