Module core

Source
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.