ok so I am creating a tower defense game.I was wondering how do i remove objects that I do not require anymore (i.e lets say a bullet object has hit a target, at the moment all im going is setting the object to invisible). Starts to get slow after about 1.5K objects.
I have done a bit of research, however their doesn’t seem to be any ubiquitous method. What do you guys recommend.
thanks
You need to remove the object from the stage, and ensure all references to it are set to removed. This includes removing event listeners, child display objects and stopping the execution of any internal code. Then the objects will become eligible for garbage collection.
So for example: