How do I have different horizontal and vertical speed?

Get help using Construct 2

Post » Sat Sep 19, 2015 8:57 am

Hi all

I am using the 8 direction behavior with a gamepad to move a sprite around a track. I've got it to work, but what I now want to do is to be able to set the horizontal speed and vertical speed individually, based on the axis of the joystick. In other words, if you move the joystick fully to the right and slightly up, it must move quickly to the right and slowly upwards.

I suspect I may need to use the custom movement behavior for this, but I'm struggling to find a good example for this.

Any suggestions?

Thanks!
B
3
Posts: 2
Reputation: 179

Post » Tue Sep 22, 2015 8:04 pm

An update on this - I've come across the VectorX and VectorY properties of the 8 direction movement, which seemed to hold some promise, but I've had no luck on this so far.

Basically, I need to be able to use a joystick to move a sprite around the screen in a realistic way. Kind of like how you would "fly a plane" in two dimensions.

I'm desperate for a resolution to this...
B
3
Posts: 2
Reputation: 179

Post » Tue Sep 22, 2015 8:24 pm

Wouldn't it be possible to use the analogue input values and base the speed on them by multiplying?

"Joystick movement is in the range -100 to 100 on each axis, and if the distance from the center is below the Analog deadzone value, it will return 0"

so if the maximum speed is 400, you'd just set the speed to something like: abs(Axis(Gamepad, Index))*Maximumspeed
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775


Return to How do I....?

Who is online

Users browsing this forum: Cubeeo and 8 guests