Skip to content

Latest commit

 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Snake with SDL3 (c)

A traditional snake game written in c and rendered with SDL3. The game features the basic functionality of classic snake with some minor improvements like smoother movement.

Installation

To install the game, clone the repository and compile the project with make. Then run the main executable that was built by make.

cd <LOCATION>
git clone https://github.com/Samisalami05/snake.git
cd snake
make
./main

If you get any issues while compiling the game, it probably is because you dont have gcc installed or SDL3 on your system.

Implementation

The snake is essentially just a linked list of cells with each cell having their own position. Every time the snake moves, the cell chain is traversed and each and every cells position is updated. The same logic goes for rendering where all of the cells the chain is looped through and drawn.

struct snake {
	snake_cell* head;
};

struct snake_cell {
	int x;
	int y;
	snake_cell* next;
};

About

A snake game made with SDL3 in c

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages