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
Killing yourself by turning 180° is supposed to be prevented, but you can still do it. Assume you're going left. Quickly press down or up followed by right. If game logic hasn't run in between the two key-presses, you don't move vertically and so run into your tail right away.
To fix this, we should save the direction that was last advanced in (by a pixel or more after flooring), and disallow turning in the opposite of that direction.
The text was updated successfully, but these errors were encountered:
The other part is to advance the snake only by entire pixels at a time.
You can still trigger the bug if you are going right, press up/down,
"advance" 0.3333 pixels then press left, and the floor of your new
location equals the floor of the old. This is because using a position
variable with more precision than our collision-detecting routine is
silly :)
Killing yourself by turning 180° is supposed to be prevented, but you can still do it. Assume you're going left. Quickly press down or up followed by right. If game logic hasn't run in between the two key-presses, you don't move vertically and so run into your tail right away.
To fix this, we should save the direction that was last advanced in (by a pixel or more after flooring), and disallow turning in the opposite of that direction.
The text was updated successfully, but these errors were encountered: