7
7
-- Event: onEndSequence
8
8
-- Called whenever an animation sequence ends. It is passed the name
9
9
-- of the sequence that just ended.
13
Animation = Sprite:extend{
14
Animation = Sprite:extend
14
16
-- Property: paused
15
17
-- Set this to true to freeze the animation on the current frame.
203
204
if not self.visible or not self.image or self.alpha <= 0 then return end
205
206
-- if our image changed, update the quad
207
208
if self._set.image ~= self.image then
208
209
self:updateQuad()
211
212
-- set color if needed
213
214
local colored = self.alpha ~= 1 or self.tint[1] ~= 1 or self.tint[2] ~= 1 or self.tint[3] ~= 1
224
225
if self.flipX then scaleX = scaleX * -1 end
225
226
if self.flipY then scaleY = scaleY * -1 end
227
love.graphics.drawq(self._imageObj, self._quad, x + self.width / 2, y + self.height / 2, self.rotation,
228
scaleX, scaleY, self.width / 2, self.height / 2)
228
local origX = self.origin.x or (self.width / 2)
229
local origY = self.origin.y or (self.height / 2)
231
love.graphics.draw(self._imageObj, self._quad, x + origX, y + origY, self.rotation,
232
scaleX, scaleY, origX, origY)
233
237
love.graphics.setColor(255, 255, 255, 255)
237
241
__tostring = function (self)
238
local result = 'Animation (x: ' .. self.x .. ', y: ' .. self.y ..
239
', w: ' .. self.width .. ', h: ' .. self.height .. ', '
242
local result = 'Animation (x: ' .. tostring(self.x) .. ', y: ' .. tostring(self.y) ..
243
', w: ' .. tostring(self.width) .. ', h: ' .. tostring(self.height) .. ', '
241
245
if self.currentName then
242
246
result = result .. 'playing ' .. self.currentName .. ', '
245
result = result .. ' frame ' .. self.currentFrame .. ', '
249
result = result .. ' frame ' .. tostring(self.currentFrame) .. ', '
247
251
if self.active then
248
252
result = result .. 'active, '