Timer at 0 seconds doesn’t fire?
-
So, I am just trying out a simple breakout style game, and attempting to move the paddle by touch/holding it to do this, I have a while-holding behaviour set for world coordinates, I save the x coordinate into a box container. Then, I have a timer which reads the box container value, and sets the x position of the paddle object to that value.
This works ok, if the timer is set to every 1S, although there is obvious lag from the time I move my finger to the time the paddle moves. However if I set the timer to anything less than 1s the paddle does not move at all. The ‘pong’ example states that if a timer is set to 0 then it should attempt to fire every frame, so what’s going on here?
Note the label does indeed show the x position of where I am touch/holding correctly, and updates every frame (I believe). iit is simply the paddle movement that ceases to work if the timer is set to 0.
-
UPDATE: Move to point works successfully as long as the timer duration is set to >= 0.02
If, however, timer duration is set to any value < 0.02 (i.e. 0.019, 0.01, 0) then move to point fails. I am not filing this as a bug (yet) because I do not know whether this is expected behaviour.
Remember: This code works as expected if timer duration >= 0.02 but move to point fails silently if timer duration is set to < 0.02
-
-
This is case because every time the move behavior is triggered, it resets its previous animation. So using a duration of
0s
works because there's no animation. -
@RobinsonX Got it (I think) - so if the timer is 0.02 the animation succeeds because there is sufficient time for the move to complete and the starting point to be updated before the next iteration, but in the case of 0 seconds it is firing so fast that the move doesn’t have time to complete and therefore it constantly starts at the same point, is that it?
-
@Aceboss Yep!
If the time to move (
duration
) is equal to or less than theinterval
of the timer, then it will be able to complete its movement.