director class help

I am trying to use director class for my level transitions, I had it working but when i changed the level for it to load up it wouldn't load up the background. Here is the code in main.

-create main group
local mainGroup = display.newGroup()

local function main()

--add group from director class
mainGroup:insert(director.directorView)

--transition
director:changeScene("1-0")

return true
end

and here is the code for the first level.

function new()
localGroup = display.newGroup()

local background = display.newImage('1_0.png', true)
localGroup:insert(background)

--spawn Player X and Y coords

local spawnPlayerObject(xPlayerSpawn, yPlayerSpawn, richTurn)
local richPlayer = sprite.newSpriteSet(richSheet1,1,6)
sprite.add(richPlayer, "rich", 2,5,500,1)
rich = sprite.newSprite(richPlayer)
rich.x = xPlayerSpawn
rich.y = yPlayerSpawn
rich:scale(_W*0.0009, _W*0.0009) -- scale is used to adjust the size of the object.
richDir = richTurn
rich.rotation = richDir
rich:prepare("rich")
rich:play()
physics.addBody( rich, { friction=1, radius = 15 } ) -- needs a better physics body for collision detection.
localGroup:insert(spawnPlayerObject)

--level end location X and Y coords
local spawnLevelEnd(xEndSpawn, yEndSpawn) -- the end of level point code is here. what still needs to be done is the loading of the next level on completion.
endLevel = display.newCircle( xEndSpawn, yEndSpawn, 10 )
physics.addBody( endLevel, "static", { friction=1 } )

localGroup:insert(endLevel)

endLevel.scene = "1-1"
endLevel:addEventListener("touch", changeScene)

return localGroup
end

Any help would be great, thank you

Anyone?

views:1762 update:2011/11/5 17:18:39
corona forums © 2003-2011