29 lines
452 B
Lua
29 lines
452 B
Lua
local BaseWorld = Object:extend()
|
|
|
|
function BaseWorld:new(scene)
|
|
self.scene = scene
|
|
|
|
self.actors = {}
|
|
end
|
|
|
|
function BaseWorld:registerActor(actor)
|
|
table.insert(self.actors, actor)
|
|
end
|
|
|
|
function BaseWorld:countActors()
|
|
return #self.actors
|
|
end
|
|
|
|
function BaseWorld:update(dt)
|
|
for i,v in ipairs(self.actors) do
|
|
v:update(dt)
|
|
end
|
|
end
|
|
|
|
function BaseWorld:draw(dt)
|
|
for i,v in ipairs(self.actors) do
|
|
v:draw(dt)
|
|
end
|
|
end
|
|
|
|
return BaseWorld
|