Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | websterek |
Hi!
I have bunch of dots, all of them are generated from tool
and I would like to animate them one after another with little delay.
Right now I’m using yield
function with timer
. But it’'s not perfect. Generally this dots are indicators of a button, when it’s pressed they are changing color from first to the last but if player release the button they should back to original state. Sadly if you are pressing and releasing button rapidly this function seems to works incorrectly for my purposes (like few last dot’s are starting early etc.).
Right now my code looks like this:
func turn_on():
for child in activate_nodes:
child.play()
timer.start()
yield(timer, "timeout")
func turn_off():
for child in activate_nodes:
timer.stop()
child.stop()
child.set_frame(0)
And here is sample scene:
How can I achieve this effect correctly? The best for me will be animating it from first to last but if button is released it’s animating back to beginning state (even if only part of them will be activated).
Let me see if I’m understanding what you’re saying.
What you want is a way to turn the colour of one button into another colour, and with a little delay, do the same for the next one, and repeat for the rest.
And when they’re released, put them back in the same color all at once?
SIsilicon | 2018-09-25 13:49
Yes, mostly, it’s need to be animated sprites because few next objects will be slightly different but action/reaction process will be still the same
websterek | 2018-09-25 14:09