Skip to content

Responding to "events"  #18

@pkra8

Description

@pkra8

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions