How do I can set the animation of the character correctly

0 favourites
  • 10 posts
From the Asset Store
3 pixel charaters with over 8 animations each + animations with a gun
  • Greetings.

    I have the following problem.

    I created a character that can move in four directions, but when preciono more than one key at the same time address, animations stop playing correctly, for example:

    arrow left + arrow up = the character moves but the animation is the first motion picture to the left.

    then I show a screenshot of my events

    Thank you very much for your help

  • You can add the inverse keys as well.

    For instant:

    Left arrow is down

    X Up arrow is down

    X Down arrow is down

    X Right arrow is down.

    Then you make one for each possibility you need.

    Left arrow is down

    Up arrow is down

    X Down arrow is down

    X Right arrow is down

    etc.

  • Thank you very much for your reply.

    Excuse me but I really did not understand it refers to.

    Could you elaborate a little more please?

  • If left-arrow-key is down and up-arrow-key is down, there are two events that are both executed, because the conditions are true.

    so every tick the computer is told to start animation for left and animation for up, in effect showing the first frame of animation every tick.

    To solve this you have to make sure only one of the two events is true.

    This can be done by adding extra conditions like the ones nimos100 shows in his post.

  • This programming would result in nested if statements?

    for example

    if (LEFT_ARROW is down)

    {

    if (up_arrow is down)

    {

    //move player to up

    }

    etc ....

    }

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm not familiar with nested anythings, but you could try using else statements, if that suits your need.

  • Thank you very much for your reply.

    Excuse me but I really did not understand it refers to.

    Could you elaborate a little more please?

    If you right click for instant "On left arrow pressed" you can inverse it. Meaning as long as "Left arrow is not pressed" it will be true.

    Since you need to test vs several key press at the same time, there are more options than simply to test vs one.

    So you have to add a "On left arrow pressed" and "On up arrow pressed, if you would like you character to jump to the left for instant. Like so:

    Left arrow is down
    Up arrow is down
    [/code:2ghh01d1]
    
    Since you also have one for moving left:
    [code:2ghh01d1]
    Left arrow is down
    [/code:2ghh01d1]
    
    Both of these will trigger if you for instant Jump to the left. Because moving left will trigger true whenever left button is pressed. So to make sure that it doesn't do that you can do like this:
    [code:2ghh01d1]
    Left arrow is down
    X Up arrow is down (Inversed)
    [/code:2ghh01d1]
    So as long as left arrow is down and up arrow is not, then you character will move left. So you have to do that for all the possible ways you want you character to move.
  • ok, but,which event are X Up arrow is down (Inverted) in C2 ??

  • Right click...

  • thanks

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