Skip to content

Instantly share code, notes, and snippets.

@RonJeffries
Created October 2, 2014 02:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RonJeffries/1798acf92f27730bfa23 to your computer and use it in GitHub Desktop.
Save RonJeffries/1798acf92f27730bfa23 to your computer and use it in GitHub Desktop.
function Ship:crashShips()
for s,sh in pairs(Ships) do
if sh ~= nil and sh ~= self then
self:collide(sh)
end
end
end
function Ship:collide(object)
local dist = self.pos:dist(object.pos)
if dist < 19 then
print("ship ", self, self.name, object, object.name)
local n = 0
for s,sh in pairs(Ships) do
n = n + 1
end
print(n, "ships")
self:die()
--object:die() -- other guy will do himself
end
end
function Ship:die()
table.insert(Adds,Explosion(self.pos, self.col))
table.insert(Deletes, self)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment