Gamepad for shooting?

Get help using Construct 2

Post » Fri Feb 24, 2017 4:26 pm

i have an Xbox 360 controller for C2 and works fine. i want the player to shoot in 7 directions instead of using the right analog stick while standing still. Like, left shoulder trigger is down, make the player pause movement, when not moving, the player grabs his bow and using the right analog stick to go in 7 directions. Also, i dont want to use the right analog stick while moving or grabbing his bow, only when not moving and standing still. Any way i can accomplish this?
B
30
S
13
G
3
Posts: 132
Reputation: 4,141

Post » Sat Feb 25, 2017 3:46 am

please explain what you want to do better. It's hard to understand.

how does the player move? Left stick? and you want to aim with the Right stick?

make the bow a separate sprite that is pinned (position only) to the player. Then map the angle of the bow to the angle the Right Stick is pointing. If you want it to snap to 7 directions, just check the range and set it to 0, 45, 90, 135, 180 etc...

but remember Analog neutral is 0, X = 100 is all right X = -100 is all left and same for Y.

if you specifically want to only aim when not moving you need to give the player an instance variable called isMoving (or if you are using the platform behavior one already exists) then set it to true when the player isn't moving. Then add that to your aiming code. But invert it so you are saying XisMoving (not moving) - allow them to aim.
B
97
S
32
G
15
Posts: 1,194
Reputation: 16,170

Post » Sun Feb 26, 2017 1:34 am

is it possible for you to elaborate?
B
30
S
13
G
3
Posts: 132
Reputation: 4,141


Return to How do I....?

Who is online

Users browsing this forum: dop2000, namaewayukidesu, Xh3maa and 10 guests