Proper actors implementation

This commit is contained in:
MaddoScientisto 2024-04-26 11:22:51 +02:00
commit 6a7e938a39
5 changed files with 88 additions and 68 deletions

View file

@ -55,11 +55,13 @@ local cirno = require(make_path("cirno"))
local mouse_debug = require(make_path("mouse_debug"))
local map_manager = require(make_path("map"))
local weapons_manager = require(make_path("weapons"))
local Barrel = require(make_path("barrel"))
tile_width = 16
tile_height = 16
function _init()
spawn_objects()
cirno.init()
end
@ -76,6 +78,8 @@ LAYERS = {
{index=1, name="objects", render=false, render_objects=false, spawn_objects=true}
}
actors = {}
function _draw()
cls(0)
@ -85,6 +89,11 @@ function _draw()
weapons_manager.debug_draw()
end
function spawn_objects()
local b = Barrel:new(32,32)
add(actors,b)
end
function render_layer(layer)
if (layer.render) then
-- todo move function in map manager
@ -96,7 +105,11 @@ function render_layer(layer)
cirno.draw()
weapons_manager.draw()
for b in all(actors) do
b:draw()
end
-- for b in all(bullets) do
-- b:draw()
-- end