Resize sprites, tighten player hitbox, implement smarter collision.
This commit is contained in:
parent
eb6d37f99c
commit
9a26eb4b3a
|
@ -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
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 651 B After Width: | Height: | Size: 4.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 761 B After Width: | Height: | Size: 4.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.8 KiB |
|
@ -53,6 +53,7 @@ function Kani:init(ui)
|
|||
self.type = 'kani'
|
||||
self:setGroupMask(0x2)
|
||||
self:setCollidesWithGroupsMask(0xd)
|
||||
self:setCollideRect(1,12,25,24)
|
||||
|
||||
self.reserveCharge = 100
|
||||
|
||||
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user