Jump to content

Get specific Tiles x and y position and set the player there ?


kipppys
 Share

Recommended Posts

what im trying to do is create a bunch of different maps for a rouge like game and i want the game code to pick up where i place the player tile that will look like a normal tile with a different id and then place the player at that position instead of holding a bunch of position for each map just curious if its possible i assume it is but i could use some help guys :)

Link to comment
Share on other sites

sharbelfs method looks nice for a quick placing

 

but doing it over and over again for various stuffs (player, bots, objects, doors, whatever) might be not that great.

 

here's the lame way I use, it's cheap but it works

 

var botSpawnTile=42;

 

    var mapArray = layer.getTiles(0, 0, game.world.width, game.world.height);  
               
        for(var i=0;i<mapArray.length;i++){
            

              var myTile=mapArray;

            if(myTile.index==botSpawnTile){

                //doSomething

             }

      }

 

 

But only on create, on update would be a bad idea

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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