How do I map keyboard with external buttons?

0 favourites
  • 3 posts
From the Asset Store
A template which allows you to customise the controls of your game.
  • Ok I'm kind of lost here.

    I made a simple shmup game on auto-scroll from left to right. For testing I use keyboard keys for movement and shooting. So the arrows for movement and space bar for shooting. Everything works fine. So I ported my game to a raspberry pi and after some configuration it work fine.

    Now I'm trying to map external arcade buttons for movement and shooting.I use a python script to map the pins on the raspberry pi to keys on the keyboard. When I launch the game only the button mapped to the space bar work but not the ones mapped to the arrow keys. I was using the default control so I unchecked that and simulate individually all the control. When I use the simulate function it detect that the button I press is map to an arrow key for example. But when I launch the game again only the space bar work. I tried to use different keys like WASD, remap in my python script and in the game, still it doesn't work. I even tried to use the space bar to move up and it doesn't work.

    I think the problem is with the 8-direction function, but I don't understand why it work when I use the keyboard but not when I use buttons mapped to the keyboard, except for the space-bar.

    Please help!!!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Add a temporary text object and this event:

    + Keyboard: On any key pressed
    -> Text: Set text to Keyboard.LastKeyCode & " " & Keyboard.TypedKey
    

    This will tell you if the key codes are correct.

    Maybe the problem is that your script only sends "on pressed" and "on released" events, and not "key is down" (which is required for continuous movement). Again, you can use debug events to check this.

  • Thanks I’ll check that.

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