How do I have different horizontal and vertical speed?

0 favourites
  • 3 posts
From the Asset Store
a full game example, menu system, with the first level and a boss, to create a horizontal shooter
  • 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!

  • Try Construct 3

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

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

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