Jump to content

createFromObjects layer scaling?


Recommended Posts

So I have a tilemap created from a Tiled .json file. The tile layers are scaled up 3 times. Works great. However, now that I'm trying to add an object layer, the objects seem to be in the wrong position, I presume, in the 3 times scaled down position. Game is a sidescroller.

Take this example - https://testarea.krizucentrs.lv/. The tiny orange guy up in the leaves? He's supposed to be down by the rock on the right side. Also, he's supposed to be much bigger. I can't create an object layer and just scale it, Phaser doesn't recognize it in the map.createLayer function.

How would I go about scaling the object layer correctly?

P.S. if I'm doing this wrong by scaling every tile layer and sprite then let me know, I don't know how to make the game appear bigger.

Link to comment
Share on other sites

EDIT: The fix below technically works, but it still makes positioning a pain. There's some conflicts, for example, the group position still shows the old one, so you have to multiply it by 3.

Kinda figured it out.

Set the group scale to get the correct position:

group.scale.setTo(3, 3);

Set the scale for individual sprites to get the correct size:

group.forEach( function(item) {
    item.scale.setTo(0.8, 0.8);


Edited by Ansis100
Nevermind, it's not fixed
Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...