Skip to content

Latest commit

Β 

History

History
103 lines (75 loc) Β· 2.58 KB

File metadata and controls

103 lines (75 loc) Β· 2.58 KB

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