https://github.com/ankeetmaini/snake-game
https://github.com/ankeetmaini/snake-game
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ankeetmaini/snake-game
- Owner: ankeetmaini
- Created: 2019-03-04T17:51:14.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-05T05:39:34.000Z (over 7 years ago)
- Last Synced: 2025-01-24T10:29:44.831Z (over 1 year ago)
- Language: TypeScript
- Size: 81.1 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# snake-game
```bash
yarn
yarn dev
```
> open [http://localhost:1234](http://localhost:1234)
# architecure
- [index.ts](src/index.ts)
- entry point
- intializes Game by passing it an instance of `Renderer` and grid size
- [game.ts](src/game.ts)
- this takes care of the game loop
- it keeps track of state, like snake's position, food and the grid
- uses the `renderer.ts` to render the grid every 800ms
- [renderer.ts](src/renderer.ts)
- this renders the grid to the screen
- currently uses `Canvas`, but needs a bit more polishing