In my fifteenth video of the “Building a Game Development Framework” series, I demonstrate the Framework by creating a Shoot’em-up game. I implement a sophisticated Visual Effects API, introduce Enemy Projectiles, and streamlines the framework’s actor management.
I updated the “Color Effect” system into a more generic Effects API.
- Stacked Effects: Instead of a single color slot, every animation and motion now maintains a list of effects. This allows a sprite to simultaneously flash red (when damaged) and become transparent (when dying).
- Translucency Effect: A new effect class is added that controls the “Alpha” of a sprite over time. This is used to make obstacles fade away once they are destroyed.
- Global Resets: A
reset()method is added to actors, motions, and animations to ensure that all active effects are cleared when an actor is pulled back into the Object Pool for reuse.
To reduce repetitive boilerplate code, I created the ForgedActor class and an updated ActorFactory:
- Automatic Registration: Previously, developers had to manually call
factory.actorRemoved(this)in their code. Now, by extendingForgedActor, the actor automatically notifies its factory when it is “removed” from the game play, significantly simplifying the logic in the Laser and Obstacle classes.
The enemy ship is upgraded with offensive capabilities:
- Bullet Factory: Similar to the player’s lasers, enemy bullets use an
ActorFactorywith pooling (starting with a queue of 20 bullets). - Burst Fire Logic: The enemy ship uses a timer in its
updateChildmethod. Every 2 seconds, it enters a “firing state” where it launches a burst of 10 bullets, spaced 0.2 seconds apart. - Weapons Positioning: The code calculates the ship’s width and fires two bullets simultaneously from different positions on the ship’s hull.
New sound effects are integrated to distinguish between player and enemy interactions:
- Varying Hit Sounds: Distinct
.wavfiles are added for the player’s ship taking damage versus the enemy’s ship being hit. - Explosion Timing: The obstacle’s “hit” sound now triggers as soon as the collision is detected, coinciding with its red color flash and fade-out effect.
I demonstrate the new features in action, showing:
- Projectile Interactions: Logic is added so that enemy bullets don’t collide with the enemy’s own falling obstacles or lasers.
- Difficulty Adjustments: The enemy spawning time is reduced from 100 seconds to 5 seconds to get the action started sooner.
- Visual Polish: Obstacles now smoothly fade out into transparency when hit, rather than instantly vanishing.
By the end of this video, the framework supports a full combat loop where both the player and AI exchange fire, receive visual and auditory damage feedback, and utilize an efficient memory-management system for high volumes of objects.
