Hi thre. Im trying to implement this: When i press button it displays object, when i press it again same button the object disappear.
Here is the code i have so far
[code]
– settings function
local function optionsPressed(b)
overlayGroup = display.newGroup()
game.playEventSound(game.soundPressed)
settingsOverLay = display.newImageRect(“mainscene/settingsoverlay.png”, 57, 131)
settingsOverLay.x = 50
settingsOverLay.y = 207
–transition.to(settingsOverLay,{time = 100, x = 50 , y = 207 })
overlayGroup:insert(settingsOverLay)
— Craetae buttons here
soundButton=button:create(overlayGroup,1,{x=50,y=220,w=45,h=45,handler=soundPressed},“buttons/soundicon.png”)
if game.sound == false then soundButton.image=“buttons/soundiconover.png” end
– Musik Icon button
musicButton=button:create(overlayGroup,1,{x=50,y=170,w=45,h=45,handler=musikPressed},“buttons/musicicon.png”)
if game.music == false then musicButton.image=“buttons/musiciconover.png” end
– When i press same button i want all of the above to be gone.
end
– Settings button
button:create(group,1,{x=50,y=280,w=65,h=65,handler=optionsPressed},“buttons/settingsicon.png”)
[/code] [import]uid: 11559 topic_id: 20505 reply_id: 320505[/import]