Precise movement and gamepad in top down game

0 favourites
  • 2 posts
From the Asset Store
20 high quality click sounds, ready to improve your game's UI instantly
  • Hi everyone! I want to create a top down game where the player move the character using a gamepad and is stopped by solid.

    I'm using the 8direction behavior for the moment ut I'm unsatisfied because I want the character to move in the precise direction of the gamepad left stick. And the 8 direction behavior only goes to... 8 directions. So I lose precision.

    I also want the player to walk if the stick is not too inclined, and run if it is.

    I know I can find the stick angle using the expression angle(0, 0, Gamepadbeta.Axis(0, 0), Gamepadbeta.Axis(0, 1)) but after that, I'm lost.

    I have no idea if I need to use the Vector X/Vector Y options of the 8directions behavior, or MoveTo, or what would be the kind of code or lines to move it.

    Any help?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Gamepad.Axis(0,axis) should return a value from -100 to 100, which you can use for setting X/Y vectors. Something like this (you might need to change the axis indices):

    Player Set vector X to Gamepad.Axis(0,2)

    Player Set vector Y to Gamepad.Axis(0,3)

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