I have no idea what’s causing this. I remember from the youtube tutorial video that you mentioned something about cleaning timers, etc, but when I went into the director.lua to uncomment the cleaner function it was already uncommented, so I guess it’s already cleaning. I’ve got about 10 timers and some more functions and listeners in my game, maybe they’re causing it?
Code looks like this:
-- Die
function dieFunction()
if(score \> bestScore) then
bestScore = score
saveValue("scorefile.data", bestScore)
end
director:changeScene("pregame")
end
if(event.phase == "began" and event.other.class == "7") then
dieFunction()
end
This causes a crash… [import]uid: 14018 topic_id: 5630 reply_id: 305630[/import]
It seems to be something at your code, not the changeScene itself. Please take a look at your code or put all the code here. [import]uid: 8556 topic_id: 5630 reply_id: 19258[/import]
What can cause changeScene crashes?? Because I have no idea what to look for at the moment… Everything seems to be working as it should, except when I add the changeScene inside the dieFunction, then it crashes upon collision [import]uid: 14018 topic_id: 5630 reply_id: 19268[/import]
Have you tried to run it with the debugger so you can tell exactly what line it crashes ?
[EDIT] Also, check your file name. I made that error once and everything crashed. I was telling director to load “survivalmode” and it should have loaded “survival-mode” instead. I don’t know if it’s case sensitive too. Just a guess like that. [import]uid: 1058 topic_id: 5630 reply_id: 19409[/import]
I’ve checked all the names, they’re correct… Thanks, I’ll try it with the debugger as soon as I get home [import]uid: 14018 topic_id: 5630 reply_id: 19443[/import]
This is what I got from the debugger:
Assertion failed: (IsLocked() == false), function CreateBody, file /Users/ansca/.hudson/jobs/Main-DMG/workspace/platform/mac/…/…/external/Box2D_v2.1.2/Box2D/Box2D/Dynamics/b2World.cpp, line 84.
Program finished
On line 84 I’ve got something irrelevant: “southWall.isSleepingAllowed = false”
I’ve got a ball that can collide with 30 different enemies. I’ve got 30 different if statements that each call the dieFunction upon collision and the dieFunction contains the changeScene… [import]uid: 14018 topic_id: 5630 reply_id: 19478[/import]
It not seems to be a problem with Director, maybe if you talk to Ansca team they could help better. [import]uid: 8556 topic_id: 5630 reply_id: 19642[/import]
Can enterFrame functions make director not able to change scene? Because I don’t remove them upon changing scene… I’ll try e-mail Ansca, thanks! [import]uid: 30185 topic_id: 5630 reply_id: 19656[/import]