我希望对象在碰撞时消失,然后在单击重新启动按钮时再次出现。这是我的代码:)
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
希望能有所帮助。