Mercurial > vanillian
diff sprite.lua @ 0:716ff40413d2
initial commit
| author | Radomir Dopieralski <sheep-devel@sheep.art.pl> |
|---|---|
| date | Sat, 15 Dec 2012 10:23:11 +0100 |
| parents | |
| children | 0c46edeabad6 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sprite.lua Sat Dec 15 10:23:11 2012 +0100 @@ -0,0 +1,26 @@ +local Sprite = {} +local Sprite_mt = { __index = Sprite } + +local function newSprite(x, y, image, animation) + local sprite = setmetatable({ + x = x, + y = y, + image = image, + animation = animation, + }, Sprite_mt) + return sprite +end + +function Sprite:draw() + self.animation:draw(self.image, math.floor(self.x), math.floor(self.y)) +end + +function Sprite:update(dt) + self.animation:update(dt) +end + +local sprite = { + newSprite = newSprite, +} + +return sprite
