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

game.physics.p2.convertTiledmap() not working properly #20

Closed locohost closed 9 years ago

locohost commented 9 years ago

Thank you for coding this plugin. I'm pretty psyched to see it working. I have a working Phaser Tiled map that I'm trying to convert to using this plugin in hopes for some smoother scrolling.

First small issue, you have a typo in your "Usage" section. In the line: map = game.add.tiledmap('my-tilemap'), you need to change the key text to "my-tiledmap". I cut/pasted your code and it took a bit of debugging to figure this out.

Second larger issue: game.physics.p2.convertTiledmap() doesn't work fully. All of my tiles in Tiled have custom property: collides = true. I also tried collides = 1, neither works. My ball moves through nearly every tile as if it's not there. It will occasionally collide with what seems like a random tile and sometimes it collides with an invisible tile in blank space.

So far it does seem to scroll more smoothly. Which is awesome. However, I'll need the tile collisions to work before I can actually use it.

Thanks again for the plugin work so far! :-)

englercj commented 9 years ago

Interesting I was able to successfully use the converTiledmap() before. Is there anywhere you have the code running I can look at? Or even better look at it on my machine? You can email it to me if you want to keep it private.

Also, updated that typo. Good Catch!

locohost commented 9 years ago

Do you remember if you used simple tile-side collisions or did you used the tile collision editor in Tiled? Should this plugin work with both methods or only one?

englercj commented 9 years ago

This will not work with the tile collision editor in tiled, the custom property defines if a tile is collidable or not and that is it. The whole tile becomes a solid block when it is set to true.

If you want complex shapes, just use the shape tools and draw the collisions in an object layer and use game.physics.p2.convertTiledCollisionObjects(map, layer);

locohost commented 9 years ago

Ok good. I'm not using the Tiled collision editor. I've found that to be sketchy at best :-/

On Wed, Dec 24, 2014, 2:09 PM Chad Engler notifications@github.com wrote:

This will not work with the tile collision editor in tiled, the custom property defines if a tile is collidable or not and that is it. The whole tile becomes a solid block when it is set to true.

If you want complex shapes, just use the shape tools and draw the collisions in an object layer and use game.physics.p2.convertTiledCollisionObjects(map, layer);

— Reply to this email directly or view it on GitHub https://github.com/englercj/phaser-tiled/issues/20#issuecomment-68070118 .

locohost commented 9 years ago

To be clear the custom tile attribute is "collides" set to true with no quotes.

On Wed, Dec 24, 2014, 2:47 PM locoHost locoHost@gmail.com wrote:

Ok good. I'm not using the Tiled collision editor. I've found that to be sketchy at best :-/

On Wed, Dec 24, 2014, 2:09 PM Chad Engler notifications@github.com wrote:

This will not work with the tile collision editor in tiled, the custom property defines if a tile is collidable or not and that is it. The whole tile becomes a solid block when it is set to true.

If you want complex shapes, just use the shape tools and draw the collisions in an object layer and use game.physics.p2. convertTiledCollisionObjects(map, layer);

— Reply to this email directly or view it on GitHub https://github.com/englercj/phaser-tiled/issues/20#issuecomment-68070118 .

englercj commented 9 years ago

As long as that is set on the tile properties of a tile in your tileset it should work, I can't really say what is wrong without looking at your app and map :/

locohost commented 9 years ago

Ok I'll put together a smaller demo app and post it here. I'll attach the Tiled map too.

Thanks for helping!

On Wed, Dec 24, 2014, 3:12 PM Chad Engler notifications@github.com wrote:

As long as that is set on the tile properties of a tile in your tileset it should work, I can't really say what is wrong without looking at your app and map :/

— Reply to this email directly or view it on GitHub https://github.com/englercj/phaser-tiled/issues/20#issuecomment-68072393 .

englercj commented 9 years ago

This has been fixed in master and will be released in v2. Unfortunately, it will require Phaser v2.3.0, I will release v2 of this plugin about the same time as Phaser v2.3.0 is released.