Right now I'm making a 2D space shooter. I have a class, Ship, which holds all the data and behavior for spaceships. Each Ship object can contain multiple instances of another class, ShipPart. Right now I'm using ShipPart mainly for different animations that will trigger depending on different types of status variables in the Ship object.
For example, right now I'm using ShipPart instances to display thruster animations. When the Ship is moving, the ShipPart for thrusters is set to Active and the animation displays.
Ideally what I want to be able to do is set a variety of on/off statuses for the Ship class that can correspond to any given ShipPart instance. I was thinking that using basic bits to do this could work. I could use a simple 16 bit or 32 bit variable in the Ship class, giving me 16 or 32 possible "states" for any Ship object. Then doing an appropriate bitwise comparison to a corresponding variable in each ShipPart instance, could set their "Active" boolean variable accordingly.
The only issue I'm not 100% sure about the best way to do this. Any help? Or if anyone has a better way of going about this, I'm happy to hear it.