Right Stick Axis Aiming

Get help using Construct 2

Post » Sun Oct 21, 2012 8:13 am

So I want to shoot a bullet in the direction of the right analog stick. This is what I have so far:


Every Tick

Set angle of 'Arm' toward X Gamepad.Axis(0,3) , Y -Gamepad.Axis(0.3)

I then have if axis is < 0 , Mirror 'Arm'


This sort of works, but not very well, the 'arm' glitches at the 0, 90, 180 and 270 angles.


Has anyone got a more elegant way of doing this?

Best,
Mick
B
39
S
12
G
8
Posts: 580
Reputation: 7,108

Post » Sun Oct 21, 2012 2:04 pm

i think this example will help you : http://www.scirra.com/forum/topic57777.html
B
48
S
15
G
6
Posts: 795
Reputation: 12,035

Post » Sun Oct 21, 2012 3:15 pm

[QUOTE=zsangerous] i think this example will help you : http://www.scirra.com/forum/topic57777.html[/QUOTE]

Thanks I've looked at that but didn't get anything out of it really, I couldn't see how to transfer the touch mechanics to the gamepad object as the gamepad works with + and - rather than actual 360 degree axis.
B
39
S
12
G
8
Posts: 580
Reputation: 7,108

Post » Thu Oct 25, 2012 3:36 pm

Just going to bump this as I'm still totally stumped. I still can't get the right analog stick to aim properly like in a twin stick shooter.
B
39
S
12
G
8
Posts: 580
Reputation: 7,108

Post » Sat Dec 08, 2012 3:53 am

I had a similar issue where it would kind of lock at 0, 90, 180, and 270 degrees. If that's the case then you just need to set the Analogue deadzone to 0 (click on gamepad in the projects window, and it should be there under gamepad properties). If that isn't the issue than I'm afraid I can't help..

Cheers
B
2
Posts: 1
Reputation: 277

Post » Sun Dec 09, 2012 2:35 am

CrudeMik could you send a stripped down version of capx that just focuses on the part you want working. I wouldn't mind trying to give this a shot. I want to make my game on the Ouya eventually and might come across a similar problem.

Also if you need to figure out 360 degree in C2
to 360: if(angle < 0) angle =+ 180
to C2: angle =- 180
B
87
S
18
G
9
Posts: 2,455
Reputation: 14,834

Post » Mon Dec 10, 2012 5:13 pm

For me I have not found the right analog stick's index. 2 and 3 are the trigger buttons, i started going up from there but didn't get a response so I stopped. Not sure if it's my controller (xbox360 wireless).

As for your original question (if you are still looking for an answer), Since the center of the stick is 0,0...
I was going to try getting the angle like this:
angle(0,0, Gamepad.Axis(0, 2), (Gamepad.Axis(0, 3))


also, i was going to trigger it with an "OR" block. So that it would only calculate it when the user was moving the stick beyond the dead zone. I had put in a custom dead zone for both axi. (rightAnalogDeadX) and (rightAnalogDeadY).

Condition:
if right analog y axis is greater than "rightAnalogDeadY"
or
if right analog y axis is less than "-rightAnalogDeadY" (negative)
or
if right analog x axis is greater than "rightAnalogDeadX"
or
if right analog x axis is less than "-rightAnalogDeadX" (negative)




B
16
S
1
G
3
Posts: 43
Reputation: 2,597


Return to How do I....?

Who is online

Users browsing this forum: fredriksthlm, MPPlantOfficial and 17 guests