As i followed the games track and i'm also passionate about retro games, so i decided to produce my version of the snake game.
When I was in the middle of development I decided to create something more, as I am an enthusiast in the field of artificial intelligence, I went after creating the AI โโplay option, however as I do not have all the knowledge about, I soon used a simpler device. What I used was a simple algorithm that observes which direction brings the character closer to the apple, giving the slight impression that the character knows what he is doing.
moreover, I decided to add some things in the right game that would make it more difficult, since I removed the collisions with the tail.
This game has been made with Lua and LรVE engine.
In this project we have those archives:
-
main.lua: This archive have the instructions to make the visual part of game;
-
Decision.lua: This archive is a simple library used to make decisions in the AI play;
-
push.lua: A library to make more simple the production of the visual part of your game;
-
fonts: Inside this folder there is the font used;
-
assets: This folder has the all images of the game;
-
sounds: Inside this folder we can found the sound effects used in the game;
-
images: Used images in this md file.
In this version of snake game we have two choices:
- Human Play
- You can play normally, how in the original game.
- Ai play
- the machine plays the game. In this version of the snake game I chose to remove the snake's collision with the tail and add some obstacles, of which are:
- Bananas:
When you collide with one of them your score decreases 1 point, if you collide several times and your score is less than 0 you lose.
There are a total of 11 bananas and they all remove 1 from your score.
when you crash into a banana, your time does not restore and all bananas and apples are moved.
- Apple:
When you touch a apple your score increases by 1, however there are 11 apples on the map and only one increases your score the other 10 do absolutely nothing.
when you collide with an apple your time is restored and all the apples and bananas are moved from position.
- Fast 1:
Fast 1 is a blue region present in 3 regions of the map, where when there is a passage over this obstacle its speed increases by 1, resulting in a speed of 2, however this obstacle can be used to gain an advantage, helping for example to arriving before 5 seconds on an apple, or it can harm, as for example end up passing the wall or hitting a banana.
when you have a 999 score the games end whit a victory message.
But case you die.
- Space (works in initial screen): select the AI play;
- Enter (works in initial screen): select human play;
- Backspace (works in all screens): return to the initial screen;
- Arrow keys (human play): control the direction of snake (human play case).
The sounds has been made by: crazyduckgames
You can download them in: soundpack
His opengameart profile: crazyduckgames
All sprites has been made by me, using pixilart web application.
Pixilart can be accessed in: pixilart
sudo add-apt-repository ppa:bartbes/love-stable
sudo apt-get update
sudo apt-get install love
git clone https://github.com/Dude-rgb/Snake-game-CS50-final-Project.git
love Snake-game-CS50-final-Project
1. Download AppImage on love2d website
chmod +x love.AppImage
git clone https://github.com/Dude-rgb/Snake-game-CS50-final-Project.git
./love.AppImage Snake-game-CS50-final-Project
NOTE: the name love.AppImage is arbitrary please put the name of your archive
1. Download the zip file on love2d website
git clone https://github.com/Dude-rgb/Snake-game-CS50-final-Project.git
love.exe Snake-game-CS50-final-Project
NOTE: the name love.exe is arbitrary please put the name path of your archive
1. Download the exe file on love2d website and install
2. Create a shortcut on your desktop (or other place), go to the path where love is installed and go to send to desktop
1. Download and install love2d
git clone https://github.com/Dude-rgb/Snake-game-CS50-final-Project.git
- First you need to select the mode of game, case you want to to play press
ENTER
else case you want to see the machine playing pressSPACE
.
- After choosing your game mode, if it has the human play (
ENTER
command) then you must use the arrow keys to change the snake's direction.
!ATTENTION!
When the game starts you have 3 seconds of invincibility after that the timer starts counting your 5 seconds, if you manage to get the right apple in this time your timer restarts and all apples and bananas, besides be careful also with bananas, all remove one point from your score, restore all positions of apples and bananas and finally keep your accountant by counting your time.
- Otherwise if you choose Ai play you simply need to watch the machine trying to win the game.
!NOTE!
All obstacles and features that you had in Human play are present in Ai play except the control with the arrow keys
- While the game is running you can return to the home screen using the
Backspace
key or if you want to exit just use theESC
key.
And...