alecmce/xember — Issue #18: Responding to "events" 
Author: PKrawczynski
Created: 2011-11-08 14:51:49+00:00
State: open

Hi, first of all I was thinking about that problem for a few days and tried different approaches but none was really satisfying.

Real life example. Im having systems that are responsible for:
-collision
-calculating velocity/gravity
-animating object
-rendering object
-logic (searching for enemies, regenerating hp etc)

For example, player is falling down from a platform so he gains velocity, because of time and gravity variables that are responsible for calculating it. Then he suddenly hits bottom platform, and polygons are separated but this is the point where im having a problem - right now velocity components MUST be informed that time of fall should be set to 0 and forces should be set to 0 as well. Also animation component must be requested to discontinue animating current display object and instead to show "hit" or "fell" animation. Last but not least - logic component must know that player hit ground so it will be possible once again for him to use "jump" action.

How can I achieve all of that without sensless coupling and injecting components into nodes/systems that should not ever have access to it. I thought about some "state" component but how should it work? how should i notify about continous state for example "falling" and about one-shot type of state "just fell."

Thats only really big architecture problem so far for me with xember.

Best Regards,
Pawel.