我希望当敌人通过时屏幕游戏丢失而不添加地面和碰撞
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
答案 0 :(得分:0)
做这样的事情:
local function runtimeStuff()
if enemy.y > 500 then
--lose game
end
end
Runtime:addEventListener("enterFrame",runtimeStuff)
希望这有帮助