Setting a scaled tilemap to another object.

  • 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?

  • 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.

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

    Like this : [attachment=0:1gkfpvxj][/attachment:1gkfpvxj]

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks, confusing statements but I just copied your line and replaced the layers/sprites with my own and it works perfectly

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)