How do I manage a character with orthogonal states

0 favourites
  • 6 posts
From the Asset Store
State Machine
$10.99 USD
State Machine is a great tool for managing the state of anything in your game.
  • Hi,

    I'm creating a game where my main character has two directions of animations, like in the super mario games:

    • Dimension A: stand, run, jump, attack
    • Dimension B: lowLife, medLife, highLife

    So in this example I have 4*3 = 12 different animations, which my character must be able to play.

    Currently I realized this the following way, which I'm not very happy about:

    • I have one Sprite with 12 different animations: stand_1, stand_2, stand_3, run_1, run_2, etc.
    • I have some variables in my event sheets representing my state.
    • depending on my state variables I do some string concatenations to determine the next animation.

    Are there any better ways to accomplish the same result?

  • The best way is to make the player sprite invisible and use a visible player skin and change the animation as you like.

  • Did you follow this tutorial :

    https://www.scirra.com/tutorials/253/ho ... ame/page-1

  • Thx, but I don't understand what you mean by "skin". Could you explain that a little bit deeper?

    I found this topic about different player skins. But the answer there encourages exactly my current approach, i.e. having one sprite with 12 different animations and select them by string concatenation.

    No, I didn't follow this tutorial, because I only had the free licence, when learning construct (i.e. the sprites where not available). I just browsed it, but couldn't see anything about your skin approach.

  • I guess you could try making the body or skin in a different sprite with it's animation, so when the player runs the animation "Run" plays on the skin sprite and the player too, and then pin the skin sprite to the player.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • So you are using that naming convention + variables to determine wich animation to play? Something like:

    Variable: Player_State=1. (Lowlife)

    Player is on flor and not moving> Set animation= "idle_"&Player_State.

    i think this would be pretty good, since you would only need 4 events for the animation + 1 event to change the Player_state variable.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)