360 degree turn on Gamepad Stick condition

0 favourites
  • 8 posts
From the Asset Store
JPEG format 364x HD backgrounds in 2688 x 1536 Resolution
  • Hello!

    I'm having trouble figuring out how to express a condition using the GamePad plugin where Construct detects a complete turn of one of the gamepad sticks to move an sprite.

    Any ideas?

    Thanks!

  • I'm gonna try and see if this plugin may help me

    scirra.com/forum/plugin-unistroke-gesture-recognizer_topic48720_page1.html

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That didn't help. Can't make unistroke work with a gamepad.

  • you have to calculate it using the system expression for angle

  • Thank you OrangeTapioca.

    Been trying to do so but I don't know what values would I use for the angle.

    I imagine something along the lines of this:

    angle(Gamepad.Axis(0,0), GamepadAxis(0,1), x2, y2)

    But what would be the values of the second point (x2,y2)? Utterly confused here.

    EDIT: I calculated the angle, but don't know how to use that to detect a full stick turn.

  • Probably the easier way is to mark that certain angle criteria has been met. I wouldnt say is the best way, but probably easiest. Even if some one `cheats` it would be less effective than just doing a circle.

    key anlges. There are the angles that when you analog stick is between. Then trigger a check so it doesn`t need to be done again.

    -10 - +10 : right

    -80 - -100 : up

    -170- +170 : left

    +80 - +100 : down

    * I might be mistaken with up and down :P

    I believe your also looking for

    angle(0, 0, Gamepad.Axis(0,0), gamepad.axis(0,1))

    the first xy in angle represents the center of position to determine the angle. Where the second XY represents the angle. So you want your gamepad as the second values. Since your using your controller, and not world space. The first XY would be 0/0(center of the world)

    good luck :)

  • Thanks Jayderyu.

    I did this and it check the angles accordingly.

    <img src="http://i.imgur.com/bm2JjV5.jpg" border="0" />

    I still have no clue on what would the logic be to make sure the player meets this 4 conditions (right, down, left, up) in a sequence. I presume that would be the way to know it has made a full turn of the stick.

    Any ideas?

  • Kinda came up with a clunky solution.

    Basically each movement to an axis adds a different letter to a text field. So Right is R, Down D, Left L, and U up.

    When the text is RDLU, a full turn (kinda), the sprite goes up.

    But the results are very unreliable. Sometimes it doesn't seem to add the letters to the text. Somehow related to gamepad sensitivity?

    <img src="http://i.imgur.com/YWevd5H.jpg" border="0" />

    By the way, tried to do this with the Sequence Matcher plugin and didn't work, don't know why.

    I'm uploading my capx in case somebody could please check it out and give me a hand with this. I'd appreciate it.

    dropbox.com/s/ginusn4dlcv5kzu/bike.capx

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