A 100% vanilla JavaScript-made game about butterflies and flowers. Submission for the Indie Game Garage Jam #0.
- Aseprite
- HTML, CSS, JavaScript
- Visual Studio Code
The Game
class is composed by the following components:
Controls
: takes care of the player input (both keyboard and mouse events are supported).Scene
: renders a viewport for the game. Everything about the elements rendered on screen is contained here.Player
: a special class that wraps the sprite for the player object (in this case, the Butterfly). It interacts with the controls and the scene.Score
: a UI component to keep track of how much points the player has scored.Life
: a UI component that keeps track of how many life points the player has left.
As soon as the game starts, it renders everything in the UI and fires up the Spawner
implementations that the game requires. For Fly, Butterfly, there's a FlowerSpawner
that will render either Flower 1 or Flower 2 on a variable frequency, determined by the game level
and the amount of points
the player has scored.
On each frame, there's a collision detection between the player object and all of the rendered flowers. While both sprites are colliding, the hovered flower is consumed and the player's life points are increased.
Take a look inside the files and see the magic ✨
Because it's a Game Jam, and it's all about experimenting!
Feel free to use anything from this repo and remix it as you see fit. Keep in mind that the music track has a license of its own.