Jump to content

Tilemap from array


jorgesereno
 Share

Recommended Posts

Hi,

taking for example an array like this:

initPlatformMap = [            [0,0,0,0,0,0,0,0],            [0,1,1,0,0,0,0,0],            [0,0,0,0,0,0,0,0],            [0,0,0,0,0,0,0,0],            [0,0,0,0,0,1,1,0],            [0,0,0,0,0,0,0,0]        ];

how can i create a tilemap on screen replacing the 1's with an image and then move the tilemap up and randomly generate the next lines?

Link to comment
Share on other sites

It has been a while since I did it but I started down this route once and if I remember correctly I created a blank tilemap and then used putTile to place tile types. Not only was it a while ago but also it caused a major performance hit while this looped through placing the tiles so I left it and did something else. It did have the desired result though just with a multiple second lag while it ran.

This was before Phaser 2 so it may be more efficient now or there may be a better method that I didn't discover but I'd recommend looking a putTile() as a starting point.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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