Computing: Free Pascal Programming

Programming Home   Home   Contact

Snake game (Snake2).


Description: Extended GUI implementation of my old snake command line game. Usage of cursor keys to move the snake, which grows by eating meals (blue meals grow the snake by 1 element; cyan meals have no effect; magenta meals decrease the snake's length by 1 element, except when it has eaten blue meals before) and dies when it hits the borders, hits the rocks (red) or when its length becomes less than 3 elements. At level 3, a good memory is also necessary: After the "Start" button has been pressed, the rocks are displayed just like cyan meals; thus the player has to remember what is the rocks' or/and the meals' (approximate) position.
Use "New" in the "Game" menu of the main window to start the game. In the game window, push the "Start" button to start a round. All meals, including the cyan ones, must be eaten before you may pass to the next round (the sheat key CTRL+F12 allows you to skip the resting meals and to directly pass to the next round). During the snake's movement, the "Pause" button pauses the game; press "Resume" to continue.

Change log:
Version 1.0 (Mai 2018): Original application (based on the "snake" command line program from 2016).
Version 2.0 (February 2020):
    - Game extensions: Addition of the magenta meals; addition of the "hidden rocks" feature.
    - Addition of the "Level" menu item; some minor changes...

Free Pascal features: Catching keyboard events. Usage of timers. Usage of shapes' Left and Top properties to move them around on the screen; usage of their Visible property to dispaly them as needed. Complex data structures (classical Pascal).

Screenshots:

Snake game: Main window
 
Snake game: Game window