phaser-tiled icon indicating copy to clipboard operation
phaser-tiled copied to clipboard

Feature/ninja convert tiledmap slopemap takes tilset indices

Open winstonwolff opened this issue 10 years ago • 3 comments

Hi Chad—

Thanks for accepting my previous PR. Here is another change that I need but I'm not sure if you want it. Your current version of physics.ninja.convertTiledmap() takes a slopeMap where the keys are indices into your tile map. I have changed it so the indices are for the tileset instead. In other words, the old implementation requires specifying all the slopes for each individual map you write in Tiled. My change assumes that if you use a certain tile from a tileset, that tile will always have the same Ninja slope. I think this is the common usage for tilesets—a tile in the tileset specifies what a tile looks like and it's properties such as collision Ninja slope. This is certainly an API change. If people are expecting the other way, this will break for them. However I suspect this change is what people expect from a slopeMap.

—Winston

winstonwolff avatar Jan 30 '15 18:01 winstonwolff

Well both should happen, we should check the specific tile first and fallback to the properties on the tileset that the tile represents.

Keep it as keys into the tilemap but then lookup the tileset tile for each one and fallback to those props. That way you can use the tileset to do general config, but override on a tile-by-tile basis.

englercj avatar Jan 30 '15 20:01 englercj

I'm not understanding when you say "check the specific tile first"? We're talking about a Phaser.Plugin.Tiled.Tile instance? Is it getting a nina-tile-id somewhere I have seen yet?

winstonwolff avatar Jan 30 '15 23:01 winstonwolff

keys are indices into your tile map

That is a tile. I'm saying instead of replacing the existing funcitonality, extend it to also check the tileset. Does that make sense?

englercj avatar Jan 31 '15 02:01 englercj