当敌人移出屏幕时,游戏失败。

我想在不添加地面和碰撞的情况下使敌人通过屏幕导致游戏失败

        if event.time - timeLastEnemy >= math.random(600, 1000) then
        -- 在屏幕顶部随机位置
        enemy = display.newImageRect("assets/graphics/enemy.png",98,150)
        enemy.x = math.random(halfEnemyWidth, display.contentWidth - halfEnemyWidth)
        enemy.y = -enemy.contentHeight
点赞
用户825481
用户825481

希望这有帮助:

local function runtimeStuff()
  if enemy.y > 500 then
  --输了游戏
  end
end

Runtime:addEventListener("enterFrame",runtimeStuff)
2014-03-19 19:02:55