Gamepad 8 Direction Movement w/ 2D Animation

Get help using Construct 2

Post » Tue Feb 26, 2013 1:58 pm

I had previously posted this in General on accident with no real advice so I figure I would ask here since mods haven't moved it over yet. I'll try to explain what I am attempting to do as simply as possible.

I am controlling a player sprite with a gamepad. The sprite has eight sequences of animation for all eight directions. The problems arises as soon as I start adding diagonal direction. I have managed to get as far as making the top arc work (left, left-up, up, up-right, right) and can also add movement and correct animation for just down. down-right and down-left break on their own, and break anything else calling "right" or "left". I'm pretty sure this has to be an issue with the way I am creating my events.

This is my latest working event page:



Event 2 is simply where I store previous direction variable on stop to play standing animation.

Any help would be greatly appreciate it. This issue haunted my dreams last night.

As a sidenote and completely unrelated - anyone know why y axis < 0 comes out to positive movement (ie - up)?
B
5
Posts: 11
Reputation: 697

Post » Tue Feb 26, 2013 2:55 pm

https://www.dropbox.com/s/c2o2dat2u66o39o/2d%20test%20rpg.capx

Here's the capx file for anyone interested in messing with it.
B
5
Posts: 11
Reputation: 697

Post » Tue Feb 26, 2013 3:26 pm

I haven't had any experience with using the Gamepad yet, but the way I did it in my game was to simulate it by button presses. So for up/right I would make the conditions: when both Up button and Right button are pressed -> play animation.

The tricky part is when you do just the Up direction, you have to make sure to tell construct that Right and Left are not down.

My plan has always been to have the Gamepad simulate the button presses so the player had the option of both. Not sure if any of that helps, but maybe it will give you an idea.
B
40
S
11
G
6
Posts: 228
Reputation: 6,951

Post » Tue Feb 26, 2013 3:31 pm

I was thinking the same thing except that in this instance I am using analog sticks. Maybe I'll have to mess with custom controls or something. The only other thing I was thinking of was to give the directions values instead of just greater than zero, but I'm not sure if that would work entirely either.
B
5
Posts: 11
Reputation: 697

Post » Tue Feb 26, 2013 5:31 pm

I remember seeing this tutorial on 8 Way animation on the site. They seemed to use the direction that you were going in degrees and trigger the animation that way.

https://www.scirra.com/tutorials/344/how-to-setup-a-simple-animation-system-for-8directions-behaiour
B
40
S
11
G
6
Posts: 228
Reputation: 6,951

Post » Fri Mar 01, 2013 2:57 am

That unfortunately won't work with a gamepad, which is the problem I'm having. Making it work with keyboard isn't what I've asked for help with. Thanks for the attempt though.
B
5
Posts: 11
Reputation: 697


Return to How do I....?

Who is online

Users browsing this forum: spcsmrf and 28 guests