RestingCoder Posted January 29, 2014 Share Posted January 29, 2014 Can someone provide an example of everything needed to destroy a Tilemap? Visually, I am not having trouble with it, but there are a ton of Phaser.Tile objects in the heap when I switch levels/maps. I have tried so many things, and have checked the source in the dev branch for the last few days, and can't seem to be able to get this to stop, no matter what I try.Any thoughts would be greatly appreciated. If you'd like to see code, check here: http://play.reminiscencegame.com. Link to comment Share on other sites More sharing options...
rich Posted January 29, 2014 Share Posted January 29, 2014 Try this (it was added to tilemap.destroy tonight):map.data = [];This is where all the parsed data lives, the Tile objects, etc. So nuking it should clear the whole lot down. Please give it a go and see! Link to comment Share on other sites More sharing options...
RestingCoder Posted January 29, 2014 Author Share Posted January 29, 2014 Unfortunately, that doesn't appear to be working either. (I made the change locally, so it isn't in the code I linked above) EDIT: It may be something to do with the way I am creating the maps, but I don't seem to be having this issue with anything besides tiles. Link to comment Share on other sites More sharing options...
rich Posted January 29, 2014 Share Posted January 29, 2014 Are the tiles still actually there? Or have they just not been gc swept yet? Link to comment Share on other sites More sharing options...
RestingCoder Posted January 29, 2014 Author Share Posted January 29, 2014 They are definitely still there. After the 7th map load (on my laptop) the frame rate drops by around 5, and does so for each subsequent map load until it is in single digits, and memory usage just keeps going up. I've checked memory usage on every other object I am creating, and it only seems to happen with phaser.tile.I am probably just doing something wrong when destroying the map and creating the new one, but I just can't figure out what in the world is causing it after playing with it for a few days. Link to comment Share on other sites More sharing options...
rich Posted January 29, 2014 Share Posted January 29, 2014 How are you destroying the map references? It must still have a hook to something somewhere. Link to comment Share on other sites More sharing options...
RestingCoder Posted January 30, 2014 Author Share Posted January 30, 2014 Hey Rich, I'm not seeing a way to delete this thread, so can you delete it? This was caused by a stupid mistake on my part that most people will never run into, and I don't want to cause any confusion.Thanks! Link to comment Share on other sites More sharing options...
rich Posted January 30, 2014 Share Posted January 30, 2014 Could you let me know what was happening first please? Link to comment Share on other sites More sharing options...
RestingCoder Posted January 30, 2014 Author Share Posted January 30, 2014 I was extending Tilemap in a similar fashion as you'd do with Sprite, and the map wasn't actually accessible from the game, where I was trying to destroy it. I fixed it by moving some code around. Sorry for the waste of time. Thanks, as always, for what you do. Link to comment Share on other sites More sharing options...
Recommended Posts