modules/world: add comment to make structure more explicit

This commit is contained in:
Kazhnuz 2019-04-07 13:22:23 +02:00
parent 696a568d0c
commit 171ff007e9

View file

@ -1,11 +1,17 @@
local BaseWorld = Object:extend() local BaseWorld = Object:extend()
-- INIT FUNCTIONS
-- All functions to init the world and the map
function BaseWorld:new(scene) function BaseWorld:new(scene)
self.scene = scene self.scene = scene
self.actors = {} self.actors = {}
end end
-- ACTOR MANAGEMENT FUNCTIONS
-- Basic function to handle actors
function BaseWorld:registerActor(actor) function BaseWorld:registerActor(actor)
table.insert(self.actors, actor) table.insert(self.actors, actor)
end end
@ -14,12 +20,18 @@ function BaseWorld:countActors()
return #self.actors return #self.actors
end end
-- UPDATE FUNCTIONS
-- All update functions
function BaseWorld:update(dt) function BaseWorld:update(dt)
for i,v in ipairs(self.actors) do for i,v in ipairs(self.actors) do
v:update(dt) v:update(dt)
end end
end end
-- DRAW FUNCTIONS
-- All function to draw the map, world and actors
function BaseWorld:draw(dt) function BaseWorld:draw(dt)
for i,v in ipairs(self.actors) do for i,v in ipairs(self.actors) do
v:draw(dt) v:draw(dt)