sarpa.vi
I developed this simple Snake Game using the SDL2 library in C.
I was inspired by a video on the CS50 YouTube channel, which demonstrated 2D Games in C using SDL.
The name sarpa.vi (with 'sarpa/सर्प' meaning 'snake' in Nepali) playfully describes the snake-like behavior of my friends, while 'vi' refers to the Vim keybindings used for controls.
- SDL2
- C Compiler (gcc, g++ etc.)
sudo xbps-install gcc SDL2 SDL2-devel -ysudo apt-get install libsdl2-2.0-0 libsdl2-dev -y-
Clone the repository
git clone [email protected]:bvsvntv/sarpa.vi.git
-
Navigate to the project directory
cd sarpa.vi -
Project Structure
logic.{h,c}- Contains core game state and mechanicsrendering.{h,c}- Handles all SDL-specific drawing logicmain.c- Contains the game loop and event handling, delegating logic and rendering to the respective modules
-
Build and run the game using
makemake run
| KEY | ACTION |
|---|---|
i/<enter> |
start game |
h |
move left |
j |
move down |
k |
move up |
l |
move right |
esc |
quit the game |
<space> |
pause/play the game |
<super>/<control> + q |
quit the game |