From dd07258b35a5e1160f3d954a4c936aeb71684539 Mon Sep 17 00:00:00 2001 From: Lars L Date: Mon, 1 Jun 2020 18:32:21 +0200 Subject: [PATCH] Fixed bomb not getting destroyed on lava --- source/assets.lua | 1 + source/objects/bomb.lua | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/source/assets.lua b/source/assets.lua index d5cf8f1..3586ac7 100644 --- a/source/assets.lua +++ b/source/assets.lua @@ -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", diff --git a/source/objects/bomb.lua b/source/objects/bomb.lua index 77658f4..430a9dc 100644 --- a/source/objects/bomb.lua +++ b/source/objects/bomb.lua @@ -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) @@ -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()