letsgamedev / Suffragium

A game developed in a democratic cycle.
GNU Affero General Public License v3.0
51 stars 21 forks source link

Bug: Snake: Gameover when changing direction to fast #66

Closed Numenter closed 2 years ago

Numenter commented 2 years ago

Description

Gameover when changing direction to fast. snake_fast_rotation_death

Steps to reproduce the issue

  1. Open Snake
  2. Collect at least one apple
  3. Move right
  4. Press fast up or down than left
b7g commented 2 years ago

Thanks for opening the issue.

The underlying issue is this: the direction is changed with the first press and again with the second press. So that, the snake runs into itself backwards. This is possible, because both direction changes are accepted, but no step/movement happened between them.

I came up with following solutions:

I don’t think both are ideal, but considering the speed of the game the second option could work very good. Other opinions?

MarioLiebisch commented 2 years ago

Wanted to change something different anyway, so will have a PR for this soon™, so you can try it. I think best strategy would be a middle way between both.🙂

MarioLiebisch commented 2 years ago

This should have been fixed by #70.