【问题标题】:How to remove object and then appear again on restart click ?Corona sdk如何删除对象然后在重新启动时再次出现单击?Corona sdk
【发布时间】:2017-04-12 07:31:21
【问题描述】:

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

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)

【问题讨论】:

    标签: lua coronasdk


    【解决方案1】:

    应该很容易。

    制作你的 object.alpha = 0 ,然后当你点击重启按钮时制作 object.alpha = 1

    希望对您有所帮助。

    【讨论】:

      猜你喜欢
      • 2014-06-05
      • 2014-02-05
      • 1970-01-01
      • 1970-01-01
      • 2019-01-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-18
      相关资源
      最近更新 更多