Skip to content

Snake slightly leaves the board before wall collision is handled #29

@Zsozsiii

Description

@Zsozsiii

When the snake hits a wall, the head can step slightly beyond the visible board boundary before the game over state is triggered.
If the snake moves towards a wall, on the last step its head coordinate briefly exceeds the board limit (e.g. X or Y becomes equal to or greater than the board size). Only after this happens does the collision logic stop the game. Visually, the snake appears to “step out of the board” for one tick before the game ends.
The game should detect the wall collision at the boundary: the head should not move outside the playable area. As soon as the next move would cross the board limit, the game should register a collision and immediately trigger game over, without an intermediate position beyond the board.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions