Mouse coordinates to gamepad right joystick

Get help using Construct 2

Post » Tue Aug 02, 2016 2:55 pm

Hi Everyone,

Im trying to do targeting for my 2d platformer. Thats how it looks and works for the mouse:

Event:
System => anglediff(PlayerHand.HandAngle, angle(PlayerHand.X, PlayerHand.Y, Mouse.X, Mouse.Y)) <Less Than 20

Action:
Machinegun => Set Angle Toward (Mouse.X, Mouse.Y)

My question is, how do I translate mouse coordinates into right joystick coordinates and get the same result?
B
3
Posts: 7
Reputation: 193

Post » Tue Aug 02, 2016 6:05 pm

You will need to do a little experimentation to see which axis maps to which index, but to get the angle your joystick is pointing, you'll use (for Gamepad 0, or single controller):

angle(0,0,Gamepad.Axis(0,XAxisIndex ),Gamepad(0,YAxisIndex))


Edit: Found a capx I made a while back to help you identify axis indexes. https://www.dropbox.com/s/8pes8gkyav87f ... .capx?dl=0
Mistakes were made.
B
51
S
25
G
107
Posts: 1,581
Reputation: 60,458

Post » Tue Aug 02, 2016 6:47 pm

Thank you @oosyrag! Ill try this tonight.
B
3
Posts: 7
Reputation: 193


Return to How do I....?

Who is online

Users browsing this forum: Lancifer, MPPlantOfficial, Sup with that?, Yahoo [Bot] and 68 guests