Late last year, inspired by Martin Jonasson & Petri Purho's "Juice It Or Lose It" video, I put together a LÖVE version of the "Juicy Breakout" game they originally did in Flash.
A good deal of coding, and three or four rounds of full refactoring later, I came up with an implementation that I’m moderately happy with. It can be found on github here.
Features implemented include:
Specific Juicy Features
- Splash Screen that bounces in
- Bricks and Paddle that drop in, with jitter and elastic shape/rotation scaling
- Bricks that flash colors, and rotate/scale-down/get launched off into background in the direction the ball hits them
- Ball that has elastic shape scaling, color-change, and rotation on collisions
- Paddle and Walls that elastically bounce when hit by ball
- Background that flashes colors on certain ball collision events
- Confetti particles that eject from ball upon collisions
- Flashing “You Win” text when all bricks are destroyed
- A backend Entity-Component system for managing entities, along with basic CNF-query class for retrieving entities with particular components
- Basic movement, input, collision, time, state, statistics-tracking, and rendering components / systems
- Behavior system for adding special frame-by-frame logic to entities
- Message system for announcing events and allowing entities to register their own response to events
- Emitter component / system (used stupidly for particles here, but generic for any kind of entity)
- Camera system (doesn’t get much advanced use here)
- Tweening and Scheduling systems
- Lua ports of a few basic Java-like collections classes
- Implementation of a Pool util class
Over the course of development, I refactored the codebase I was working on a few times to continually clean things up. Eventually I settled on creating a basic Entity-Component framework inspired by Artemis and posts by Adam Martin. Just about everything in the game is an Entity; every data attribute is packaged in a Component; and everything that happens to update or react to those Components happens in a System. For a basic overview of the theory behind this, check out this post.
When coming up with my own scheduler / tween systems, I was heavily influenced by code in VRLD's HUMP libraries. Other specific code I directly used can be found on the github page.
If you like what's there, I have more LÖVE experiments in my main love repository on github.