Spawner for barrels

This commit is contained in:
MaddoScientisto 2024-04-26 13:31:42 +02:00
commit 2507ba301c
4 changed files with 144 additions and 97 deletions

View file

@ -70,9 +70,17 @@ function _update()
weapons_manager.update()
for b in all(actors) do
for a in all(actors) do
a:update()
end
for b in all(bullets) do
b:update()
end
for p in all(particles) do
p:update()
end
end
LAYERS = {
@ -83,6 +91,8 @@ LAYERS = {
}
actors = {}
bullets = {}
particles = {}
function _draw()
cls(0)
@ -94,8 +104,24 @@ function _draw()
end
function spawn_objects()
local b = Barrel:new(32,32)
add(actors,b)
local width = 32
local height = 32
for x=0,width,1 do
for y=0,height,1 do
local tile = map_manager.get_layer_tile(x,y,1)
if (tile == 3) then
local b = Barrel:new(x*tile_width,y*tile_height)
add(actors,b)
end
end
end
end
function render_layer(layer)
@ -114,9 +140,13 @@ function render_layer(layer)
b:draw()
end
-- for b in all(bullets) do
-- b:draw()
-- end
end
for b in all(bullets) do
b:draw()
end
for p in all(particles) do
p:draw()
end
end
end