blob: 8667ff669847637a0f7888058ef2f0b8bb7e3231 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
game.animation = function(character, dt)
character.elapsedTime = character.elapsedTime + dt
if character.elapsedTime > (1 / character.fps) then
--[[ if character.loop > 0 then
if loopCounter == nil then
character.currentFrame = 1
loopCounter = 1
elseif loopCounter < loop then
character.currentFrame = 1
loopCounter = loopCounter + 1
else
character.currentFrame = # character
end
elseif character.loop == 0 or character.loop == false then
character.currentFrame = # character
elseif character.loop == -1 or character.loop == true then
character.currentFrame = 1
end
]]
if character.currentFrame < # character then
character.currentFrame = character.currentFrame + 1
else
character.currentFrame = 1
end
character.elapsedTime = 0
end
end
|