Mouse Outside Layout - Scirra Arcade vs C2 Preview

0 favourites
  • 9 posts
From the Asset Store
Total customisation of the input! You can combine inputs from all peripherals. Make your game accessible for everyone!
  • I am perplexed at the mouse behavior in Scirra Arcade versus in the Construct 2 Run Layout previewer. In my game Help the Ball, I've had the mouse controls working just fine for a long time, and drawing the line was perfect no matter if you moved the mouse outside the layout or not. It would "solidify" the line, so to speak, no matter where you let go of the left mouse button - either inside or outside the layout.

    However, like blackhornet mentioned in this forum post, on Scirra Arcade the mouse plays differently and if the user takes the mouse out of game, the game has no clue what is going on.

    I've tried different fixes, like testing Mouse X/Y location and having an invisible sprite pinned to mouse and testing if sprite is outside layout, but none of that works.

    Do you have any other ideas? Is there any good way to handle when the mouse leaves the game screen on Scirra Arcade?

    Thanks in advance,

    Manley

  • Sound like the issue is specific to Chrome, it does not happen in FF.

    Possibly a chrome bug related to iFrame.

    Ashley, thoughts ?

  • Sound like the issue is specific to Chrome, it does not happen in FF.

    Possibly a chrome bug related to iFrame.

    Ashley, thoughts ?

    Well, that is strange. Yes, you are right. It works correctly in Firefox, but IE and Chrome do not. Plus, in IE, my custom mouse cursor (white magic glove) is not shown.

    Hmm...I'm starting to understand everyone's frustration with all these different browsers and standards.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sorry to bump the thread, but I was hoping Ashley might advise if there is anything to be done, or if the "mouse clicks don't register when out of the game layout" problem is just how different browsers behave.

  • Try the Behaviour, Bound-to-Layout.

    BoundToLayout

    (I PM'd this but you must have missed it).

  • Try the Behaviour, Bound-to-Layout.

    BoundToLayout

    (I PM'd this but you must have missed it).

    blackhornet: thanks for the idea, but it doesn't fit in with this problem, unless I'm completely misunderstanding everything. BoundToLayout doesn't apply to the mouse. The problem as I see it is, at least with using Chrome browser on Scirra Arcade, when the mouse goes out of the game layout/window screen, the game loses track of what the mouse is doing. So, if I release the mouse button to finish drawing the line, the game doesn't register that and continues to draw the line once the mouse is back on game screen. For some reason, in Firefox and in the Construct 2 previewer, this isn't a problem and the game knows what the mouse is doing outside of the game focus. I'm confused why there is a difference between the C2 previewer and Scirra Arcade.

  • Ah, I see. This does seem like an Ashley or Tom question.

  • Actually I have the same Issue with the "Chrome & iframe".

    Seems to be a thing from Chrome itself and the focus on the iframe.

    After reading some topics on stackoverflow.com...,

    e.g.:

    stackoverflow.com/questions/3596803/problem-with-google-chrome-and-javascript-guru-needed

    or

    stackoverflow.com/questions/8111003/set-focus-on-iframe-in-chrome

    ...I finally don't even know how to fix it atm.

    I just understand there is a known Problem.

    Maybe someone with more experience have an idea and an easy, "for fluffy-bunnys", explanation?

  • Found a workaround - If "chrome" won't change it soon... anyway:

    • just put an blank sprite as overlay e.g. 5px smaller than desired viewport-display size.
    • built in a 'mouse controller' sprite > set invisble
    • at start of layout: set 'mouse controller' timescale to '0'
    • conditions: when mousebutton is clicked & is over 'blank_overlay':

    set 'mouse controller' time scale to '1'

    • conditions: if mouse button is down & is over blank_overlay:

    set 'mcontroller' to mouse.x and mouse.y

    • condition if mouse is NOT over blank_overlay:

    set controller time scale to '0'

    Simply destroying the 'controller' seems not to be enough to solve this problem. Tested it. But i just can guess why. Related to the iframe-focus thing. AND happens only in Chrome...

    With this workaround you just stop everything that hast to be stopped when mouse leaves the iframe and the button is still down.

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