Crash when trying to change to gameover scene

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:

1
2
3
4
5
6
7
8
-- Die
function dieFunction()
        if(score > bestScore) then
                bestScore = score
                saveValue("scorefile.data", bestScore)
        end
        director:changeScene("pregame")
end

Maybe I should include this

Application Specific Information:
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.

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.

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

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. ;)

I've checked all the names, they're correct.. Thanks, I'll try it with the debugger as soon as I get home :)

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..

It not seems to be a problem with Director, maybe if you talk to Ansca team they could help better.

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!

enterFrame is very powerful and when it's added to Runtime, Director can't remove it.

I believe the error has to do with the physics not being locked down when you try to modify it.

Assertion failed: (IsLocked() == false), function CreateBody,

For example, maybe the scene is changing but you are trying to set your object's isSleepAllowed property after the fact?

Just a thought.. I'm having a similar problem.

-d

views:1893 update:2011/10/12 18:33:00
corona forums © 2003-2011