My goal is to create an Enemy class for my game (Enemy.lua). Then during game play i want to be spawning new enemies every second or so.
Each enemy is required to have a function that is to be called every 60 milliseconds or may be called at enterFrame, this function is used for their behavior and AI.
When the enemy is shot, it has to die by calling its :delete function which does all the usual removeSelf() and nilling values.
When the game is over, i need to delete any remaining enemies that havent been shot.
BUT MY PROBLEM IS THAT I CAN NEVER SUCCESFULLY REMOVE ALL THE REMAINING ENEMIES.
Can someone please help me? I need guidance , if you have a stripped down source code i can look at it would be nice.
-
Ive tried everything in the books
-
ive read tons of tutorials
-
i’ve done eveyrhing i can it’s so frustrating. I keep getting “error… attempt to delete nil value” or “error attempt to compare nil value”
-
I’ve been dealing with this BS since Febuary so im getting fed up.
any help will be appreciated.