Clicking outside: Losing focus on the game

0 favourites
From the Asset Store
A game template with a great amount of assets! You will be able to create a full game just with the assets provided!
  • So gurrently my game is on newgrounds:

    newgrounds.com/portal/view/612273

    Which is nice and all, but there is one little problem.

    As soon as I click outside to the canvas area, the game becomes completely unplayable.

    I noticed that other html5 games don't have this problem so I guess I missed something. Can someone tell me how to fix this?

    Sidenote:

    This does not only happen in Newgrounds, but also on the arcade as well:

    scirra.com/arcade/addicting-action-games/3596/clown-on-a-plane

    You can try it youself by starting the game, clicking OUTSIDE of the canvas and then tring to bring focus back to that game.

    If I for example take My Irrational Fear of Unicorns:

    scirra.com/arcade/addicting-action-games/1694/my-irrational-fear-of-unicorns

    this doesn't happen. So I take I really missed something.

  • I can't help with your problem, but that was the damn most entertaining game I've played in a while. I burst out laughing when he made his little "horhoor" noise and started dancing. Awesome game <img src="smileys/smiley4.gif" border="0" align="middle" />

  • I thought you were about to criticize Newgrounds for losing its focus on gaming.

    Hahaha! Misleading title :)

    Thanks for using My irrational fear of Unicorns as an example!

  • Suro

    Make an on any click event, use the browser focus action. It fixed my focus problem with Kongregate...probably will fix yours on Newgrounds as well.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks guys!

    Rory:

    It was one of the last games I played that I remember had no mouse input during gameplay :D

    Besides it's fun to play!

    theubie

    I didn't even know such a thing existed!

    Sadly it didn't work for me (currently the updated version is on the Scirra Arcade).

  • Hmm. FWIW, here's a screenshot of my fix, which worked on both Kong and here on Scirra's Arcade:

    <img src="http://www.infinitepossibilitygames.com/demos/focus/focusfix.png" border="0" />

    If that doesn't fix it, not sure what else might be causing it. I would be willing to look at a capx if you want.

  • I'd actually appreciate it :)

    I'll send you a link!

    Edit:

    It seems like my game is the only one that has this problem on the arcade :D

    I feel special about it, but I also would like to fix it.

    So far I think I haven't forgot anything important, rather that I added something which overwrites the focus going back to the game once you click outside of it.

  • So far I haven't been able to fix this.

    I'd appreciate anybody who would be willing to help me in this matter.

  • I am also having this problem.

    Here's my game: scirra.com/arcade/shooter/3837/telefrag1

    Let me know if you need anymore information. I'll keep searching for a solution.

    EDIT: I did try theubie's solution, but no success.

  • I found using event from theubie works except... i couldn't get certain keys to return control in Chrome browser. Keys like Spacebar and Ctrl would always lose input but letter keys would return.

  • We've isolated the issue for Suro to only one of his layouts. I'm trying to figure out exactly what in the layout is causing it. That might give everyone more of a clue as to what's causing it.

  • My solution (for Kongregate) was to delete the Mouse plugin from my project, and use the Drag & Drop behavior and the objects that needed to be clicked. "On Drag" I would immediately force the object to be dropped.

  • This is an awesome game!!! Love it. However, it is almost unplayeable as it is. When I press space bar the browser "scrolls down" - no idea why. And I have managed to lose focus and clicking back into the game didn't refocus.

    I love it when you get hit by the drinks trolley.

  • The spacebar issue is easily fixed. Suro just needs to place an empty On Spacebar pressed event. He's using on spacebar down for the actual control. By adding an event (even an empty) one to handle the spacebar pressed event it'll trap it from being seen by the browser.

  • Hey guys!

    Thanks for playing and writing up the bugs.

    czar:

    The space bar bug should be fixed now (thanks to theubie's help).

    I never experienced that bug before, so I'd need you to play it once more to see if it is still happening.

    (Newest Version should be 1.00e or higher, in the lower left corner).

    As for the focusing problem, theubie and I am still one it :)

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