• Breaking News

    Determining next player state / animation (ECS) Hi all, I'm having a bit of trouble working out how to handle transitioning from one player state to another using an ECS, particularly with respect to determine the next animation to play. For example, some of my current approach includes logic such as: -> input system processes key down (left) -> raises "intent event (left)" -> intent system sets player vel.x -> raises "started moving (left)" event -> animation system plays appropriate animation Now I have introduced jumping/falling, I'm not sure how to handle situations like the following: In the collision system: Player lands on ground, should we play the running animation or the idle animation? Depends on whether left/right input is held (which only the input system knows about). Or we could look at the player's x acceleration (but this doesn't necessarily mean left/right input is down, it could be due to some other force). Do I raise an event to tell the input system the player has landed which then checks the current input state? Do I need some sort of player state enum (within a state component?). Is there a corresponding state system, or is it up to all the other systems to update this as necessary? Then there's situations such as when the player finishes firing a gun, should we change to running or idle animation? What drives this change, the animation system when the "fire" animation finishes? All advice welcome as always, Thanks https://ift.tt/eA8V8J

    Hi all, I'm having a bit of trouble working out how to handle transitioning from one player state to another using an ECS, particularly with respect to determine the next animation to play. For example, some of my current approach includes logic such as: -> input system processes key down (left) -> raises "intent event (left)" -> intent system sets player vel.x -> raises "started moving (left)" event -> animation system plays appropriate animation Now I have introduced jumping/falling, I'm not sure how to handle situations like the following: In the collision system: Player lands on ground, should we play the running animation or the idle animation? Depends on whether left/right input is held (which only the input system knows about). Or we could look at the player's x acceleration (but this doesn't necessarily mean left/right input is down, it could be due to some other force). Do I raise an event to tell the input system the player has landed which then checks the current input state? Do I need some sort of player state enum (within a state component?). Is there a corresponding state system, or is it up to all the other systems to update this as necessary? Then there's situations such as when the player finishes firing a gun, should we change to running or idle animation? What drives this change, the animation system when the "fire" animation finishes? All advice welcome as always, Thanks

    from GameDev.net http://bit.ly/2WQPnl4

    ليست هناك تعليقات

    Post Top Ad

    ad728

    Post Bottom Ad

    ad728