Kongregate Keyboard input issues and fixes

0 favourites
  • 2 posts
From the Asset Store
Total customisation of the input! You can combine inputs from all peripherals. Make your game accessible for everyone!
  • <font face="Arial, Helvetica, sans-serif">I just released my first C2 game on Kongregate and I found some issues about keyboard focus. Some I solved and others I had to make a workaround. As I didn't find any topic talking specificaly about this issues I think this could be good.

    <font color=blue>Issue #1 - Scrolls</font>:

    Vertical and Horizontal scrolls appeared on the game iFrame. I didn�t really understand that because my width and height were not greater than the limites of Kong.

    Every time I pressed the Right or Left key the horizontal scrolls slided. I fixed that adding this css code to the "index.html":

    <font color=magenta>body { ...</font> <font color=blue>overflow:hidden; margin-left:0; margin-top:0;</font> <font color=magenta>}</font>

    "Overflow" to hidden the scrolls and "margin-left" and "-top" to eliminate the bordes around the game.

    <font color=blue>Issue #2 - Up arrow</font>:

    Every time I pressed the "Up arrow" my hero jumped but also the hole page was rolling up. The odd thing here is that the game didn't lose any focus and the "Up arrow" was being used to jump in my game an at the same time to roll the page up (outside the game).

    I didn't figured out how to solve this, so I changed the "Up arrow" input to the "Z" key.

    <font color=blue>Issue #3 - Space bar</font>:

    In some points of the game you had to use the "Space bar" to interact. Every time I had to press the "Space bar" the game was losing its focus.

    Turns out that I was using the "Key is down" condition, wich oddly makes the game loses its focus. When I changed to "Key is pressed" it worked just fine.

    I hope this can help somebody and if anyone has any solutions and suggestions I'll be glad to hear.

    This the game by the way (wich is actually a gift I made to my girlfriend last christmas):

    kongregate.com/games/gdacas/the-world-is-ending

    See ya!</font>

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the post. I had a bit of trouble with losing focus too with the directional arrow keys. I ended up just using W, A, S, D as an alternative.

    Also thanks for the CSS code to get rid of the scrollbars.

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