[SOLVED] Sprite animation speed based on controller input?

Is it possible to change the animation speed of a sprite based on the stick of a controller?

i think i would need to get the x,y of the stick and do a little math but im not sure how or if it is even possible.

it would make slow walking/running/sprinting look much much smoother

There’s an action to changer an animation speed: image

Scale works as a multiplier, so if you set it to 2, it multiplies the speed by 2.

Gamepad wise, I believe sticks are treated as if they were digital, not analog. No pressure sensitivity as far as I know.

Ive looked around a bit and i think i have to agree. unless i use my own code (if possible in gdevelop in that way) it’s just left, right, etc.

pressure sensitivity is on triggers i believe, with the sticks its a x and y coord from each axis.
i would only need to be able to get the x,y.

Yup

do you know how to get them?

In the gamepad extension, there is an expression for Trigger Pressure, and there is an expression for Axis Value. Those are the ones you’d need for both items.

I looked in there and all i saw was


im lost on where to find the actual values

You are actually in string expression see the blue “ABC” button.
If you want get axis value this is a numeric value, that mean 123 blue button. Or you need to convert string value to numeric by an expression in the list.

thank you so much

1 Like

Note the value is normalized fom 0 to 1, and there is also an expression for get the angle (in degree 0-360) of the stick in this list.

i just used the stick pressure so that any direction they go, it’s a lot simpler to change the scale of speed