-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
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:
let snake$: Observable<Array<Point2D>> = combineLatest(ticks$, direction$).pipe(
withLatestFrom(snakeLength$, ([_, direction], snakeLength) => [direction, snakeLength]),
scan(move, generateSnake()),
share()
);Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels