Skip to content

Commit

Permalink
Fixed bomb not getting destroyed on lava
Browse files Browse the repository at this point in the history
  • Loading branch information
Lars L committed Jun 1, 2020
1 parent aa5e285 commit dd07258
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions source/assets.lua
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ local tiles = {
dim = {w=8, h=5},
trans = {r=0, sx=1, sy=1, ox=0, oy=3},
deadly = true,
solid = true,
collide = true, },
{ name = "exit",
type = "entity",
Expand Down
7 changes: 6 additions & 1 deletion source/objects/bomb.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function Bomb:init(level, dx, dy, parent)
self.bounciness = .6
local bx = parent.pos.x+parent.dim.w/2-self.dim.w/2-.5
local by = parent.pos.y+parent.dim.h/2-self.dim.h/2-2
Actor.init(self, level, bx, by, {collide=true})
Actor.init(self, level, bx, by, {collide=true, canDie=true})
local dx = dx-parent.pos.x+parent.dim.w/2
local dy = dy-parent.pos.y+parent.dim.h/2
local angle = math.sqrt(dx*dx+dy*dy)
Expand All @@ -33,6 +33,11 @@ function Bomb:init(level, dx, dy, parent)
end


function Bomb:onCollision(other)
if other.name == "lava" then self:destroy() end
end


function Bomb:onDead()
Assets.playSound("boom")
Screen:shake()
Expand Down

0 comments on commit dd07258

Please sign in to comment.