Expand description
This is the heart of the crate. The core module contains the basic functions required to make a snake game.
Functionsยง
- head_
out_ of_ bounds - Checks if the snakes head is out of bounds.
- head_
touching_ object - Checks if the head of the snake is touching
object
. This is useful for collision detection with food or obstacles. - head_
touching_ self - Checks if the snakes head is touching itself.
- travel
- Moves the snake IN PLACE along the
direction
Vector. This is also the function that makes the snake grow by keeping the tail intact, whilst adding onto the head.