I’m spent the last month learning Corona SDK and brushing up on programming. Just a quick question about something that’s been nagging me.
I implemented two different ways to load my ENEMY for my game…
Implementation A… I load & create ALL then enemy one time before the game starts and keep all 75 enemy in an array and set all the obj.isVisible = false. When I spawn or kill an enemy I just update obj.isVisible , I never destroy it from memory, ever. At least until the level is over.
Implementation B … I don’t load any enemy into memory before the game. I create the enemy on the fly, as needed in a table. When I spawn then enemy I create it… when the enemy dies I delete it from memory and the table via obj:removeSelf() ob = nil… so I dynamically keep the enemy in memory during the level.
Implementation A works freakin great, never a problem with speed or anything
Implementation B works fine AT FIRST then the frame rate gets sluggish then slows down to a crawl and stops completely… ugh.I checked the memory usage for memory leaks… it goes up maybe 200MB if at all
The question is WHY does Implementation B slow the game down. Why does it not work as well as Implementation A.
Any ideas??