Setting a scaled tilemap to another object.

Get help using Construct 2

Post » Thu Dec 11, 2014 9:18 pm

I have a tilemap that I wish to scale differently to the rest of my game, so I've set it on it's own layer and scaled the entire layer. I then wish to set the top/left of the tilemap to the top/left of another object (a sprite), or the centre of both objects would work. It looks like the tilemap is automatically set at it's top/left, while sprites are set to the centre (or wherever you place the origin?). Due to the different scales on the layers, I'm not sure how to go about it. Is there a simple way, or am I going to need to work it out with a bit of math?
B
25
S
5
G
3
Posts: 446
Reputation: 5,633

Post » Thu Dec 11, 2014 10:46 pm

I guess a simple way of wording this would be, how can I put a sprite on top of another sprite, if they're both on separate layers and the layers have different scales/parallax etc?

I've spotted the 'CanvasToLayerX' and 'LayerToCanvasX' stuff but can't work out how it works.
B
25
S
5
G
3
Posts: 446
Reputation: 5,633

Post » Thu Dec 11, 2014 11:43 pm

First use LayerToCanvasX/Y to get the screen coordinates, then use CanvasToLayerX/Y to get the corresponding layer coordinates for another layer.

Like this :
layerConvert.png
You do not have the required permissions to view the files attached to this post.
B
69
S
28
G
24
Posts: 977
Reputation: 18,739

Post » Fri Dec 12, 2014 12:24 am

Thanks, confusing statements but I just copied your line and replaced the layers/sprites with my own and it works perfectly :)
B
25
S
5
G
3
Posts: 446
Reputation: 5,633


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 12 guests