Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion modules/NobleSprite.lua
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,17 @@ function NobleSprite:init(__view, __viewIsSpritesheet, __singleState, __singleSt

end

function NobleSprite:update()
if (self.animation ~= nil) then
self:markDirty()
end
end

function NobleSprite:draw(__x, __y)
if (self.animation ~= nil) then
local x = __x or 0
local y = __y or 0
self.animation:draw(x, y)
self:markDirty()
end
end

Expand All @@ -114,13 +119,17 @@ end
--- This will disable the update loop for this NobleSprite, which also causes its Noble.Animation to pause.
function NobleSprite:pause()
self:setUpdatesEnabled(false)
if (self.animation ~= nil) then
self:markDirty()
end
end

--- This will disable the update loop for this NobleSprite, and also reset its Noble.Animation (if it exists) to the first frame of its current state.
function NobleSprite:stop()
self:setUpdatesEnabled(false)
if (self.animation ~= nil) then
self.animation.currentFrame = self.animation.current.startFrame
self:markDirty()
end
end

Expand Down