Hello everyone, I am having trouble removing an object. I am currently using @roaminggamer’s radar system module.
I have verified that the finalize listeners for the object are running. The error I get says that the x value in one of the calculations needed for the radar system is nil. However, the finalize listener should be removing everything…
Any help would be great! Also, here’s the code:
--calls asteroid's listeners and adds it to radar(in separate function) asteroid.collision = asteroidCollision asteroid.enterFrame = removeAsteroids asteroid.finalize = asteroidFinalize asteroid:addEventListener("collision") asteroid:addEventListener("finalize") listen("enterFrame", asteroid) masterM.enemyHUD.getHUD() masterM.enemyHUD.watchObject(asteroid, {1,0,0,0.5}, 10) --finalize listener ("ran" is printed for each asteroid removed) asteroidFinalize = function(self) local masterM = require "levels-management.moduleaccessor" masterM.enemyHUD.getHUD() masterM.enemyHUD.ignoreObject(asteroid) self:removeEventListener("collision") ignore("enterFrame", asteroid) print("ran") end