Mouse Projection on Scaled Layer with scrolling

Get help using Construct 2

Post » Sun Oct 23, 2011 8:01 pm

Hi guys
I managed to get all the description of the problem in the subject of the Topic.

Basically I have a game in which the player can zoom in and out.
As there's no such feature, I use layerscale.

But let say I want to spawn something in this layer by mouse clicking.
The coordinate of the mouse gets projected onto the layer which is scaled so the object doesn't appear under the mouse.

I tried something basic like MouseX/layerscale("Main")
I tried by scaling an offset from the center... It worked well with zooming, but when I scroll, it gets off.

Well, I spent my afternoon on it and didn't find any good solution. So I'm asking you guys \o/

Here is a little capix to try things :
scaleProj.capx

The red sprite is in the "Main" Layer and is supposed to follow the mouse even if scaled and or scrolled.

thanks (:
Last edited by Yann on Sun Sep 14, 2014 11:31 pm, edited 1 time in total.
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Mon Oct 24, 2011 5:22 pm

I had this problem in CC as well when using layer zoom.

I'm unsure how to fix it, sorry :(

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
45
S
17
G
37
Posts: 2,853
Reputation: 25,966

Post » Mon Oct 24, 2011 5:32 pm

Mouse.X("MyLayer") returns the mouse's X co-ordinate on the layer named "MyLayer". You can also use the layer number. Same with Y.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Mon Oct 24, 2011 5:35 pm

;_; so great Thank you
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Mon Oct 24, 2011 5:43 pm

I have to join in, also needed this. Thanks, Ash!
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Post » Mon Oct 24, 2011 5:58 pm

Undocumented calls, FTW!

Thanks Ashley... that helps probably more than just us. I was confused by that happening but never thought to ask anyone else since I assumed I had done something wrong anyway. xD

:D

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
45
S
17
G
37
Posts: 2,853
Reputation: 25,966

Post » Mon Oct 24, 2011 8:24 pm

me too for construct classic. thanks ash!
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461


Return to How do I....?

Who is online

Users browsing this forum: Artpunk, Yahoo [Bot] and 18 guests