summaryrefslogtreecommitdiffhomepage
path: root/world.lua
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2017-02-08 19:18:25 +0100
committerAki <nthirtyone@gmail.com>2017-02-08 19:18:25 +0100
commita7b1bcc6872579b0ed8dbce399352d3afca1a80f (patch)
treecad837f35cc495d42385c3238de06804e8d68d07 /world.lua
parent939ef3d25ec3dadba9e86b04ae1e294e789175d0 (diff)
parentf44ce392bc511fdfd24c54a5ee24b09f8ff6836f (diff)
downloadroflnauts-a7b1bcc6872579b0ed8dbce399352d3afca1a80f.zip
roflnauts-a7b1bcc6872579b0ed8dbce399352d3afca1a80f.tar.gz
roflnauts-a7b1bcc6872579b0ed8dbce399352d3afca1a80f.tar.bz2
Merge branch 'animations'
Diffstat (limited to 'world.lua')
-rw-r--r--world.lua14
1 files changed, 10 insertions, 4 deletions
diff --git a/world.lua b/world.lua
index b01948e..30359fd 100644
--- a/world.lua
+++ b/world.lua
@@ -93,7 +93,7 @@ function World:loadMap(name)
self.map = map()
-- Platforms
for _,platform in pairs(self.map.platforms) do
- self:createPlatform(platform.x, platform.y, platform.shape, platform.sprite)
+ self:createPlatform(platform.x, platform.y, platform.shape, platform.sprite, platform.animations)
end
-- Decorations
for _,decoration in pairs(self.map.decorations) do
@@ -125,8 +125,8 @@ function World:getSpawnPosition()
end
-- Add new platform to the world
-function World:createPlatform(x, y, polygon, sprite)
- table.insert(self.Platforms, Ground:new(self, self.world, x, y, polygon, sprite))
+function World:createPlatform(x, y, polygon, sprite, animations)
+ table.insert(self.Platforms, Ground:new(self, self.world, x, y, polygon, sprite, animations))
end
-- Add new naut to the world
@@ -231,10 +231,16 @@ function World:update(dt)
self.world:update(dt)
-- Camera
self.camera:update(dt)
- -- Nauts
+ -- Engine world: Nauts, Grounds (kek) and Decorations - all Animateds (top kek)
for _,naut in pairs(self.Nauts) do
naut:update(dt)
end
+ for _,platform in pairs(self.Platforms) do
+ platform:update(dt)
+ end
+ for _,decoration in pairs(self.Decorations) do
+ decoration:update(dt)
+ end
-- Clouds
if self.map.clouds then
-- generator