Skip to content

DevSazal/snake-game-angular

Repository files navigation

Snake Game - Angular By DevSazal


Snake Game

The game was developed on angular 19.0.1.


Let's clone the repository on your machine.

The application includes the following files and folders:

# architecture
# deep drive

todo-app/
├── src/
│   ├── app/
│   │   ├── components/
│   │   │   ├── game/  # container component
│   │   │   │   ├── game.component.html
│   │   │   │   ├── game.component.css
│   │   │   │   └── game.component.ts
│   │   │   │
│   │   │   ├── playground/  # presentation component
│   │   │   │   ├── playground.component.html
│   │   │   │   ├── playground.component.css
│   │   │   │   └── playground.component.ts
│   │   │   │
│   │   ├── models/
│   │   │   ├── food.model.ts
│   │   │   └── snake.model.ts
│   │   │   │
│   │   ├── services/
│   │   │   ├── game.service.ts
│   │   │   └── score.service.ts  # use localStorage
│   │   │
│   │   ├── app.component.html
│   │   ├── app.component.css
│   │   ├── app.component.ts
│   │   ├── app.config.ts
│   │   └── app.routes.ts
│   │
│   ├── styles.css
│   ├── index.html
│   └── main.ts
│
├── angular.json
├── package.json
├── tsconfig.json
└── README.md

Installation and Configuration

Let's move to the cloned directory with your terminal.

To install, build, and start the application for the first time, run the following commands:

npm install

Already done? Cool! You are almost ready to enjoy the game ⛳️🐟🐍

Build & Run:

To start a local development server, run:

ng serve

Once the server is running, open your browser and navigate to http://localhost:4200/

Game Rules:

  • 15 seconds timer to collect food or game over
  • Game over if the snake hits the playground walls
  • Game over if snake's head collides with the body
  • Just move in the playground and grow by collecting food
  • Keyboard control: ArrowUp, ArrowDown, ArrowLeft, ArrowRight

🧑‍💻 Stay in touch

License

MIT licensed © 2024