mirror of
https://gitlab.com/MaddoScientisto/cirnofarm.git
synced 2026-06-08 05:45:55 +00:00
Proper actors implementation
This commit is contained in:
parent
4407ce108b
commit
6a7e938a39
5 changed files with 88 additions and 68 deletions
15
src/game.lua
15
src/game.lua
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue