summaryrefslogtreecommitdiffhomepage
path: root/not/Decoration.lua
blob: 80f665341ad0e22a483e4131671e282d49ccc37a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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

-- Initializator 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