diff options
author | Aki <nthirtyone@gmail.com> | 2017-01-20 12:29:40 +0100 |
---|---|---|
committer | Aki <nthirtyone@gmail.com> | 2017-01-20 12:29:40 +0100 |
commit | 4b2f70d89a53ab03361a51cf970cede2e53cb3f6 (patch) | |
tree | 78db7802d2b343b889f8942d5e1aa9efc4e7cf8f /animated.lua | |
parent | cc48afb0a20d01c8f4098c195239f2ca51fac495 (diff) | |
download | roflnauts-4b2f70d89a53ab03361a51cf970cede2e53cb3f6.zip roflnauts-4b2f70d89a53ab03361a51cf970cede2e53cb3f6.tar.gz roflnauts-4b2f70d89a53ab03361a51cf970cede2e53cb3f6.tar.bz2 |
Clean-ups in Player-Animated relations
Diffstat (limited to 'animated.lua')
-rw-r--r-- | animated.lua | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/animated.lua b/animated.lua index 236b68d..49fcbfa 100644 --- a/animated.lua +++ b/animated.lua @@ -11,6 +11,11 @@ Animated = { } Animated.__index = Animated +-- Cleans up reference to sprite on deletion. +function Animated:delete() + self.sprite = nil +end + -- Sets an Image as a sprite. function Animated:setSprite(image) self.sprite = image @@ -38,9 +43,12 @@ end -- Drawing self to LOVE2D buffer. function Animated:draw(...) - love.graphics.draw(self:getSprite(), self:getQuad(), ...) + local s, q = self:getSprite(), self:getQuad() + if s and q then + love.graphics.setColor(255,255,255,255) + love.graphics.draw(s, q, ...) + end end - -- Animation updating. function Animated:update(dt) self.delay = self.delay - dt |