englercj / phaser-tiled

A tilemap implementation for phaser focusing on large complex maps built with the Tiled Editor.
MIT License
290 stars 31 forks source link

creating an empty tiledmap fails #15

Closed woutercommandeur closed 9 years ago

woutercommandeur commented 9 years ago

I would like to not use tiled to build my tilemap but use my own procedural generator hence I do:

game.add.tiledmap();

this fails because the check for data === null fails after the parser. it returns undefined instead of null. The getEmptyData function in the parser that is called causes this. It builds a map object but that object it not returned from the function.

Hope this is clear enough.

englercj commented 9 years ago

Good catch, I haven't tested the empty/build-your-own methods very well. Would you happen to have a small example of what you would normally do to build a map that I can add to phaser-tiled-tests and ensure that your case works well?

If not, I will fix this bug but you might encounter something else different later.

woutercommandeur commented 9 years ago

Well I just started out making them procedurally, I will try to make an example using the regular phaser tilemap api.

woutercommandeur commented 9 years ago

This would be the example using regular phaser tilemap

        var map = game.add.tilemap();
        map.addTilesetImage('tileimage');
        var layer1 = map.create('level1', 40, 30, 32, 32);
        var y = 19;
        for (var x=10;x<30;x++) {
            map.putTile(0,x, y, layer1);
        }
englercj commented 9 years ago

Cool I'll put something together soon. I'm busy this weekend, but hopefully I can have something in next week.

Thanks!

woutercommandeur commented 9 years ago

Ofcourse this is the most minimal example, I will be using more features of tiled procedurally :)

englercj commented 9 years ago

Been pretty busy lately with other projects, and have been taking some time off for the holidays. Hopefully I can revisit this project here soon as I spend more time on something that is using it.

Just wanted to give an update and say hang in there!

woutercommandeur commented 9 years ago

It's ok, I have little time to work on my project atm anyway.