๐ Snake Game V2 ๐
My CS50 Final Project
- ๐ง About the idea of โโthe game ๐ง
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.
- ๐จ๐ปโ๐ป About project ๐จ๐ปโ๐ป
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.
- ๐พ About the game ๐พ
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.
</br>Banana appearance
</br> - 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.
</br>Apple appearance
</br> - 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.
</br>Fast 1 appearance
</br> - Fast 2:
Fast 2 has the same foundation as fast 1 so that in this case it increases its speed to 3.
</br>Fast 2 appearance
</br>
when you have a 999 score the games end whit a victory message.
</br>
๐ฅ Win example ๐ฅ
</br>
But case you die.
</br>
๐ Died example ๐
Losing colliding with wall
Losing by -1
Losing by time
- ๐ฎ Controls ๐ฎ
- 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).
- ๐ Sounds ๐
The sounds has been made by: crazyduckgames
You can download them in: soundpack
His opengameart profile: crazyduckgames
- ๐ผ๏ธ Sprites ๐ผ๏ธ
All sprites has been made by me, using pixilart web application.
Pixilart can be accessed in: pixilart
- ๐ How to run ๐
Linux
PPA (Ubuntu)
1. Download and install Love2d
sudo add-apt-repository ppa:bartbes/love-stable
sudo apt-get update
sudo apt-get install love
2. Run game
git clone https://github.com/Dude-rgb/Snake-game-CS50-final-Project.git
love Snake-game-CS50-final-Project
AppImage
1. Download AppImage on love2d website
2. Add execution permission to the file
chmod +x love.AppImage
3. Run game
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
Windows
zip file
1. Download the zip file on love2d website
2. Get game and run
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
Installer
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
3. Drag and drop the folder (Snake-game-CS50-final-Project) on love2d shortcut
Mac
1. Download and install love2d
2. check if love has permissions to execute
3. Get game
git clone https://github.com/Dude-rgb/Snake-game-CS50-final-Project.git
4. Drag and drop the folder (Snake-game-CS50-final-Project) on love2d app
- ๐ค How to play ๐ค
- 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.
Return button
And...