What’s the proper way to use Director?
If I’m in my game screen and I pause the game and have a Options button, I want to changeScene to the options screen.
But this will clean up everything in game right? If I changeScene to the game scene again, it will start new.
Am I suppose to cache everything to a file between scene changes? Or is there a more elegant way to do this?
[import]uid: 40413 topic_id: 13153 reply_id: 313153[/import]
if you are using director 1.3 you can use the popup function [import]uid: 7911 topic_id: 13153 reply_id: 48267[/import]
ok but if you display the pause scene as a popup, your pause usually has an options button too.
And from what I see, you can’t display a popup within a popup.
Now what?
[import]uid: 40413 topic_id: 13153 reply_id: 48275[/import]
ok but if you display the pause scene as a popup, your pause usually has an options button too.
And from what I see, you can’t display a popup within a popup.
Now what?
[import]uid: 40413 topic_id: 13153 reply_id: 48276[/import]
three options come to mind
the popup function has the ability to run a function when closing so make another popup function to load the options scene then in your option button code have it close the popup and run the function that opens the options popup and when you close the option popup it reloads the pause popup
or
director 1.3 can pass params to the next scene so you can use it to pass the state of the game to pause and then have your code pass the params back to the game
or save and load the game state to a file [import]uid: 7911 topic_id: 13153 reply_id: 48313[/import]
Hey I have a similar problem. However, I have not even reached that step yet. I am still unable to add a pause button to my game file. When I add,
function new()
local localGroup = display.newGroup()
local pause_btn = display.newImageRect(“pause-btn.png”,48 ,48 )
pause_btn:setReferencePoint(display.CenterReferencePoint)–may need “;”
pause_btn.x = _W/1.085; pause_btn.y = _H/20
pause_btn.scene = “pause”
function changeScene(e)
if(e.phase == “ended”) then
director:changeScene(e.target.scene)
end
end
localGroup:insert(pause_btn)
pause_btn:addEventListener(“touch”, changeScene)
return localGroup
end
The button doesn’t even show up. Any help?? Thanks [import]uid: 81317 topic_id: 13153 reply_id: 49098[/import]
i made that pop thing my self in director 1.2 as its really diff to clean all the objects in director 1.3
if you want i can send you the code
regards
syed usama
[import]uid: 34898 topic_id: 13153 reply_id: 50600[/import]