Firs of all i want to thank community for so much help. Thank you all.
I have a simple problem. When level complete i have have a popup image then i add buttons to it such as, next level, replay, and menu. Now i want all thing to be deleted when i press any of the buttons.
Here is the code i have written:
-----------------------------------------------------------------------------------
-- Pop Up manu handlers when level is done and complete
-----------------------------------------------------------------------------------
-- Replay pressed
local function replayPressed(b)
game.playEventSound(game.soundPressed)
game.changeScene("level1","overFromTop")
end
-- Menu Pressed
local function menuPressed(b)
game.playEventSound(game.soundPressed)
game.changeScene("mainscene","overFromTop")
game.popUp = false
end
-----------------------------------------------------------------------------------
--Button press handlers goes here
-----------------------------------------------------------------------------------
-- When shapes colided with rope then do this
local function showmsg()
game.popUp = true
levelOver = display.newImageRect("levels/PopupLevelComplete.png", 338, 155)
levelOver.x = 240
levelOver.y = -100
transition.to(levelOver,{time = 100, x = 240 , y = 160 })
group:insert(levelOver)
-- Add buttons here
replayButton=button:create(group,1,{x= - 200,y=190,w=155,h=65,handler=replayPressed}, "levels/ReplayLevel.png")
transition.to(replayButton,{time = 1000, x = 155 , y = 190 })
-- Add Menu button
menuButton=button:create(group,1,{x= 240,y= - 200,w=138,h=55,handler=menuPressed}, "levels/Menu.png")
transition.to(menuButton,{time = 1000, x = 240 , y = 130 })
-- Add next button
nextButton=button:create(group,1,{x=600,y=190,w=155,h=65,handler=nextPressed}, "levels/NextLevel.png")
transition.to(nextButton,{time = 1000, x = 320 , y = 190 })
end
local function onCollision (event )
if game.popUp then return end
if event.phase == "began" and event.other.name == "shape" then
timer.performWithDelay (1000, showmsg)
end
end
But it wont work. Please help [import]uid: 11559 topic_id: 20275 reply_id: 320275[/import]
[import]uid: 52491 topic_id: 20275 reply_id: 79379[/import]