Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

TileMap Shuffle


virginia_games
 Share

Recommended Posts

I'm having trouble using Phaser's TileMap.shuffle. When I use it, it shuffles the area of tiles like it should, but the tiles lose their unique properties after being shuffled. Is there some way I can shuffle tiles without losing collision properties? I'm using shuffle like this:

 

myTileMap.setCollision(tileID, true, layer);         // set a few collisions

myTileMap.setTileIndexCallback(tileID, function (player, tile) {     // I have two callbacks
                // do stuff

                myTileMap.shuffle(tile.x, tile.y, 5, 5, layer);            // call shuffle
            }, game, walls);

 

When the callback runs, the 5x5 area on the map loses its specific tile properties. Inside the callback, I can re-set the collision tiles, but I can't rewrite the callback I am in. Is there another way I should be going about achieving this? Thank you.

Link to comment
Share on other sites

  • 2 years later...
 Share

  • Recently Browsing   0 members

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