Change parallax rate at runtime

Get help using Construct 2

Post » Tue Feb 28, 2012 1:34 pm

Hi

Is there a way to change the parallax rate of a specific layer during runtime via an event?
I need my hud to be stationairy (which is no problem).
But, on mouseclick i need to zoom in on the hud, and be able to scroll the hud to mouse X and Y.
For this (in my current understanding) the parallax X&Y of the hud layer needs a setting above 0.
So i im searching for a way to change that parallax rate at runtime.

Like this:

A: On mouse button down set Layer "hud" parallax X rate to 20 & Set parallax Y rate to 20

B: On mouse released set Layer "hud" parallax X Rate to 0 & Set parallax Y Rate to 0

I have searched the forum but havent been succesfull.
The zooming part is allready done.
Thanx in advance for any effort trying to help.

Savvy001
B
56
S
20
G
13
Posts: 778
Reputation: 13,204

Post » Tue Feb 28, 2012 2:00 pm

Zooming is more about layer/layoutscale than parallax.
And layerscale/layoutscale can be changed at runtime in the system expressions/actions.
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: 7,000
Reputation: 57,795

Post » Tue Feb 28, 2012 2:08 pm

put all the hud object in a family
[code]global number mXStart = 0
global number mYStart = 0
System: On start of layout
-> hudFamily set xStart to self.X
-> hudFamily set yStart to self.Y
Mouse: on Left Click
-> System: set mXStart to mouse.X
-> System: set mYStart to mouse.Y
Mouse: left button is down
-> hudFamily set X to self.xStart+mouse.X-mXStart
-> hudFamily set Y to self.yStart+mouse.Y-mYStart[/code]Yann2012-02-28 14:11:16
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Tue Feb 28, 2012 2:32 pm

@ Yann
Thanx i think i understand.
And it looks like the exact solution.
Ill try it and report back.

@ Kyatric
Thanx.
B
56
S
20
G
13
Posts: 778
Reputation: 13,204

Post » Tue Feb 28, 2012 3:58 pm

@ Yann

It worked!
Thanx!

Here is a CapX for anyone who would like to embed this feature.
http://www.mediafire.com/?e9i51orj9cs75c6

Middle mouse click on the icon menu to zoom in and position to mouse
B
56
S
20
G
13
Posts: 778
Reputation: 13,204


Return to How do I....?

Who is online

Users browsing this forum: blackhornet, randomly and 21 guests