summaryrefslogtreecommitdiffhomepage
path: root/not/Decoration.lua
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2017-04-09 22:07:04 +0200
committerAki <nthirtyone@gmail.com>2017-04-09 22:07:04 +0200
commit0dd01913fe0eefc7ba4bc0797877f40fdedf9315 (patch)
tree8d270eb07f589d2487b3ce66d4865e5a4718042a /not/Decoration.lua
parent55b0cf1a22e4a7e41fe00aa693445d6c4bd0652d (diff)
parenta03c1125f10fbbad253a0efc4727072fcbd55345 (diff)
downloadroflnauts-0dd01913fe0eefc7ba4bc0797877f40fdedf9315.zip
roflnauts-0dd01913fe0eefc7ba4bc0797877f40fdedf9315.tar.gz
roflnauts-0dd01913fe0eefc7ba4bc0797877f40fdedf9315.tar.bz2
Merge branch 'com'
Diffstat (limited to 'not/Decoration.lua')
-rw-r--r--not/Decoration.lua33
1 files changed, 33 insertions, 0 deletions
diff --git a/not/Decoration.lua b/not/Decoration.lua
new file mode 100644
index 0000000..9dc2bdd
--- /dev/null
+++ b/not/Decoration.lua
@@ -0,0 +1,33 @@
+--- `Decoration`
+-- Positioned sprite used to decorate maps with additional graphics.
+Decoration = {
+ world = --[[not.World]]nil,
+ x = 0,
+ y = 0
+}
+
+-- `Decoration` is a child of `Sprite`.
+require "not.Sprite"
+Decoration.__index = Decoration
+setmetatable(Decoration, Sprite)
+
+-- 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)
+ self:setPosition(x, y)
+end
+
+-- Position-related methods.
+function Decoration:getPosition ()
+ return self.x, self.y
+end
+function Decoration:setPosition (x, y)
+ self.x, self.y = x, y
+end \ No newline at end of file