How do I Get Gamepad/Keyboard to Work?

0 favourites
  • 10 posts
From the Asset Store
Total customisation of the input! You can combine inputs from all peripherals. Make your game accessible for everyone!
  • Hi all, back again - I'm doing a course on Construct 2 and have hit a stumbling block, so could really use your help!

    I think this is right, I want the game to see if a gamepad is connected and to start when a button is pressed or, if the gamepad isn't present, to start with a keyboard key.

    So far, I can get to the menu screen but it doesn't recognise any input. Any idea what I am missing/what I have wrong?

    Thanks lots!

    Jo

  • I'm not a fan of using "Or" with triggered events. Try splitting your event #7 into two - one On keyboard key pressed and one On gamepad key pressed, without "Or".

  • Still does nothing for either of them. The gamepad and keyboard work in-game but not at the menu screen.

    I'm using a sprite for that which says 'Press Start' so the gamepad/keyboard should just need to have a button pressed and the Gamepad object should just pick up the controller when the button is pressed.

    I must be missing something, but the lecturer hasn't gotten back to me yet and couldn't find anything wrong the first time I showed him the code.

  • Is the "Press start" button flashing? (this will tell you if this event sheet is active or not)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yep, it's flashing.

  • This doesn't make sense..

    A few other possible causes I can think of:

    1. your "Control parameters" group is deactivated by some other event. Try moving events out from this group to test.

    2. Layout actually changes to "GameLayout" and then some event immediately changes it back to main menu.

    If none of this helps, could you share your capx?

  • I've stripped everything out and still no dice - I must be missing something. Here is the menu capx, it's just the Menu Layout, Menu sheet and GameLayout, there shouldn't be anything else to stop/prevent it from working.

    https://ufile.io/4o601 - here's the .capx

    thanks for the help - I've spent a couple of days on this so far and it's frustrating me horribly.

  • Kinda funny really - I managed to put together a basic working game before the course but I can't manage a bloody menu. XD

  • You have a wrong event sheet selected for MenuLayout - "Overlay sheet 1".

    Which, coincidentally also has "pressStart Flash" event, that's why your Press Start button was flashing.

    One other thing - I suggest you change "Gamepad Is button down" to "Gamepad On button pressed".

    "Is" condition is continuous, while it's true, the event is repeated about 60 times a second.

    "On" is a triggered event, executed only once. Which is what you need in this case.

  • Oh you absolute star. I'm used to doing the story and character aspect of games but learning to make a full game on my own was a really dumb idea. Thanks for making it feel a bit less daunting.

    Also, for finding what I missed, that too.

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