dcburnett's Forum Posts

  • 3 posts
  • Thanks to those of you who looked into this issue. I've resolved it, and I wanted to post the solution for anyone else having this problem (@Alemar: you should give this a try).

    After a lot of trial and error and looking at the JS code itself, the solution is actually very simple. The problem is that whenever the game is served through an iframe (as Facebook apps are), for some reason the iframe does not have focus. This prevents the keyboard inputs from doing anything for the game within the iframe (keystrokes only impact the window that holds the iframe).

    The easy solution is to create a new System event to run "on start of layout" with a Browser action of Focus. Do this on any layout that requires keyboard controls. That's it. If you do that, the keyboard controls now work in the iframe for Facebook apps.

    Since I'm not sure of the intended C2 behavior when served through an iframe, I don't know if this is a bug or simply a required step that may not be documented. Either way, I think it would be useful to note this required event in the How to Make a Facebook App tutorial.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks, Ashley. Unfortunately, that didn't change anything. I added 4 empty keyboard events: for the left arrow, the right arrow, the up arrow, and the spacebar. I already have actions assigned to keyboard "on pressed events" for each of these keys, so these new empty events are incremental.

    Nonetheless, there's still no player/platform movement when using the keys via Facebook. Interestingly, the up arrow still causes the page to scroll on Facebook, so it seems the game in the browser is not getting the keystrokes when the game is loaded through Facebook.

    Any other ideas?

  • Hi,

    I've just built my first game with Construct 2, and this is my first post to the forums. I am having an issue with keyboard controls not working in my game when it is accessed as a Facebook app. This might be a bug, but since I'm still a new user, I figured I would post here first since it might just be human error.

    I have exported my game and put it on my web server (https://www.crowdedcomics.com/mudslinger/). It works perfectly there -- for keyboard, mouse, and touch inputs. I followed the tutorial to also create a Facebook app, and the app points to the exact same page on my server (but through an iframe I believe). When you use it through Facebook (https://apps.facebook.com/515574108472496/), the keyboard controls don't do anything. I tried disabling touch controls, but that didn't have any impact. I also went through my game disabling features and plugins one by one, but I haven't had any luck yet.

    I searched the forums and found an old issue that sounds similar: scirra.com/forum/r792-and-r793-bugs_topic49185_page2.html

    But this issue was apparently resolved back in February. I'm using Construct 2 version 108.2 64-bit, so I assume that fix must be part of the version I'm using.

    Has this old issue popped up again? Or is there some workaround that I'm supposed to do to make keyboard controls work in a Facebook app? I appreciate any help!

  • 3 posts