You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Suppose now that the snake is moving to the "right". I quickly press the "up" and "left" directions keys in the speed time. The direction$ will push the "up" and "left", but withLatestFrom only Taking "Left", "Up" will be ignored, causing the snake to immediately go to the "Left" and collide with itself.
So both ticks$ and direction$ should make the snake moving.
I think change snake$ to be like this will resolve this bug:
@kiyonlin I noticed the bug too, tried your fix. The problem is now the speed of turning is much faster than the speed of going straight, and the game gets choppy
The problem with both is:- combineLatest - Next tick is not respecting keyevents resulting in multiple steps while making turns. withLatestFrom - Key events are getting lost between ticks.
So both combineLatest and withLatestFrom are not ideal for this. I think, we need some observable that resets the timer/interval on each key event so that the next tick is generated after N milliseconds of previous keyevent/tick.
PS:- Wrote an operator to achieve the required behaviour. Link
Suppose now that the snake is moving to the "right". I quickly press the "up" and "left" directions keys in the
speed
time. The direction$ will push the "up" and "left", but withLatestFrom only Taking "Left", "Up" will be ignored, causing the snake to immediately go to the "Left" and collide with itself.So both
ticks$
anddirection$
should make the snake moving.I think change
snake$
to be like this will resolve this bug:The text was updated successfully, but these errors were encountered: