I have main.lua and level1.lua, I have created function in main.lua then call it in level1.lua
The problem is When i click manu button everything goes great, but when i click it again everything is good except form menu button not coming back to its position. i don’t know why. Any help would be much appreciated.
[code]
– Here is my main.lua file where i created function
— SIDE MENU FOR EACH LEVEL COME FROM THE left
game.sideMenu = function(sideMenu)
–if game.pause then
if menuOverlayGroup then
transition.to(menuOverlayGroup, {time = 200, y = 400})
menuOverlayGroup = nil
else
menuOverlayGroup = display.newGroup()
game.playEventSound(game.soundPressed)
menuOverlay = display.newRect(0, 400, 100, 130)
transition.to(menuOverlay,{time = 200, y = 255 })
menuOverlayGroup:insert(menuOverlay)
end
end
– And here is the code from level1.lua
local menuButton
– When Menu button pressed
local function menuPressed(b)
game.playEventSound(game.soundPressed)
if game.menuOverlayGroup then
transition.to(menuButton, {time = 200, y = 294})
else
game.sideMenu()
transition.to(menuButton, {time = 200, y = 180})
game.playEventSound(game.soundPressed)
end
end
– Add menu button
menuButton = button:create(group,1,{x=30,y=294,w=45,h=45,handler=menuPressed},“buttons/menuicon.png”)
[import]uid: 11559 topic_id: 20738 reply_id: 320738[/import]