当敌人走出屏幕游戏时丢失

时间:2014-03-16 08:46:11

标签: lua corona

我希望当敌人通过时屏幕游戏丢失而不添加地面和碰撞

        if event.time - timeLastEnemy >= math.random(600, 1000) then
        -- Randomly position it on the top of the screen
        enemy = display.newImageRect("assets/graphics/enemy.png",98,150)
        enemy.x = math.random(halfEnemyWidth, display.contentWidth - halfEnemyWidth)
        enemy.y = -enemy.contentHeight

1 个答案:

答案 0 :(得分:0)

做这样的事情:

local function runtimeStuff()
  if enemy.y > 500 then
  --lose game
  end
end

Runtime:addEventListener("enterFrame",runtimeStuff)

希望这有帮助