From bd22a09dc862ac5480426bfd5e0311a97b6cfa77 Mon Sep 17 00:00:00 2001 From: Aki Date: Wed, 1 Mar 2017 21:31:11 +0100 Subject: Rename: Animated -> Sprite Rename: getSprite, setSprite -> getImage, setImage --- decoration.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'decoration.lua') diff --git a/decoration.lua b/decoration.lua index 3ca6f76..ffb007d 100644 --- a/decoration.lua +++ b/decoration.lua @@ -5,11 +5,11 @@ Decoration = { y = 0 } Decoration.__index = Decoration -setmetatable(Decoration, Animated) +setmetatable(Decoration, Sprite) function Decoration:new(x, y, sprite) local o = {} setmetatable(o, self) - o.sprite = love.graphics.newImage(sprite) + o:setImage(love.graphics.newImage(sprite)) o:setPosition(x,y) return o end @@ -29,5 +29,5 @@ function Decoration:draw(offset_x, offset_y, scale) local draw_x = (math.floor(x) + offset_x) * scale local draw_y = (math.floor(y) + offset_y) * scale -- draw - Animated.draw(self, draw_x, draw_y, 0, scale, scale) + Sprite.draw(self, draw_x, draw_y, 0, scale, scale) end \ No newline at end of file -- cgit v1.1 From 84278ed41f61c586dbb38dd99c45ee33e2f58c77 Mon Sep 17 00:00:00 2001 From: Aki Date: Thu, 16 Mar 2017 19:05:50 +0100 Subject: Moved ? -> not.?; Renamed Player -> Hero --- decoration.lua | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 decoration.lua (limited to 'decoration.lua') diff --git a/decoration.lua b/decoration.lua deleted file mode 100644 index ffb007d..0000000 --- a/decoration.lua +++ /dev/null @@ -1,33 +0,0 @@ -Decoration = { - world = nil, - sprite = nil, - x = 0, - y = 0 -} -Decoration.__index = Decoration -setmetatable(Decoration, Sprite) -function Decoration:new(x, y, sprite) - local o = {} - setmetatable(o, self) - o:setImage(love.graphics.newImage(sprite)) - o:setPosition(x,y) - return o -end -function Decoration:setPosition(x, y) - self.x, self.y = x, y -end -function Decoration:getPosition() - return self.x, self.y -end -function Decoration:draw(offset_x, offset_y, scale) - -- locals - local offset_x = offset_x or 0 - local offset_y = offset_y or 0 - local scale = scale or 1 - local x, y = self:getPosition() - -- pixel grid - local draw_x = (math.floor(x) + offset_x) * scale - local draw_y = (math.floor(y) + offset_y) * scale - -- draw - Sprite.draw(self, draw_x, draw_y, 0, scale, scale) -end \ No newline at end of file -- cgit v1.1