From b14d4608dc921f882067c43c71fcf04db7b2f794 Mon Sep 17 00:00:00 2001 From: Aki Date: Fri, 26 May 2017 22:44:00 +0200 Subject: Rest of entities moved to new oop module; tested --- not/Decoration.lua | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) (limited to 'not/Decoration.lua') diff --git a/not/Decoration.lua b/not/Decoration.lua index 9dc2bdd..97524f5 100644 --- a/not/Decoration.lua +++ b/not/Decoration.lua @@ -1,26 +1,15 @@ +require "not.Entity" + --- `Decoration` -- Positioned sprite used to decorate maps with additional graphics. -Decoration = { - world = --[[not.World]]nil, - x = 0, - y = 0 -} +Decoration = Entity:extends() --- `Decoration` is a child of `Sprite`. -require "not.Sprite" -Decoration.__index = Decoration -setmetatable(Decoration, Sprite) +Decoration.x = 0 +Decoration.y = 0 -- Constructor of `Decoration`. -function Decoration:new (x, y, imagePath) - local o = setmetatable({}, self) - o:init(x, y, imagePath) - return o -end - --- Initializer of `Decoration`. -function Decoration:init (x, y, imagePath) - Sprite.init(self, imagePath) +function Decoration:new (x, y, world, imagePath) + Decoration.__super.new(self, world, imagePath) self:setPosition(x, y) end @@ -30,4 +19,6 @@ function Decoration:getPosition () end function Decoration:setPosition (x, y) self.x, self.y = x, y -end \ No newline at end of file +end + +return Decoration -- cgit v1.1