Jump to content

Phaser help: can't generate tilemap


PhasedEvolution
 Share

Recommended Posts

Hello. I am using phaser along with its isometric plugin but (probably because of my lack of knowledge) I am having some difficulties which is starting to get me frustrated. I know the basic javascript but I am new to game development. I think I am finding working with phaser harder than it should be. I seem to never know the commands for specific things. Like my current problem, generating a isometric tiled map.

I created a isometric map in "Tiled" with the help of some tutorials and a tileset.


Amazingly, I got stuck  in trying to make it appear on screen. I would really, really appreciate help with this and if you have any advice on how to work around with Phaser and with Phaser isometric plugin I would be really thankfull. Here is the code:

var start= {

    preload: function() { 

       game.plugins.add(new Phaser.Plugin.Isometric(game));

	   game.load.tilemap("mapa", "tilemap.json", null, Phaser.Tilemap.TILED_JSON);
       game.load.image("tiles", "tiles.png");   

    },

    create: function() { 

        map = game.add.tilemap("mapa", 32, 32, 50, 20);
        map.addTilesetImage("tiles", "Tiles");

        map.createLayer("Background").resizeWorld();

    },

    update: function() {

    },

};

var game = new Phaser.Game(700, 490);
game.state.add('start', mainState); 
game.state.start('start');

I am also a little confused about generating the tiles in the game. I heard that you can place the tiles "manually" like in a for loop where you loop through all the map positions or you can also import the tilemap file (like what I am trying to do). Is this true? 

Well thank you once again. Hope I wasn't too vague with this question.

Link to comment
Share on other sites

43 minutes ago, Milton said:

Last time I looked, the isometric plugin didn't support Tiled... (@lewster32 ?)

Correct. I don't know if anyone currently uses Tiled to generate their isometric layouts with my plug-in, however if they do, there's a fair amount of extra work involved in this as the plug-in does not support an isometric equivalent of Phaser's TileMap functionality either.

For what it's worth, the example scenes on the plug-in website were created by hand rather than designed in an external tool.

Link to comment
Share on other sites

43 minutes ago, PhasedEvolution said:

Oh... so assuming it doesn't support Tiled, is there a way to do it? How people do generate the tilemap then? I am really blank on those aspects...

I really doubt anyone has managed to use a Phaser Tilemap with the Isometric plugin. They don't match. I would advice using Tilemap for performance. That does mean not using the plugin though... Just write your own Isometric routines. You don't need many, just the projection and the depth-sort. And importing from Tiled is easy too. Parse the xml and do your thing.

Link to comment
Share on other sites

Hey @lewster32, I'm surprised you liked my post.
You did a great job on your plugin. But it needs Tilemap and Tiled support.
Phaser supporting an Isometric Tilemap would be major, but that's just too much work I guess...
Interesting that Unity does support it, but has lousy HTML5. For now, just giving up on Phaser integration is the best choice.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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