PhysicsEntity:wasHitBy: renamed from wasHit and extended with the 'by' parameter
This commit is contained in:
parent
d9e95285a2
commit
d25a96ecbc
6 changed files with 9 additions and 9 deletions
|
@ -63,7 +63,7 @@ PhysicsEntity = Class{
|
|||
end;
|
||||
|
||||
-- Reimplement
|
||||
wasHit = function(self)
|
||||
wasHitBy = function(self, by)
|
||||
end;
|
||||
|
||||
|
||||
|
|
|
@ -180,7 +180,7 @@ Plane = Class{
|
|||
end
|
||||
end;
|
||||
|
||||
wasHit = function(self)
|
||||
wasHitBy = function(self, by)
|
||||
local i = love.math.random(#CLANG_SFX)
|
||||
CLANG_SFX[i]:play()
|
||||
end;
|
||||
|
|
|
@ -28,7 +28,7 @@ PowerUp = Class{
|
|||
-- Noop, implement in child
|
||||
end;
|
||||
|
||||
wasHit = function(self)
|
||||
wasHitBy = function(self, by)
|
||||
HIT_SOUND:rewind()
|
||||
HIT_SOUND:play()
|
||||
end;
|
||||
|
|
|
@ -36,7 +36,7 @@ TinyShot = Class{
|
|||
end
|
||||
end;
|
||||
|
||||
wasHit = function(self)
|
||||
wasHitBy = function(self, by)
|
||||
Animation(self.body:getX(), self.body:getY(), self.level, explosionFrames)
|
||||
end;
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ Vickers77 = Class{
|
|||
end
|
||||
end;
|
||||
|
||||
wasHit = function(self)
|
||||
wasHitBy = function(self, by)
|
||||
Animation(self.body:getX(), self.body:getY(), self.level, explosionFrames)
|
||||
end;
|
||||
|
||||
|
|
|
@ -177,18 +177,18 @@ function begin_contact(a, b, coll)
|
|||
|
||||
if aObj ~= nil and bObj ~= nil then
|
||||
if aObj:isinstance(Plane) and bObj:isinstance(PowerUp) then
|
||||
bObj:wasHit()
|
||||
bObj:wasHitBy()
|
||||
bObj.deleteLater = true
|
||||
aObj:setPowerUpMode(bObj.mode)
|
||||
coll:setEnabled(false)
|
||||
elseif bObj:isinstance(Plane) and aObj:isinstance(PowerUp) then
|
||||
aObj:wasHit()
|
||||
aObj:wasHitBy()
|
||||
aObj.deleteLater = true
|
||||
bObj:setPowerUpMode(bObj.mode)
|
||||
coll:setEnabled(false)
|
||||
else
|
||||
aObj:wasHit()
|
||||
bObj:wasHit()
|
||||
aObj:wasHitBy(bObj)
|
||||
bObj:wasHitBy(aObj)
|
||||
|
||||
local plane = nil
|
||||
local other = nil
|
||||
|
|
Loading…
Reference in a new issue