Issues with Timers not actually keeping exact time - moving Actor
Im wanting to have some 'waves' on my new game and they are basically a hand drawn actor so i am animating it by moving the actor up and down slowly.
Ive set a rule with 2 timer functions and it doesnt seem to keep time - basically the wave tends over time to drift up and off the screen!
RULE:every 2 seconds run to completion
for 1 second run to completion
move up speed of 10
after 1 second run to completion
move down speed of 10
this does make the wave go up and down but then after maybe 30 seconds ive noticed it has drifted up and after 5/10 minutes its gone up off the screen.
if i set the rule to go down first and then up then over time it slowly drifts down
any ideas why?
either i need a fix to this (or is it a timing bug) or i need a much better way because i have lots of these and other 'moving' actors and timers eat up resources im sure
Ive set a rule with 2 timer functions and it doesnt seem to keep time - basically the wave tends over time to drift up and off the screen!
RULE:every 2 seconds run to completion
for 1 second run to completion
move up speed of 10
after 1 second run to completion
move down speed of 10
this does make the wave go up and down but then after maybe 30 seconds ive noticed it has drifted up and after 5/10 minutes its gone up off the screen.
if i set the rule to go down first and then up then over time it slowly drifts down
any ideas why?
either i need a fix to this (or is it a timing bug) or i need a much better way because i have lots of these and other 'moving' actors and timers eat up resources im sure
Best Answers
-
jn2002dk Posts: 102
Yea timers aren't the best
Have a look at this thread http://forums.gamesalad.com/discussion/44707/timers-are-for-chumps-gs-optimization-tips
Some excellent solutions by @domenius -
ericzingeler Posts: 334
Yea, I stay away from time/timers as much as possible. Try to base your wave movement on position limits. Using the min and max functions in conjunction with accelerate or move will probably suit you best.
Let me know if you need more help with this.
Answers
used a few timer optimisations but actually in the end started thinking about my maths and using sin / cos within the speed parameter of a move behaviour and that gave me up and down movement so exactly what i needed for my waves and they never go out of sync. ever. and dont need a timer. yay.