How do I set an animation to a key combination?

0 favourites
  • 3 posts
From the Asset Store
Random Maze Generator with Door & Key System - tutorial capx
  • Hello there, I'm fairly new to the creation of side scrollers, so I'm wondering, how do I make a specific animation play when you press the UP+RIGHT buttons?

    I've made a "guy" sprite pinned to an invisible sprite and gave the invisible one a platform behaviour. So far the left, right and jump animations work fine, but I can't figure a way to set a "forward jump" animation. Will the "key code" function be useful? if so, can someone tell me how to use it? I have found no clear example on that.

    Thanks in advance!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can make combinations by adding several conditions, so if you want to make it so the character jump forward when Right arrow and top arrow is down, you can add 2 events, I guess you can use keycodes as well. Anyway here is how you can do it:

    Both event do the same, so making a function to handle the actual jump would be best. But If you are not sure how to use functions you can just copy/paste one to the other so they are the same.

    Event 1:

    On Right arrow pressed (Trigger)

    Key Top arrow is down

    Actions:

    jump forward right

    Event 2:

    On Top arrow pressed (Trigger)

    Key Right arrow Is down

    Actions:

    jump forward right

    Then you just make one for the left as well. The reason you make 2 for each side is just to make sure that the player doesn't have to be precise when wanting to jump forward. But you could probably get by just using the first event, if you don't care to much.

    Or you can make if so:

    Event:

    On Right arrow down

    On Top arrow down

    That would work as well and is probably the best way, as players are most likely moving when they want to jump anyway

  • Oh my, you're a genius! I actually didn't think about adding the two actions "jump forward" and "move right" to trigger at the same time, thank you very much!

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