360 Plugin - On Key Pressed

This forum is currently in read-only mode.
  • Is there a way to make the 360 plugin only recognize the initial press of a button, such as the keyboard plugin's 'on key pressed' behavior? I'm running into a problem with my game's menus. For example, my pause menu. Even if I just tap the 'start' button on my 360 controller, several ticks go by in-game and as a result my pause menu flashes up on screen, then exits back to gameplay, then comes back up.

    I hope this makes sense. If not, I will try to offer a better explanation.

    Thanks!

  • Since the x360 object only has the one condition, you might have to code a workaround.

    Say, start a one-second timer on key press and then have your original event ignore that button unless the timer is at 0.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I've run into a similar issue before, and I dealt with it by using a variable to keep track of it's state. Suppose that you wanted to rotate a sprite 90 degrees per press to test it out:

    + Xbox360Controller: (1): Start is down
        + System: Is global variable 'StartPressed' Equal to 0
        -> System: Set global variable 'StartPressed' to 1
        -> Sprite: Rotate 90 degrees counter-clockwise
    + System: Else
    -> System: Set global variable 'StartPressed' to 0[/code:5sf9uw9a]
    
    I suppose that you'd need a global or private variable for each button press or multi-button press that you'd want to know the 'pressed' state of.
    
    Note that the [i]else[/i] condition is paired with the [i]Start is down[/i] condition, and the indented condition is a sub-event of the first condition.
  • Thanks for the replies. I was afraid that would be the solution .

  • I ran into this earlier today when trying out the most recent release (xb controller plugin was broken a while ago) and came up with this solution.

    I set up so pressing X make the character shoot.

    + Button X is down

    • Create object etc etc

    This of course creates one instance of the bullet every tick that the button is pressed, not what I want. So I simply added one condition to my event.

    + Button X is down

    + Trigger once

    • Create object etc etc

    Now it only fires the bullet once, until I let go of the button and press again.

  • I remember trying that 'trigger once while true' condition first, and found it unreliable in my case. I could not find any obvious reason why, though. Maybe the events were too complicated, and I couldn't spot an error, but I ended up using the method that I mentioned above. That was several versions of Construct ago, though.

    If the 'trigger once' works for you, then that that's pretty simple. Just add it to the condition. It does the same thing for you, without the overhead of the extra variables and events.

    I have found that 'trigger once' works as expected most of the time when I use it, which is seldom.

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