Explosions

This commit is contained in:
MaddoScientisto 2024-05-01 11:20:44 +02:00
commit 1d620a159c
4 changed files with 23 additions and 9 deletions

View file

@ -1,4 +1,5 @@
local Actor = require(make_path("actor2"))
local Particle = require(make_path("particle"))
-- barrel = setmetatable({}, {__index = actor})
-- function barrel:new(actor)
@ -17,6 +18,7 @@ function Barrel:new(x,y)
b.life = 5
b.shootable = true
b.spriteIndex = 3
b.particle = particles_list.EXPLOSION
return setmetatable(b, {__index=self})
end
@ -30,6 +32,8 @@ function Barrel:update()
end
function Barrel:destroy()
local p = Particle:create(self.x, self.y,self.particle)
add(particles, p)
del(actors,self)
end

View file

@ -1,4 +1,5 @@
local Actor = require(make_path("actor2"))
local Particle = require(make_path("particle"))
local Box = Actor:new()
@ -9,6 +10,8 @@ function Box:new(x,y)
b.shootable = true
b.spriteIndex = 7 --4
self.particle = particles_list.EXPLOSION
return setmetatable(b, {__index=self})
end
@ -19,6 +22,8 @@ function Box:update()
end
function Box:destroy()
local p = Particle:create(self.x, self.y,self.particle)
add(particles, p)
del(actors,self)
end

View file

@ -1,4 +1,5 @@
local Actor = require(make_path("actor2"))
local Particle = require(make_path("particle"))
local NPC = Actor:new()
@ -26,6 +27,8 @@ function NPC:new(x,y)
n.raycast_frames = 0
n.raycast_frames_to_wait = 120
n.particle = particles_list.EXPLOSION
return setmetatable(n, {__index=self})
end
@ -56,6 +59,8 @@ function NPC:update()
end
function NPC:destroy()
local p = Particle:create(self.x, self.y,self.particle)
add(particles, p)
del(actors,self)
end