From d25a96ecbcacdddcc793e257ee2ea62d4c846762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erkki=20Sepp=C3=A4l=C3=A4?= Date: Mon, 20 Oct 2014 22:15:21 +0300 Subject: [PATCH] PhysicsEntity:wasHitBy: renamed from wasHit and extended with the 'by' parameter --- entities/physicsentity.lua | 2 +- entities/plane.lua | 2 +- entities/powerup.lua | 2 +- entities/tinyshot.lua | 2 +- entities/vickers77.lua | 2 +- level_state.lua | 8 ++++---- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/entities/physicsentity.lua b/entities/physicsentity.lua index f3c4de5..3934f39 100644 --- a/entities/physicsentity.lua +++ b/entities/physicsentity.lua @@ -63,7 +63,7 @@ PhysicsEntity = Class{ end; -- Reimplement - wasHit = function(self) + wasHitBy = function(self, by) end; diff --git a/entities/plane.lua b/entities/plane.lua index ba95c19..8204156 100644 --- a/entities/plane.lua +++ b/entities/plane.lua @@ -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; diff --git a/entities/powerup.lua b/entities/powerup.lua index 4291cfd..ec274c9 100644 --- a/entities/powerup.lua +++ b/entities/powerup.lua @@ -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; diff --git a/entities/tinyshot.lua b/entities/tinyshot.lua index 8709e00..cb4adda 100644 --- a/entities/tinyshot.lua +++ b/entities/tinyshot.lua @@ -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; diff --git a/entities/vickers77.lua b/entities/vickers77.lua index d5fae4b..78880e7 100644 --- a/entities/vickers77.lua +++ b/entities/vickers77.lua @@ -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; diff --git a/level_state.lua b/level_state.lua index 7e20d4e..5bb8a1e 100644 --- a/level_state.lua +++ b/level_state.lua @@ -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