Mouse Outside Layout - Scirra Arcade vs C2 Preview

Get help using Construct 2

Post » Tue Feb 05, 2013 12:09 pm

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,
ManleyManley232013-02-05 12:26:20
B
32
S
7
G
8
Posts: 312
Reputation: 8,467

Post » Tue Feb 05, 2013 2:13 pm

Sound like the issue is specific to Chrome, it does not happen in FF.
Possibly a chrome bug related to iFrame.

@Ashley, thoughts ?
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Tue Feb 05, 2013 2:59 pm

[QUOTE=Kyatric] Sound like the issue is specific to Chrome, it does not happen in FF.
Possibly a chrome bug related to iFrame.

@Ashley, thoughts ?[/QUOTE]

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.Manley232013-02-05 15:09:23
B
32
S
7
G
8
Posts: 312
Reputation: 8,467

Post » Thu Feb 07, 2013 12:03 pm

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.Manley232013-02-07 12:05:20
B
32
S
7
G
8
Posts: 312
Reputation: 8,467

Post » Thu Feb 07, 2013 4:35 pm

Try the Behaviour, Bound-to-Layout.

BoundToLayout

(I PM'd this but you must have missed it).
ImageImageImage
B
67
S
19
G
122
Posts: 3,206
Reputation: 73,399

Post » Fri Feb 08, 2013 2:35 am

[QUOTE=blackhornet] Try the Behaviour, Bound-to-Layout.

BoundToLayout

(I PM'd this but you must have missed it).[/QUOTE]

@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.
B
32
S
7
G
8
Posts: 312
Reputation: 8,467

Post » Fri Feb 08, 2013 3:54 am

Ah, I see. This does seem like an Ashley or Tom question.
ImageImageImage
B
67
S
19
G
122
Posts: 3,206
Reputation: 73,399

Post » Thu Mar 07, 2013 5:50 pm

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.:

http://stackoverflow.com/questions/3596803/problem-with-google-chrome-and-javascript-guru-needed
or
http://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?
B
7
S
1
Posts: 5
Reputation: 1,027

Post » Sun Mar 17, 2013 8:08 pm

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.
B
7
S
1
Posts: 5
Reputation: 1,027


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, jul, nicklowkcmagic and 19 guests