So im trying to create a simple pop up menu in game, similar to angry birds, i already have it constructed and it pauses the physics… etc… the problem im having is how to get the same “menu” button to both bring up my pop-up menu and then to disable the pop-up menu. im having a hard time thinking what needs to be done. should i use a outside variable that states if the pop-up is open or not? hopefully this makes sense… any help or thoughts would be great, thanks [import]uid: 19620 topic_id: 7148 reply_id: 307148[/import]
Also here is my code, this successfully brings up my pop-up menu, but i am then unable to disable it… (im using .alpha property right now for testing, ill probly use .isVisible in the end)
ui = require ("ui")
local menuActive = false
local menu\_back = display.newImage( "menu\_bg.png" )
menu\_back.alpha = 0
--
local replaybt = ui.newButton{
default = "replay\_level.png",
over = "replay\_level.png",
onEvent = startgame,
id = "replaybt"
}
replaybt.alpha = 0
--
local lsbt = ui.newButton{
default = "next\_level.png",
over = "next\_level.png",
onEvent = startgame,
id = "lsbt"
}
lsbt.alpha = 0
--
local backbt = ui.newButton{
default = "backbt.png",
over = "backbt.png",
onEvent = removeMenu,
id = "backbt"
}
backbt.alpha = 0
--
local function showMenu ( event )
if (menuActive == false ) then
menu\_back.alpha = 1
replaybt.alpha = 1
lsbt.alpha = 1
backbt.alpha = 1
end
if (menuActive == true) then
menu\_back.alpha = 0
replaybt.alpha = 0
lsbt.alpha = 0
backbt.alpha = 0
end
end
--
local pausebt = ui.newButton{
default = "pause.png",
over = "pause.png",
onEvent = showMenu,
id = "pausebt"
}
pausebt.x = 50
pausebt.y = 24
--
menu\_back.x = 238
menu\_back.y = 158
--
replaybt.x = 175
replaybt.y = 155
--
lsbt.x = 293
lsbt.y = 155
--
backbt.x = 236
backbt.y = 224
--
[import]uid: 19620 topic_id: 7148 reply_id: 25133[/import]