How do I set an animation to a key combination?

Just started using Construct 2? Post your questions here

Post » Thu Sep 18, 2014 9:04 pm

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!
Posts: 6
Reputation: 239

Post » Thu Sep 18, 2014 10:36 pm

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

jump forward right

Event 2:
On Top arrow pressed (Trigger)
Key Right arrow Is down

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:

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 :)
Posts: 1,209
Reputation: 7,547

Post » Thu Sep 18, 2014 11:52 pm

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! :D
Posts: 6
Reputation: 239

Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests