I am currently working on transitions for a game and I have the transitions down, but I don't know how to get rid of old objects from past levels to keep the memory down. Can someone help me one this? Thanks for any help!
Label: corona android iphone ipad building error inmobi problem display screen View image tableView failed object physics touch button game lua config event listener |
removing old objects
use the director module, its very easy to use and it get rid of all display objects for you on scene change
I am currently using director
if I am using director and it isn't getting rid of the old objects is something going wrong or am I doing something wrong?
It sounds as though you aren't adding the objects to the local group.
See here; http://techority.com/2010/11/19/how-to-use-scenesscreens-in-corona/
Peach :)
I have everything inserted if that is what you mean. I will post some code and maybe that will help. Another problem we are having is that when the level transitions the music continues but it skips about one second. this is the code for the first level
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | module(..., package.seeall) --_G.playWorld1Soundtrack() if world1Soundtrack then timer.cancel(_G.bbbbbb) _G.bbbbbb = nil _G.bbbbbb = timer.performWithDelay(1, _G. playWorld1Soundtrack, 0) else _G.bbbbbb = timer.performWithDelay(1, _G. playWorld1Soundtrack, 0) end --local world1Soundtrack = audio.loadStream("AClimber_World_1.mp3") --local world1SoundtrackOn = false --function music() --if (world1SoundtrackOn == false) then --world1SoundtrackOn = true -- audio.play(world1Soundtrack) --elseif (world1SoundtrackOn == true) then -- end --end --music() function new() local localGroup = display.newGroup() local background = display.newImage('1-0.png', true) --background.x = 320 --background.y = 480 --background:scale(display.contentWidth/320, display.contentHeight/480) background:scale(display.contentWidth/640, display.contentHeight/960) background:setReferencePoint(display.TopLeftReferencePoint) --background.x = 640 --background.y = 960 background:toBack() local endButton = display.newImage('endbutton.png',true) endButton:setReferencePoint(display.CenterReferencePoint) endButton.x = 50 endButton.y = 100 endButton.scene = "oneone" --continueButton.name = 'continueB' --local optionsB = display.newImage('optionButton.png', true) --optionsButton.x = 230 --optionsButton.y = 500 --optionsButton.name = 'optionsB' function changeScene(e) if(e.phase == "ended") then --audio.stop(world1Soundtrack) _G.stopWorld1Soundtrack() director:changeScene(e.target.scene); end end localGroup:insert(background) localGroup:insert(endButton) --localGroup:insert(continueButton) --localGroup:insert(optionsB) --localGroup:insert(startButton) --localGroup:insert(continueButton) --localGroup:insert(optionsButtion) endButton:addEventListener('touch', changeScene) --continueButton:addEventListener('touch', changeScene) --optionsButton:addEventListener('touch', changeScene) return localGroup end |
views:1434 update:2012/1/1 13:29:50
热门文章
GameCenter LeaderBoards and Achievements Enabled Through OpenFeint
send message and call to a person
Forum: Report Spam + PM
[INSTALL_PARSE_FAILED_NO_CERTIFICATES]
[SOLVED] Director ERROR: Failed to execute new( params ) function on 'screen1'
Too many (200) local variables
Corona SVG Level Builder released. Drag and drop physics level editor with Inkscape and SVG.
Small bug in Collectible Items example
Pivot Joints and apparent elasticity
Can't make removeSelf() delayed
send message and call to a person
Forum: Report Spam + PM
[INSTALL_PARSE_FAILED_NO_CERTIFICATES]
[SOLVED] Director ERROR: Failed to execute new( params ) function on 'screen1'
Too many (200) local variables
Corona SVG Level Builder released. Drag and drop physics level editor with Inkscape and SVG.
Small bug in Collectible Items example
Pivot Joints and apparent elasticity
Can't make removeSelf() delayed
相关文章
A device build error occurred on server!!!
How to find matches in a 2D array?
need help to convert transition.to function in physics simulation
Ggravity - Promo codes
Inmobi payment cycle?
Push Notifications
Collision help
Omniblaster - My first iPhone game/app is now "In Review" at the App Store
display.remove does not work as expected
Box of Sox
How to find matches in a 2D array?
need help to convert transition.to function in physics simulation
Ggravity - Promo codes
Inmobi payment cycle?
Push Notifications
Collision help
Omniblaster - My first iPhone game/app is now "In Review" at the App Store
display.remove does not work as expected
Box of Sox
corona forums © 2003-2011