如何删除对象,然后在重新启动单击时再次出现?Corona sdk



我希望对象在碰撞时消失,然后在单击重新启动按钮时再次出现。这是我的代码:)

function touchRestart(event)
  if event.phase=="began" then
    print('foo')
  end
end
restart:addEventListener("touch",touchRestart)
function onLocalCollision(raketa,event)
  if event.phase=="began" then
    if event.object1.myName=="meteor" and event.object2.myName=="raketa" then
      score=score -1
      scoreNumber.text = score
      restart.isVisible=true
    end
  end
end
raketa.collision = onLocalCollision
Runtime:addEventListener("collision",raketa)

应该很容易。

制作object.alpha = 0,然后当您单击重新启动按钮时,制作object.alpha = 1

希望能有所帮助。

相关内容

最新更新