diff --git a/src/bullet.lua b/src/bullet.lua index 91bada1..7cfa3ca 100644 --- a/src/bullet.lua +++ b/src/bullet.lua @@ -32,13 +32,18 @@ end function Bullet:update() local collisions = select(3, self:moveWithCollisions(self.x+self.vector.dx, self.y+self.vector.dy)) + local realCollision = false + for i=1, #collisions, 1 do - -- anything the bullet can collide with should be damaged by it + -- anything the bullet can collide with should be damaged by it, but it has to hit an actual pixel local obj = collisions[i].other - obj:damage(self.damage) + if self:alphaCollision(obj) then + obj:damage(self.damage) + realCollision = true + end end - if #collisions >= 1 or self:outOfBounds() then + if realCollision or self:outOfBounds() then self:remove() end end diff --git a/src/images/ebi.png b/src/images/ebi.png index ca4c62c..cb0d487 100644 Binary files a/src/images/ebi.png and b/src/images/ebi.png differ diff --git a/src/images/ika.png b/src/images/ika.png index 89d8d47..84fb51f 100644 Binary files a/src/images/ika.png and b/src/images/ika.png differ diff --git a/src/images/kani.png b/src/images/kani.png index fb3ce13..5123caf 100644 Binary files a/src/images/kani.png and b/src/images/kani.png differ diff --git a/src/kani.lua b/src/kani.lua index f5d1047..bf0cfd2 100644 --- a/src/kani.lua +++ b/src/kani.lua @@ -53,7 +53,8 @@ function Kani:init(ui) self.type = 'kani' self:setGroupMask(0x2) self:setCollidesWithGroupsMask(0xd) - + self:setCollideRect(1,12,25,24) + self.reserveCharge = 100 -- controls the speed the crank recharges the player's reserves. A lower number allows faster charging. @@ -155,6 +156,6 @@ end function Kani:runReady() local collisions = Kani.super.runReady(self) for i=0, #collisions, 1 do - -- handle player-triggered collisions + -- TODO: handle player-triggered collisions end end