summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2017-02-26 01:31:15 +0100
committerAki <nthirtyone@gmail.com>2017-02-26 01:31:15 +0100
commit55b0cf1a22e4a7e41fe00aa693445d6c4bd0652d (patch)
treee6b51ec7a27dba06c79ec7e7f500a100fd82594a
parent0b287c4750553ab72c04680378487b9d11cd0b43 (diff)
parentf6931cb1bda8c7ec1301f359f28ecc3b1fdb1566 (diff)
downloadroflnauts-55b0cf1a22e4a7e41fe00aa693445d6c4bd0652d.zip
roflnauts-55b0cf1a22e4a7e41fe00aa693445d6c4bd0652d.tar.gz
roflnauts-55b0cf1a22e4a7e41fe00aa693445d6c4bd0652d.tar.bz2
Merge branch 'platforms'
-rw-r--r--platform.lua (renamed from ground.lua)20
-rw-r--r--world.lua4
2 files changed, 12 insertions, 12 deletions
diff --git a/ground.lua b/platform.lua
index 1318c11..908cf73 100644
--- a/ground.lua
+++ b/platform.lua
@@ -1,23 +1,23 @@
--- `Ground`
+-- `Platform`
-- Static platform physical object with a sprite. `Players` can walk on it.
-- Collision category: [1]
-- WHOLE CODE HAS FLAG OF "need a cleanup"
require "animated"
--- Metatable of `Ground`
+-- Metatable of `Platform`
-- nils initialized in constructor
-Ground = {
+Platform = {
body = nil,
shape = nil,
fixture = nil,
world = nil,
}
-Ground.__index = Ground
-setmetatable(Ground, Animated)
+Platform.__index = Platform
+setmetatable(Platform, Animated)
--- Constructor of `Ground`
-function Ground:new (game, world, x, y, shape, sprite, animations)
+-- Constructor of `Platform`
+function Platform:new (game, world, x, y, shape, sprite, animations)
local o = {}
setmetatable(o, self)
o.body = love.physics.newBody(world, x, y)
@@ -46,12 +46,12 @@ function Ground:new (game, world, x, y, shape, sprite, animations)
end
-- Position
-function Ground:getPosition()
+function Platform:getPosition()
return self.body:getPosition()
end
--- Draw of `Ground`
-function Ground:draw (offset_x, offset_y, scale, debug)
+-- Draw of `Platform`
+function Platform:draw (offset_x, offset_y, scale, debug)
-- locals
local offset_x = offset_x or 0
local offset_y = offset_y or 0
diff --git a/world.lua b/world.lua
index f2af28d..9c308b8 100644
--- a/world.lua
+++ b/world.lua
@@ -3,7 +3,7 @@
-- WHOLE CODE HAS FLAG OF "need a cleanup"
-require "ground"
+require "platform"
require "player"
require "cloud"
require "effect"
@@ -126,7 +126,7 @@ end
-- Add new platform to the world
function World:createPlatform(x, y, polygon, sprite, animations)
- table.insert(self.Platforms, Ground:new(self, self.world, x, y, polygon, sprite, animations))
+ table.insert(self.Platforms, Platform:new(self, self.world, x, y, polygon, sprite, animations))
end
-- Add new naut to the world