Hi,
Can anyone help me because the title says it all! I want to be able to have a screen change within one of my screens. I don't want the screen to change back to the screen it came from but to another screen. THANKS! This down here is a screen itself coming from a previous screen.
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 | module(..., package.seeall) function new() local localGroup = display.newGroup() local bg = display.newImageRect("hello.png",_W , _H) bg:setReferencePoint(display.CenterReferencePoint)--may need ";" bg.x = _W/2; bg.y = _H/2 local next_btn = display.newImageRect("back-btn.png",32 ,32 ) next_btn:setReferencePoint(display.CenterReferencePoint)--may need ";" next_btn.x = 290; next_btn.y = _H/1.06 next_btn.scene = "menu" local hi_btn = display.newImageRect("hi-btn.png",90 ,30 ) hi_btn:setReferencePoint(display.CenterReferencePoint)--may need ";" hi_btn.x = _W/5; hi_btn.y = _H/5 hi_btn.scene = "game" function changeScene(e) if(e.phase == "ended") then director:changeScene(e.target.scene, "flip") end end localGroup:insert(bg) localGroup:insert(next_btn) localGroup:insert(hi_btn) -- Listeners next_btn:addEventListener("touch", changeScene) hi_btn:addEventListener("touch", changeScene) return localGroup end |