FiXED How do I fix mouse with rotating camera?

Get help using Construct 2

Post » Thu Oct 01, 2015 1:23 am

I get to a problem while the Player is running around the planet, the mouse pointer doesn't actually follow the mouse, it stays on the layout, where the "virtual" mouse is. (or I think)
I can't figure out how to fix it :/

In the .capx file I disabled the "following camera" so you'll get the feel how it should work...
I also simplified it so you don't get lost

capx here
http://1drv.ms/1Voddlv

Btw, I also wounder (but it's not really that important), if I set the planet to rotate at a certain speed, how do I fix the player to rotate with the planet?
Made also a much simpler version where the player stays at place and you rotate the planet, but it's not that fun (to make)...
Last edited by Icon3x on Thu Oct 01, 2015 12:05 pm, edited 1 time in total.
B
5
S
1
Posts: 10
Reputation: 572

Post » Thu Oct 01, 2015 4:55 am

I'm on my phone but would using mouse.x(layer) help? That should give a the mouse position on a layer. If you just use mouse.x it just uses the first layer which is the hud usually.
B
92
S
32
G
106
Posts: 5,272
Reputation: 69,455

Post » Thu Oct 01, 2015 10:13 am

I'll give it a try, thanks a lot for the reply!
B
5
S
1
Posts: 10
Reputation: 572

Post » Thu Oct 01, 2015 10:24 am

:arrow: Sorry, but can you be more specific of how to do that? If I just add an extension mouse.x(layer) or (layer name) it hits me with a "Unknown expresion" message
Edit: I added "layer", and it recognizes it, but still does the same, as with absolute.X
Last edited by Icon3x on Thu Oct 01, 2015 10:33 am, edited 1 time in total.
B
5
S
1
Posts: 10
Reputation: 572

Post » Thu Oct 01, 2015 10:27 am

From the manual:

Mouse expressions
AbsoluteX
AbsoluteY
Return the position of the mouse cursor over the canvas area in the HTML page. This is (0, 0) at the top left of the canvas and goes up to the window size. It is not affected by any scrolling or scaling in the game.

X
Y
Return the position of the mouse cursor in game co-ordinates. This is (0, 0) at the top left of the layout. It changes to reflect scrolling and scaling. However, if an individual layer has been scrolled, scaled or rotated, these expressions do not take that in to account - for that case, use the layer versions below.

X("layer")
Y("layer")
Return the position of the mouse cursor in game co-ordinates, with scrolling, scaling and rotation taken in to account for the given layer. The layer can be identified either by a string of its name or its zero-based index (e.g. Mouse.X(0)).

so:
mouse.x(0) - would be the x-position of the mouse on layer 0
mouse.x("HUD") - would be the x-position of the mouse on layer with the name HUD
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Oct 01, 2015 10:37 am

Wait, how do I then fix the "HUD" to not rotate with the layer 0?

Edit: I added the HUD layer, and set the parallax to 0, 0... but it seems to be even worse :/
Haven't worked on the HUD yet, so sorry for the dummines...

And thank you a lot!
B
5
S
1
Posts: 10
Reputation: 572

Post » Thu Oct 01, 2015 11:54 am

This is how it works:

Image
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Oct 01, 2015 12:05 pm

It really does!
Thank you a lot!!
B
5
S
1
Posts: 10
Reputation: 572


Return to How do I....?

Who is online

Users browsing this forum: Bootfit, grigrizljac, korbaach and 16 guests