diff options
author | Aki <nthirtyone@gmail.com> | 2017-08-13 02:26:55 +0200 |
---|---|---|
committer | Aki <nthirtyone@gmail.com> | 2017-08-13 02:26:55 +0200 |
commit | b1cf14d64a2d3e28683db87190c4b2c7799c259d (patch) | |
tree | e45dac5cc6ce5265e3e3e2c914eb7cc92a820b8b /not/Platform.lua | |
parent | 0dd01913fe0eefc7ba4bc0797877f40fdedf9315 (diff) | |
parent | ed62b573417bdc85bec616f6016846b02de4c906 (diff) | |
download | roflnauts-b1cf14d64a2d3e28683db87190c4b2c7799c259d.zip roflnauts-b1cf14d64a2d3e28683db87190c4b2c7799c259d.tar.gz roflnauts-b1cf14d64a2d3e28683db87190c4b2c7799c259d.tar.bz2 |
Merge branch 'multi'maps
Diffstat (limited to 'not/Platform.lua')
-rw-r--r-- | not/Platform.lua | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/not/Platform.lua b/not/Platform.lua index 3748c47..a4b3a59 100644 --- a/not/Platform.lua +++ b/not/Platform.lua @@ -1,29 +1,14 @@ +require "not.PhysicalBody" + --- `Platform` -- Static platform physical object with a sprite. `Players` can walk on it. -- Collision category: [1] --- TODO: reformat code to follow new code patterns --- TODO: comment uncovered code parts -Platform = { - world = --[[not.World]]nil, -} - --- `Platform` is a child of `PhysicalBody`. -require "not.PhysicalBody" -Platform.__index = Platform -setmetatable(Platform, PhysicalBody) +Platform = PhysicalBody:extends() -- Constructor of `Platform` -function Platform:new (animations, shape, game, x, y, sprite) - local o = setmetatable({}, self) - o:init(animations, shape, game, x, y, sprite) - return o -end - --- Initializer of `Platform`. -function Platform:init (animations, shape, world, x, y, imagePath) - PhysicalBody.init(self, world, x, y, imagePath) +function Platform:new (animations, shape, x, y, world, imagePath) + Platform.__super.new(self, x, y, world, imagePath) self:setAnimationsList(animations) - self.world = world -- Create table of shapes if single shape is passed. if type(shape[1]) == "number" then shape = {shape} @@ -34,4 +19,6 @@ function Platform:init (animations, shape, world, x, y, imagePath) fixture:setCategory(1) fixture:setFriction(0.2) end -end
\ No newline at end of file +end + +return Platform |