Gamepad 8 Direction Movement w/ 2D Animation

0 favourites
  • 7 posts
From the Asset Store
Rotate & Animation for 16 Direction & Mouse Direction
  • 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:

    <img src="http://i.imgur.com/t2pNzkr.png" border="0" />

    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)?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • https://www.dropbox.com/s/c2o2dat2u66o39o/2d%20test%20rpg.capx

    Here's the capx file for anyone interested in messing with it.

  • 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.

  • 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.

  • 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.

    scirra.com/tutorials/344/how-to-setup-a-simple-animation-system-for-8directions-behaiour

  • 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.

  • Google "smooth - gamepad - joystick - movement." Found it but I don't know if it works. I tried using it, but still no movement at all. :/

    NVM! it works! T_T finally haha..

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