Jump to content

kill/destroy a map before reloading it


owen
 Share

Recommended Posts

Hi, another newbie question sorry. 

When my player loses a life I want to rebuild the map from scratch, so I want to re-run the code that loads the map (tile layer and object layer).  No problem doing this except that I simply get another load of objects in addition to the current ones (duplicating instead of replacing them). This happens because I'm not wiping out the current map/layers before reloading. So my question is how do I destroy or kill the map, so that I can restart the level afresh without duplication?  In effect I want to re-run the 'create()' function (or part of it at least) but on a clean slate.  Is there an accepted/easy way of doing this?  Can I kill/destroy an entire map or at least the layer(s)?

 

Thanks

Owen

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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