How do I transition an object from 100 parallax layer to 0

Get help using Construct 2

Post » Fri Mar 07, 2014 3:41 pm

Hi!
I'm attempting to recreate a game element similar to that in ClaDun x2, in which, when you pick up a coin, it spawns a sparkly thing on the playfield that floats slowly towards the coin bag in the UI.
My problem is that my characters and everything are on a layer called Play, that has a parallax rate of 100, 100. And my UI is on a layer with a parallax rate of 0, 0.
I'm not sure how to handle this sequence, because if I spawn the sparkle on Play, it'll spawn in the right place, but it won't be able to travel towards the UI correctly. But if I spawn it on UI, it won't spawn in the right place because of the parallax.

Edit: I just tried placing an object with the Anchor behavior on the Play layer, directly over the UI. It /almost/ works but the Anchored object shifts a little. Okay a lot...

You can see the effect I'm going for here: http://youtu.be/-tmYdvzBb-c?t=32s
(watch carefully when the character picks up a coin, it's sort of subtle...)
B
19
S
5
G
1
Posts: 96
Reputation: 2,710

Post » Fri Mar 07, 2014 4:08 pm

There are system expressions "CanvasToLayerX", "CanvasToLayerY" and "LayerToCanvasX", "LayerToCanvasY" they will help you.
ImageImageImageImage
B
157
S
66
G
42
Posts: 2,603
Reputation: 35,343

Post » Fri Mar 07, 2014 4:50 pm

I'll look into that, thank you!
B
19
S
5
G
1
Posts: 96
Reputation: 2,710

Post » Fri Mar 07, 2014 10:47 pm

Update:

I have tried this, and it did not work.
Image

Currently I spawn the object on the layer Play and then attempt to move it to the UI layer. I suspect it will also not work if I just try to spawn it on the UI layer...
I have tried all sorts of combinations of the CanvasToLayer and LayerToCanvas expressions, not just the one in the screenshot. I wish there was a better tutorial for how to use them, I can't find one that doesn't just repeat what is in the manual (which was really unhelpful might I add...).
I'll admit that I have ZERO idea what I am doing with those expressions. I've never used them before and I don't understand how they work at all.
B
19
S
5
G
1
Posts: 96
Reputation: 2,710

Post » Sat Mar 08, 2014 3:41 pm

I know bumping isn't really a polite thing here, but it's been like a day and it's not on the first page anymore and I still need help... ^^;;
B
19
S
5
G
1
Posts: 96
Reputation: 2,710

Post » Sat Mar 08, 2014 6:46 pm

You need to use the LayerToCanvas expressions to convert the "Play" layer coordinates to canvas coordinates and then use CanvasToLayer to convert those to "UI" coords.
You do not have the required permissions to view the files attached to this post.
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,650

Post » Sun Mar 09, 2014 8:50 pm

hey, that worked perfectly!
Thanks for explaining how those expressions worked! =D
B
19
S
5
G
1
Posts: 96
Reputation: 2,710


Return to How do I....?

Who is online

Users browsing this forum: dop2000, KTML5, totoe and 38 guests