Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rational-kunal/over-engineered-snake
(Probably 🤷) over engineered snake game in vanilla javascript
https://github.com/rational-kunal/over-engineered-snake
js13k snake-game
Last synced: 30 days ago
JSON representation
(Probably 🤷) over engineered snake game in vanilla javascript
- Host: GitHub
- URL: https://github.com/rational-kunal/over-engineered-snake
- Owner: rational-kunal
- Created: 2022-08-21T15:09:28.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-08-27T16:34:17.000Z (over 2 years ago)
- Last Synced: 2024-10-15T19:40:58.478Z (3 months ago)
- Topics: js13k, snake-game
- Language: JavaScript
- Homepage: https://rational-kunal.github.io/over-engineered-snake/
- Size: 187 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Over Engineered Snake
A simple but (Probably 🤷) over-engineered snake game in vanilla javascript.
Live at this https://rational-kunal.github.io/over-engineered-snake GitHub page.This game was mainly developed to start learning about canvas and how we can create a game on it for the `js13k` challenge.
I am planning/hoping to design a new "Game Engine" with knowledge from this one, but with typescript, good documentation, and tests, in short, a better version of this one.
# Code structure
Following is the basic code structure used for this game.
- **core:**
Used for game logic that is essential to run the game.
- `Engine`: Manages "starting game", "game tick", "drawing".
- **framework:**
Base classes for entities used by `Engine` are used for implementing the game.
- `Frame`: Defines dimensions.
- `Entity`: The base class that is used for drawing.
- `CollidableEntity`: Entity that supports collision detection.
- `EntityController`: Business logic of entity.
- **snake:**
Implementation of base classes to support snake game.
- `RootEntityController`: As the name suggests, it manages every other controller and is passed to the engine. This controller has instances of other child controllers.
- `SnakeEntityController`: Logic to manage snake and event handling related to a snake, like "game over" after the snake collides with itself.
- `PowerEntityController`: Logic to handle power-ups and create a new power entity that does not collide with any other entities.
- `scoreManager`: Singleton score manager to count the current and high scores.
- `htmlManger`: Singleton HTML manager to update DOM elements as required.