im new and trying to learn
and i got this code from Ghosts vs. Monsters
but i really can NOT make it to restart
i have tried, tried and tried but i just cant figure it out!!!
please help!!!
– restart button
local reBtn
local onReTouch = function( event )
if event.phase == “release” and not isLevelSelection and reBtn.isActive then
audio.play( tapSound )
local localGroup = display.newGroup()
local theTimer
local loadingImage
local showReLoadingScreen = function()
loadingImage = display.newImageRect( “loading.png”, 320, 480 )
loadingImage.x = 160; loadingImage.y = 240
end
showReLoadingScreen()
local goToLevel = function()
director:changeScene( “level1” )
end
end
end
reBtn = ui.newButton{
defaultSrc = “restartbtn.png”,
defaultX = 60,
defaultY = 60,
overSrc = “restartbtn-over.png”,
overX = 60,
overY = 60,
onEvent = onReTouch,
id = “RestartButton”,
text = “”,
font = “Helvetica”,
textColor = { 255, 255, 255, 255 },
size = 16,
emboss = false
}
reBtn.x = 160 reBtn.y = 440
reBtn.alpha = 100
localGroup:insert( reBtn )
return localGroup
end
end [import]uid: 43289 topic_id: 10265 reply_id: 310265[/import]