Health Bars and the Grand Unification of Entities
I managed to implement shield bars! I watched a bunch of videos on nine-slices and the automatic draw_health_bar()
function in GMS, but in the end I did it with a series of rectangle draw requests. The specific damage flashes briefly on the bar too, as I’d intended (a longer bar is drawn beneath the current value’s bar, but I have that fade out across multiple steps).
As I worked to implement this, I created (finally) an obj_base_entity
to give the player and obj_base_enemy
common logic (including shield-bar management), and in the process needed to update a lot of how the player’s shields work. I think I’m very close to moving the player’s shield mechanics over to the base entity as well—I just need to compare them with obj_base_enemy
. I think the major differences are that the enemy’s impact magnitude is 0, rather than a function of the shot power (so enemies don’t go flying when hit, and there’s contrast to their physics when their shields are down), and the flash mechanics (which are already part of base entity, so the player COULD flash if I wanted them to.)
Moving over to base entity for the player should make the implementation of enemy fighters smoother, and might open the way for a versus mode.
Anyhoo, that’s a major planned feature ticked off. Next major goals are base entity migration, shield-bouncing physics (perhaps easier once migrated), battle platforms, and seeking bullets.
I want to add a faction
enum variable to bullets so they can either belong to “PLAYER” or “ENEMY” (for now), and deflection-shields can flip the faction to allow the bullets to only deal damage to the enemy. Handy for seekers too.