How do I have two way joy-stick?

Get help using Construct 2

Post » Sun Jul 09, 2017 11:46 pm

How do I make an analog stick that only goes up and down? It would be used to control gun angle.
B
25
S
6
G
4
Posts: 173
Reputation: 3,933

Post » Mon Jul 10, 2017 9:54 am

You can do this by assigning events to the Joystick's Y axis only.

For example:

Right analog Y axis < 50 ---> Set gun angle -10 pixels
Right analog Y axis > 50 ---> Set gun angle +10 pixels

(I made the numbers up, you'd have to test and tweak it to get it behaving the way you like, and maybe swap the conditions / events round if you wanted inverted gun control or not). Not sure what method you are using to angle your gun so just modify that part of the code to make sense for your game engine.

I set the analog deadzone to 50 because I hate twitchy analog sticks, I think it's nice to have the stick only register input when the player has pushed it at least 50% off kilter, but of course change that if it's not right for you :)
Image



Coming soon on Steam!
B
16
S
9
G
3
Posts: 209
Reputation: 3,476


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 32 guests