This is just a short attempt to code a classical "Snake" game in Fortran.
Download, build and install raylib library using instructions from here:
Installing dependecies:
$ sudo dnf install alsa-lib-devel mesa-libGL-devel libX11-devel libXrandr-devel libXi-devel libXcursor-devel libXinerama-devel libatomic
Buliding raylib:
$ git clone --depth 1 https://github.com/raysan5/raylib.git raylib
$ cd raylib/src/
$ make PLATFORM=PLATFORM_DESKTOP # To make the static version.
$ sudo make install # Static version
Testing the installation
$ cd raylib/examples
$ make PLATFORM=PLATFORM_DESKTOP
$ git clone --depth 1 https://github.com/interkosmos/fortran-raylib
$ cd fortran-raylib
$ make
In build.sh
set the path to the directory containing fortran-raylib
code.
$ ./build.sh
$ ./a.out
The game speed, board size, number of snakes and number of food is controlled by modifying the source code.
- Press 'R' anytime to restart the game
- Press 'X' anytime to make "Snake #1" grow
All snakes are controlled by a computer. To control "Snake #1" manually,
uncomment a line in initialize
subroutine. The snake is then controlled
by 'ASDW' keys.