0 Favourites

on button released equivalent to analog stick

  • i am stuck in an event like this

    if overlapping"that" and

    right key is pressed   then set true

    if overlapping"that" and

    right key is released   then set false

    now i add this

    if overlapping"that" and

    right key is pressed or gamepad compare x>90

    then set true

    what is the reverse for the stick?

    if i add gamepad compare x <90 or compare x=0(for me to go to center)

    it just wont work. i also have the same for left so maybe it is looping

    non stop. with the pressed and released actions it works.

    thank you all!

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Since it's an analog control there is no on released. One way around this would be to use a global variable for each control with the values of 0 for up and 1 for down. Every tick set all controls to up or 0 then check the keyboard, gamepad or any other control scheme you use and set the relevant control to 1 or down. Be sure this is at the top of the event sheet. Then you can reference the variables elsewhere in your events to see the control state. This will make your events more readable and it will make it trivial to add more control types.

    global number control_left = 0

    global number control_right = 0

    ...

    Every tick:

    --- set control_left to 0

    --- set control_right to 0

    --- ...

    key left pressed

    or

    gamepad compare x<-90

    --- set control_left to 1

    ...

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