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.
14
Animation = Sprite:extend
14
Animation = Sprite:extend{
16
15
-- Property: paused
17
16
-- Set this to true to freeze the animation on the current frame.
204
203
if not self.visible or not self.image or self.alpha <= 0 then return end
206
205
-- if our image changed, update the quad
208
207
if self._set.image ~= self.image then
209
208
self:updateQuad()
212
211
-- set color if needed
214
213
local colored = self.alpha ~= 1 or self.tint[1] ~= 1 or self.tint[2] ~= 1 or self.tint[3] ~= 1
225
224
if self.flipX then scaleX = scaleX * -1 end
226
225
if self.flipY then scaleY = scaleY * -1 end
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)
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)
237
233
love.graphics.setColor(255, 255, 255, 255)
241
237
__tostring = function (self)
242
local result = 'Animation (x: ' .. tostring(self.x) .. ', y: ' .. tostring(self.y) ..
243
', w: ' .. tostring(self.width) .. ', h: ' .. tostring(self.height) .. ', '
238
local result = 'Animation (x: ' .. self.x .. ', y: ' .. self.y ..
239
', w: ' .. self.width .. ', h: ' .. self.height .. ', '
245
241
if self.currentName then
246
242
result = result .. 'playing ' .. self.currentName .. ', '
249
result = result .. ' frame ' .. tostring(self.currentFrame) .. ', '
245
result = result .. ' frame ' .. self.currentFrame .. ', '
251
247
if self.active then
252
248
result = result .. 'active, '