How do I make use of thumbstick sensitivity?

Get help using Construct 2

Post » Mon Feb 23, 2015 1:53 am

I currently have a character that I can move at any angle based on the position of the thumbstick, but I'm having no luck controlling the player's speed based on how lightly the gamepad's thumbstick is being pressed down. Is there a way to implement this? Thanks in advance.
B
3
Posts: 2
Reputation: 179

Post » Mon Feb 23, 2015 3:33 am

the thumbstick has a range of values.. for example in my top down space game, the player's ship can spin left or right. So I take the value from the thumbstick to dictate how fast to spin:

IF Gamepad(0) Left analog X axis < 0 (meaning the player is pushing the stick to the left (since 0 to -100 are the values to the left)

THEN Rotate PlayerSprite (abs(Gamepad.Axis(0,0)) * ThrusterAmount) * dt DEGREES CounterClockwise

So, I take the absolute value to invert the negative number... so now my rotation is varying on how far the player pushes the stick to the left.. they can be really delicate and spin really slow or jam the stick to the way left and spin at max speed...
B
97
S
32
G
15
Posts: 1,183
Reputation: 16,148

Post » Tue Mar 17, 2015 9:17 pm

jobel wrote:the thumbstick has a range of values.. for example in my top down space game, the player's ship can spin left or right. So I take the value from the thumbstick to dictate how fast to spin:

IF Gamepad(0) Left analog X axis < 0 (meaning the player is pushing the stick to the left (since 0 to -100 are the values to the left)

THEN Rotate PlayerSprite (abs(Gamepad.Axis(0,0)) * ThrusterAmount) * dt DEGREES CounterClockwise

So, I take the absolute value to invert the negative number... so now my rotation is varying on how far the player pushes the stick to the left.. they can be really delicate and spin really slow or jam the stick to the way left and spin at max speed...

You're talking about rotating the ship based on the angle of the thumbstick, right? I'm referring to the actual amount that the player is pressing the thumbstick in that direction.

I have it set so that the character faces the direction that the right thumbstick faces using this value for the angle: angle(0, 0, Gamepad.Axis(0, 2), Gamepad.Axis(0, 3))

I'm looking for a way to track the value of the amount the thumbstick is being pushed away from its resting position. Even a boolean value would work, as the 0 value is used for when its both resting, and being pushed to the right.
B
3
Posts: 2
Reputation: 179

Post » Wed Mar 18, 2015 7:04 pm

the thumbstick has a range of values which tells you where exactly the stick is.. you can use that range to effect how much speed you add to the player.

-100-----0-----100

so a little to the left is like -20, all the way left is -100, midway to the right is 50 etc...

if you actually mean press down, as in click the stick.. that won't work because its merely a button - on/off and does not have a pressure sensitive range. It's not like a midi keyboard with velocity values...
B
97
S
32
G
15
Posts: 1,183
Reputation: 16,148


Return to How do I....?

Who is online

Users browsing this forum: Anonnymitet, David181, Exabot [Bot], luckyrawatlucky, shawnzien and 4 guests