#Array of Functions?
1 messages · Page 1 of 1 (latest)
yes. just write the name without the ()
var attacks := [bite, claw]
func rand_attack(target):
var attack = attacks.pick_random()
attack.call(target)
func bite(target):
pass
func claw(target):
pass
thanks! I tried to google it but got answers about function to string and what not. but this seems simple enough
so I got it to work, ish.
but it runs through every function, like all the time, constantly.
is there a way for one function to play to the end, some kind of cooldown and then go for a new one
It should wait to finish the .call unless the attack function contains await, then you also have to await the call