State changes in entities or components
Posted
by
GriffinHeart
on Game Development
See other posts from Game Development
or by GriffinHeart
Published on 2012-10-25T18:24:40Z
Indexed on
2012/10/25
23:17 UTC
Read the original article
Hit count: 265
component-based
|state
I'm having some trouble figuring how to deal with state management in my entities.
I don't have trouble with Game state management, like pause and menus, since these are not handled as an entity component system; just with state in entities/components.
Drawing from Orcs Must Die as an example, I have my MainCharacter and Trap entities which only have their components like PositionComponent, RenderComponent, PhysicsComponent.
On each update the Entity will call update on its components. I also have a generic EventManager with listeners for different event types.
Now I need to be able to place the traps: first select the trap and trap position then place the trap.
When placing a trap it should appear in front of the MainCharacter, rendered in a different way and following it around. When placed it should just respond to collisions and be rendered in the normal way.
How is this usually handled in component based systems?
(This example is specific but can help figure out the general way to deal with entities states.)
© Game Development or respective owner