This is my game.lua file:
local Level = require("level")
local currentLevel;
function new()
local obj = display.newGroup();
currentLevel = Level.new(1, obj); --this level creation works fine
function obj:newLevel(e)
local newLevel = Level.new(1, obj); --this level creation crashes
end
function obj:replay() --this gets called by the level
currentLevel:destroy();
timer.performWithDelay ( 1000, obj.newLevel, 1 ); --I don't think I should need to delay the creation of a new level, but the crash happens with or without the delay
end
return obj;
end
As you can see, I’m just trying to destroy a level and create a new one. The destroying works fine - everything from the first level is removed and I get a blank screen. The crash comes when I try to create a new level. I create it the same way I created it the first time, so I don’t understand why it crashes the second time. I get the Apple error console that starts with this:
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000000
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
…
Thousands more unreadable errors too long to post here.
Any ideas?
[import]uid: 52127 topic_id: 10157 reply_id: 310157[/import]