How do I create an event for when 2 keys are down?

Get help using Construct 2

Post » Wed May 14, 2014 3:26 pm

Hello, friends!

I recently started using Construct and I want to use a sprite sheet I've been working on for some time. Basically, the gameplay of my project is seen from an isometric point of view and I already programmed the sprite to move up, down, left and right without any problems at all. The real issue pops up once I press the left or right arrow, along with the up or down arrow. What I would like to do is use the same animations I already made for walking up, down, left and right, but for diagonal movement.

Say, I want the character to move towards the bottom right corner of the map. In that case, I have 2 options. I can either press the [↓] key and then the [→] key, or, I could press the [→] key first and then the [↓] key. In the first case, I would set the "Walk Down" animation, and in the second case, the "Walk Right" animation. In a way, what I want to accomplish is a movement system similar to the one in Don't Starve and Zelda: Minish Cap, where the characters only have 4 different walking animations but 8 different directions they can move towards.

Unfortunately, I don't know how to make an "if X key is down and then Y key is pressed" event, so I would appreciate any advise on this matter.



Reason for edit: I originally wrote "top-down", instead of "isometric". Apologies!
Last edited by TheBuob on Wed May 14, 2014 8:36 pm, edited 2 times in total.
B
4
Posts: 25
Reputation: 256

Post » Wed May 14, 2014 7:00 pm

I haven't look the Zelda game, but I think that you want something similar to this, and, if not, you can figure out the logic and work it out.
You do not have the required permissions to view the files attached to this post.
composer - multimedia artist
www.eli0s.com/en/
B
69
S
27
G
6
Posts: 1,146
Reputation: 10,379

Post » Wed May 14, 2014 8:34 pm

Sadly, that doesn't really help me. My animations can't be flipped nor mirrored since you don't see the player model from a top-down perspective, but rather from an isometric point of view. That being said, the "walk down" and "walk up" animations are completely different. I apologise for the confusion, since I just realised I wrote "top-down" in the OP. I'll correct it immediately.
B
4
Posts: 25
Reputation: 256

Post » Wed May 14, 2014 9:46 pm

I used the same 2 frames just for convenience. You will not use frames but animations after all. My point was to eliminate the animation change when moving diagonally.

I am re-attaching the file with some changes, the logic is exactly the same.
You do not have the required permissions to view the files attached to this post.
composer - multimedia artist
www.eli0s.com/en/
B
69
S
27
G
6
Posts: 1,146
Reputation: 10,379

Post » Wed May 14, 2014 10:14 pm

Marvelous! It worked! Thank you so much!
B
4
Posts: 25
Reputation: 256

Post » Wed May 14, 2014 10:34 pm

Sorry, I have a new, albeit small issue. The walking animation gets stuck in the first frame whenever I move in a diagonal line. Do you know what could be causing this?
B
4
Posts: 25
Reputation: 256

Post » Wed May 14, 2014 11:24 pm

Can you share your capx? Or a simplified version of it..?
composer - multimedia artist
www.eli0s.com/en/
B
69
S
27
G
6
Posts: 1,146
Reputation: 10,379

Post » Thu May 15, 2014 1:06 am

Unfortunately, I can't share the capx file at the moment, but here's pretty much all there is to the project in question. All I've done so far is work on the sprites in Photoshop, so I don't have that much to share Construct2-wise.
You do not have the required permissions to view the files attached to this post.
B
4
Posts: 25
Reputation: 256

Post » Thu May 15, 2014 2:08 am

Try not to use the "On X button released". Instead use the "8direction is moving" and the inversion of it to change from "Walk" to "Look" animations. Use an instance variable to set the direction that the player is facing.

See the updated capx.
You do not have the required permissions to view the files attached to this post.
composer - multimedia artist
www.eli0s.com/en/
B
69
S
27
G
6
Posts: 1,146
Reputation: 10,379

Post » Thu May 15, 2014 12:07 pm

Excuse me, but how did you manage to "set direction"? I can't find that anywhere. I apologise if that's a dumb question but again, I'm new to Construct 2 as an engine.
B
4
Posts: 25
Reputation: 256

Next

Return to How do I....?

Who is online

Users browsing this forum: Zzarkz and 20 guests