# 360 degree turn on Gamepad Stick condition

Get help using Construct 2

### » Wed May 08, 2013 2:04 am

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!
B
8
S
2
Posts: 39
Reputation: 1,492

### » Wed May 08, 2013 3:38 am

I'm gonna try and see if this plugin may help me
http://www.scirra.com/forum/plugin-unistroke-gesture-recognizer_topic48720_page1.html
B
8
S
2
Posts: 39
Reputation: 1,492

### » Wed May 08, 2013 4:21 am

That didn't help. Can't make unistroke work with a gamepad.
B
8
S
2
Posts: 39
Reputation: 1,492

### » Wed May 08, 2013 4:59 am

you have to calculate it using the system expression for angle
B
40
S
10
G
5
Posts: 103
Reputation: 6,620

### » Wed May 08, 2013 5:15 am

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:
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. wrongtarget2013-05-08 05:40:28
B
8
S
2
Posts: 39
Reputation: 1,492

### » Wed May 08, 2013 8:19 am

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

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 :)
B
94
S
18
G
9
Posts: 2,457
Reputation: 15,167

### » Wed May 08, 2013 1:40 pm

Thanks Jayderyu.
I did this and it check the angles accordingly.

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?
B
8
S
2
Posts: 39
Reputation: 1,492

### » Wed May 08, 2013 5:59 pm

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?

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.

https://www.dropbox.com/s/ginusn4dlcv5kzu/bike.capx
B
8
S
2
Posts: 39
Reputation: 1,492