Can you tie the action of one button to another button? I have a native alert button that says Play Again. I then have another button that is a reset button, which resets my game board. How do I tie the function of one button to another button?
This is the code for the Native Alert.
[lua] – Handler that gets notified when the alert closes
local function onComplete( event )
if “clicked” == event.action then
local i = event.index
if 1 == i then
director:changeScene( “titlescreen”, “fade” )
elseif 2 == i then
– Return to gameboard and Reset game
–I would think the code goes here?
end
end
end
This is the code for the reset button
[lua]local function resetbuttonfn (event)
physics.setGravity(0,9.8)
director:changeScene( “gameboard”, “flip” )
media.playEventSound( “bloop_x.caf” )
end
resetbutton:addEventListener (“tap”, resetbuttonfn)[/lua] [import]uid: 72372 topic_id: 12941 reply_id: 312941[/import]