Jump to content

Phaser Isometric plugin


lewster32
 Share

Recommended Posts

I've implemented the rotates plugin with my own custom tiles, but for some reason they are spaced really far apart. Any ideas why? Each tile is 128 px x 128 px, with the top being 128 x 64. I used a double for loop like the example on the rotates homepage.

test.jpg

Link to comment
Share on other sites

6 hours ago, lewster32 said:

It'll almost certainly just be the spacing of the tiles - I'd need to see your code to be sure but that's what I'm guessing is the case here.

Here's the double for loop. It's largely copied from your example. The only place that I seem to be able to make any spacing changes is in the add method. If I do (x / 1.8, y / 1.8) that gets me pretty close, but the tiles don't line up 100% evenly.

var tileArray = [];
tileArray[0] = 'water';
tileArray[1] = 'grass';
tileArray[2] = 'sand';
        
var tiles = [
    0,0,0,0,0,0,0,0,
    0,2,2,2,2,2,2,0,
    0,2,1,1,1,1,2,0,
    0,2,1,1,1,1,2,0,
    0,2,1,1,1,1,2,0,
    0,2,1,1,1,1,2,0,
    0,2,2,2,2,2,2,0,
    0,0,0,0,0,0,0,0
];

var size = 128, mapSize = Math.sqrt(tiles.length) * size;
        
        var i = 0, tile;
        for (var y = size; y <= mapSize; y += size) {
            for (var x = size; x <= mapSize; x += size) {
                tile = this.add.isoSprite(x, y, tileArray[tiles].match("water") ? 0 : this.game.rnd.pick([2, 3, 4]), 'city-tile', tileArray[tiles], tileGroup);
                tile.anchor.set(0.5, 0);
                if (tiles === 0) {
                    water.push(tile);
                }
                i++;
            }
        }

test2.jpg

Link to comment
Share on other sites

  • 6 months later...

Hi there, I think I might transition my game to isometric and it should be a lot of fun, however; in my game I render 100's of sprites. No physics. They are stationary but one way I coped with regular phaser was making the ground a tile sprite, and water and sand and such that requires no interaction just image sprites over that ground tile sprite. Is there anyway to do this in the Isometric plugin? Essentially anyway to draw a isoTile with no physics, just being the floor/water that requires minimal power like game.add.image does?

Edit: Sorry for bumping such an old topic, I didnt realize how old it was. 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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