Joystick 2 Object and "Repeat while <button> is pressed" (Negated)

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • So I figured out how to use the Joystick 2 object, almost without any problems. The thing is, I have a custom built platform engine using fastloops and a gravity variable.

    Here's the code I have which defines the speed of the jump and fall:
    +Gravity of "Player" < 10
    -Set Gravity to Gravity of "Player"+0.4

    And here's the code which defines the minimum jump height (as you can hold down jump to jump higher):
    +Repeat while "Z" is pressed (NEGATED)
    +Gravity of "Player" < 0
    -Set Gravity to Gravity of "Player"+1.65

    This works great when I use the keyboard, but if I use a controller input instead (using the Joystick 2 object), the player's minimum jump height is higher than when using the keyboard (ie. if he player taps the jump key, he won't jump as high).

    To clarify:
    +Joystick 1 button 1 is changed
    +Gravity of "Player" < 0
    -Set Gravity to Gravity of "Player"+1.65

    I've also tried the other Joystick options like this one:
    +Joystick 1 button 1 is pressed (NEGATED)

    That option does something different though, it barely lifts the player off the ground even when I hold down the jump button. Logically for me, this doesn't make sense as I thought a controller button would work the same way as a keyboard key.

    Is it because a controller's buttons work differently than a keyboard's, or have I done something wrong with the logic shown?

    Thank you in advance.

  • Maybe you can post an .mfa? What you posted there doesn't quite make sense to me since it's leaving out a few important things. Off the top of my head, I'd say that the Joystick 2 Object works fine and it's a bug with your code since the object doesn't alter the fundamental way Fusion processes events.

  • After some sleep and having looked at my code again, it seems like I hadn't actually tried all the joystick options... I thought I had. :)
    +Repeat while pressed joystick 1 button 1 (NEGATED) seems to work, now the player jumps as high when using a controller or the keys.

    Looks like I had just spent a couple of hours on something that I just needed a small break from. :)

  • Follow up question: It seems when using the Xbox controller, the Joystick 2 object only goes to 10 buttons (being the right analog click); does anyone know which buttons are the directional pad buttons and the trigger buttons? The help guide for Joystick 2 does not mention which button the numbers correspond to.

  • POV is the dpad, and Slidervalue and ZRotation might be the two analog buttons ("trigger buttons"). Remember that analog buttons/sticks are not traditional buttons: They register a value depending on how much they move.

    The object may need to be updated since the names don't match the controller stuff anymore, but that could also be a result of the Xbox 360 controller not following guidelines.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!