mirror of
https://gitlab.com/MaddoScientisto/cirnofarm.git
synced 2026-06-09 06:05:54 +00:00
Spawner for barrels
This commit is contained in:
parent
c390096f4f
commit
2507ba301c
4 changed files with 144 additions and 97 deletions
44
src/game.lua
44
src/game.lua
|
|
@ -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
|
||||
Loading…
Add table
Add a link
Reference in a new issue