360 aiming with a gamepad using the right stick

Discussion and feedback on Construct 2

Post » Fri Aug 09, 2013 12:00 pm

im having problems getting 360 aiming with the gamepad would be great if anyone had an idea how to. its for my 2 player arcade game
B
27
S
6
G
2
Posts: 222
Reputation: 2,823

Post » Fri Aug 09, 2013 2:35 pm

I believe you could get the angle with an expression like angle(0,0,Gamepad.Axis(0,0),Gamepad.Axis(0,1)), but unfortunately I can't test it as no browser recognises my Logitech controller.

EDIT: I did some digging and found a neat utility called x360ce that tricks Windows into thinking any USB gamepad is an Xbox one. After setting it up, I tested it and the above expression does indeed work.GeometriX2013-08-09 14:49:04
B
57
S
15
G
11
Posts: 912
Reputation: 12,581

Post » Fri Aug 09, 2013 3:05 pm

@GeometriX that's really neat!
B
92
S
30
G
24
Posts: 3,191
Reputation: 32,584

Post » Sat Aug 10, 2013 5:10 am

Thanks @GeometriX !
(ive got a official 360 controllers so i should be fine
B
27
S
6
G
2
Posts: 222
Reputation: 2,823

Post » Sat Aug 10, 2013 8:53 am

it seems to just make the the left stick for aiming instead.
B
27
S
6
G
2
Posts: 222
Reputation: 2,823

Post » Sat Aug 10, 2013 9:33 am

Yeah, I realised after I fully tested with movement and aiming that I was referring to the left analogue stick there.

To be frank, you should know how to fix this - you need to spend some time working through the manual and trying to understand how the gamepad object works and how axes are indexed.
B
57
S
15
G
11
Posts: 912
Reputation: 12,581

Post » Sat Aug 10, 2013 10:04 am

ive been messing with it still trying to make it work for me thanks
B
27
S
6
G
2
Posts: 222
Reputation: 2,823

Post » Sat Aug 10, 2013 10:21 pm

Someone posted a similar question yesterday here:

http://www.scirra.com/forum/360-controller_topic73177.html

The line of code that @Sargas posted at the end does exactly what you want.

[QUOTE=Sargas] you can use the angle the stick is at to move things around
angle(0,0,Gamepad.Axis(0,0),Gamepad.Axis(0,1))
after this you just need to add a "move forward" action when "something"[/QUOTE]

I've been messing with it myself and this is what I've come up with:

B
119
S
41
G
40
Posts: 835
Reputation: 27,790

Post » Sat Aug 10, 2013 10:29 pm

@andreyin: That's the exact expression that I posted in this very thread :P

You might notice that the expression doesn't do exactly what the OP requested, but since there's still some confusion about this, here's the expression that you use to get aiming with the right analogue stick: angle(0,0,Gamepad.Axis(0,2),Gamepad.Axis(0,3)).

Note the axes specified there - those refer to the right stick, whereas 0 and 1 (as in my first post in this thread) refer to the left stick.

The example capx that I posted in the other thread earlier.GeometriX2013-08-10 22:32:41
B
57
S
15
G
11
Posts: 912
Reputation: 12,581

Post » Sat Aug 10, 2013 10:38 pm

@GeometriX Whoops, should've read the thread before posting! Sorry! D:
B
119
S
41
G
40
Posts: 835
Reputation: 27,790

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 7 guests