-
-
Save RonJeffries/1798acf92f27730bfa23 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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