0 Favourites

How do I have different horizontal and vertical speed?

  • 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!

  • 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...

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)