A simple snake game made with ncurses (Tested on windows only for now
).
- Download and unzip the zip file from releases
- Then run the bat file
This will open up the game window
After that you'll be asked to select the difficulty which determines how fast the snake will move
Press any key to start the game.
While playing if you press ESCAPE
or Q
it'll open the main menu
You can :
continue
playingrestart
the game (it'll reset all your points and levels
)quit
and if you hit a wall
or snake body
then it'll be game over
In the levels folder create a <level-name>.snake
file
Inside that file you need to add some commands to draw walls
hline(x, y, '<character>' or ASCII, length)
vline(x, y, '<character>' or ASCII, length)
- x -
x position of the line
- y -
y position of the line
- character -
character to draw
- ASCII -
ascii value of the character
- ASCII -
- length -
length of the line
box
border(ls, rs, ts, bs, tl, tr, bl, br)
ls
- left side,rs
- right side,ts
- top side,bs
- bottom side,tl
- top left-hand corner,tr
- top right-hand corner,bl
- bottom left-hand corner, andbr
- bottom right-hand corner.
ls
, rs
, ts
, bs
→ default_hline
or default_vline
tl
→ default_ul
tr
→ default_ur
bl
→ default_ll
br
→ default_lr
return(x, y, <increment or decrement>, lock_x, lock_y)
x
- x co-ordinate of the snakey
- y co-ordinate of the snakeincrement or decrement
- the values will be+1
or-1
to determine whether to draw the snake left, right, up or downlock_x
- the values will betrue
orfalse
to determine whether to start moving in the x-axislock_y
- the values will betrue
orfalse
to determine whether to start moving in the y-axis
Some useful macros: $w
& $h
$w
- contains the game window width$h
- contains the game window height