fwenzel / serpent

An Open Web app version of the classic game "snake".
http://fwenzel.github.com/serpent
14 stars 2 forks source link

Prevent redundant touch on mobile from moving the snake #14

Open tofumatt opened 12 years ago

tofumatt commented 12 years ago

If the user taps the upper portion of the canvas when the snake is already travelling upward, their direction is changed (to left or right). This is confusing, especially if they are frantically tapping in a heated moment in the game and they then turn and die.

We should ignore input that is redundant (if you touch the top and are already travelling up: do nothing).

fwenzel commented 12 years ago

The current implementation may be flawed because it actually just divides the canvas into two touch zones (up/down OR left/right), depending on what two directions are even possible at this given moment. But that enables the problem you mention.

If instead we divided it into four zones somehow, the click targets would be much smaller, but would probably avoid this issue.