Parallaxed coordinates vs unparallaxed

Get help using Construct 2

Post » Wed Nov 27, 2013 10:32 am

Hi
Is there any possibility to get the objects coordinates - object is on heavy parallaxed layer and compare it with coordinates of unparallaxed object?
How does parallax parameters exactly influence coordinates in regard of unparallaxed values?
For example I would like to know the distance between (scrollx, scrolly [let's assume it's center of the window])which is unparallaxed and (objectx, objecty)on parallaxed layer.
Object is a lightstreak and I want to create lens flare effect, which depends on its position regarding window's center...
B
39
S
13
G
6
Posts: 148
Reputation: 5,384

Post » Wed Nov 27, 2013 10:38 am

Just add the layername or layernumber after the object.x

So object.x(0) will get the object's coordinates on layer 0
and object.x(1) will get the object's coordinates on layer 1

If one of the layers is paralaxed or zoomed these results will therefor be different.

Edit: I know this works for mouse and touch coordinates, so I assume it works for objects as well.. LittleStain2013-11-27 10:39:41
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 » Wed Nov 27, 2013 1:13 pm

@LittleStain - that only works for mouse and touch positions, not ordinary objects.

Object positions are not affected by parallax at all, just where they are drawn. So the object position will be identical on all layers, even when different parallax settings are used.
Scirra Founder
B
395
S
232
G
88
Posts: 24,368
Reputation: 193,746

Post » Wed Nov 27, 2013 1:17 pm

Thanks @Ashley for correcting me.

I wasn't sure about that, so I added the edit-comment.
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 » Wed Nov 27, 2013 1:53 pm

Thanks @Ashley, thanks @LittleStain
B
39
S
13
G
6
Posts: 148
Reputation: 5,384

Post » Sat Mar 08, 2014 2:17 am

So how would one do this then?

I'd like to get the Parallaxed coordinates... so in essence, where it's actually drawn on the screen..

I'm making a minimap and I have some background objects that use parallax 25,25.. I'd like them represented on the minimap.. but they don't line up because of the parallax delay.

any suggestions @LittleStain ?
B
97
S
32
G
15
Posts: 1,192
Reputation: 16,166


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 9 guests