This is a simple Snake game built with Unity. The game allows players to control a snake, collect food to grow longer. It features play, pause, and restart controls, and displays the score.
- Control the snake using arrow keys or W, A, S, D.
- Grow the snake by eating food.
- Avoid/move through walls.
- Display the current score.
- Play, pause, and restart controls via buttons and the spacebar.
- Unity Hub
- Unity Editor 2022.3.23f1
-
Clone the repository:
git clone https://github.com/meggitt/ZnakeXenzia.git cd ZnakeXenzia
-
Open the project in Unity:
- Launch Unity Hub.
- Click on
Add
and navigate to the cloned project folder. - Open the project.
-
Download Zip File:
- Go to the project repository.
- Click on the green
Code
button. - Select
Download ZIP
.
-
Extract Files:
- Extract the downloaded ZIP file to your desired location.
-
Open the project in Unity:
- Launch Unity Hub.
- Click on
Add
and navigate to the extracted project folder. - Open the project.
-
Open Build Settings:
- In Unity, go to
File > Build Settings
.
- In Unity, go to
-
Select Platform:
- Choose your target platform (e.g., PC, Mac & Linux Standalone, WebGL).
- For Linux builds, if unity isn't supporting to select build directory then use commands
path/to/unity_exe -quit -batchmode -projectPath /path/tp/project -buildLinux64Player /path/to/build_output_exe
- Go to build_output and run the build_output_exe file (
./game
)
- Click
Switch Platform
.
-
Build the Project:
- Click
Build
. - Choose a location to save the build files on your local PC.
- Wait for the build process to complete.
- Click
- The score is displayed at the bottom of the game screen.
- Arrow Keys / W, A, S, D: Move the snake.
- Spacebar: Toggle between play and pause.
- Mouse: Click on Play, Pause, and Restart buttons.
- Speed: Initial value is 20.
- Speed Multiplier: Initially increases the speed by 1f.
- InitialSize: Initial size is 4.
- Move Through Walls: If checked allows snake to move through walls, if unchecked game will reset everytime snake hits/moves through walls.
Contributions are welcome! Please create an issue or submit a pull request with your changes.