Saxum/Levels/scripts/deleteRandomObject.lua
2015-01-16 16:51:36 +01:00

21 lines
575 B
Lua

if(triggeredDeleteRandomObject == nil) then
triggeredDeleteRandomObject = false
end
function trigger(objectToChange)
if(triggeredDeleteRandomObject == false) then
if(not level) then
print("No level found in Lua!")
return
end
if(not physics) then
print("No physics found in Lua!")
return
end
a = level:getObjectCount()
rand = math.random(0, a - 1)
level:deleteObject(rand)
triggeredDeleteRandomObject = true
print("deleteRandomObject")
end
end