Analog Movement and Triggers?

0 favourites
  • 5 posts
From the Asset Store
Everything you need to incorporate old school hip hop bangers.
  • What's the most efficient way to have something move with 360 degree Analog stick movement and store the "intensity" (how far the stick is pushed in any direction) as a variable? Is it also possible to have analog trigger input?

    Tagged:

  • construct.net/en/make-games/manuals/construct-3/plugin-reference/gamepad

    Axis(Gamepad, Index)

    Retrieve the current position of an analog joystick on a specific gamepad. Index specifies left analog X and Y or right analog X and Y axes, subject to Key mapping. Axes range from -100 to 100. Axis values within the Analog deadzone are returned as 0.

    If you use distance(0,0,gamepad.axis(x),gamepad.axis(y)) where x and y are the correct gamepad and stick indexes, you'll get how far a stick is pushed.

    Button(Gamepad, Index)

    Retrieve the current button press value of a button on a specific gamepad. Index specifies the zero-based index of a button from the dropdown list in the Is button down condition (e.g. 0 returns the value for the A button). The returned value depends on the features of the button: if the button is pressure sensitive, it can return any value from 0 to 100 depending on the pressure; otherwise it returns 0 for not pressed and 100 for pressed. Buttons which are not pressure sensitive are easier to detect using the Is button down condition.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm unsure what goes in the "Index" part of the expression, what numbers correlate to what X and Y on which stick?

  • Nevermind, I think I got it, but I need a way to retrieve a positive number that is determined by how far a stick is from the center in any direction, as well as a way to make something angle itself 1:1 with the direction of the stick.

  • The distance expression always gives a positive number.

    The analog trigger is just another button. You'll have to figure out the button index by experimenting.

    To align something with the angle of the stick, use the angle expression instead of distance, from 0,0 for the origin and the x and y values for the relevant gamepad axises.

    Again, you'll need to figure out the axises yourself. Each stick has two, and the shoulder buttons might be axises as well.

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