AnswerBun.com

Phaser Tiled map importing

How can I be sure that the tileset used in making a Tiled map remains as a multiple of 2, since this is a requirement of phaser when loading JSON tiled maps? I have tileset images which I got for free and they are not exactly up to phaser specs to be used.

Game Development Asked by kabuto178 on December 30, 2020

1 Answers

One Answer

You're probably referring to this:

    // May be fractional values
    var rowCount = (imageHeight - this.tileMargin * 2 + this.tileSpacing) / (this.tileHeight + this.tileSpacing);
    var colCount = (imageWidth - this.tileMargin * 2 + this.tileSpacing) / (this.tileWidth + this.tileSpacing);

    if (rowCount % 1 !== 0 || colCount % 1 !== 0)
    {
        console.warn("Phaser.Tileset - " + this.name + " image tile area is not an even multiple of tile size");
    }

So for example, if your tile size was 32x32 and your tileset image was 64x64, that's ok (32 divides into 64), but if the tileset image was 65x65, that's 1px left over and 65 doesn't divide evenly into 32.

Answered by congusbongus on December 30, 2020

Add your own answers!

Related Questions

Instantiate random different gameObjects in specific spaces?

1  Asked on November 2, 2021 by hapk

   

Gradual strafe rotation with focus on mouse (circle-strafe)

2  Asked on November 2, 2021 by lacklustertoady

       

Tile map click to walk UX

1  Asked on November 2, 2021

       

NiftyGUI – Text isn’t rendering

1  Asked on November 2, 2021 by ben-steffan

       

Move player in a circular manner

1  Asked on November 2, 2021 by renan-valentin-ferreira

   

Player hitting bottom of tile when beside it?

1  Asked on November 2, 2021 by mushrombrother-jpg

   

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved.