blob: e3c714e1c05854fc52898e54f434cf1cba5ffa74 (
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
local animationModule = {}
function animationModule.animation(dt)
character.bola.stand.start = character.bola.stand.start + (dt * character.bola.stand.fps)
character.bola.walk.start = character.bola.walk.start + (dt * character.bola.walk.fps)
character.bola.crouchDown.start = character.bola.crouchDown.start + (dt * character.bola.crouchDown.fps)
character.bola.crouch.start = character.bola.crouch.start + (dt * character.bola.crouch.fps)
character.bola.standUp.start = character.bola.standUp.start + (dt * character.bola.standUp.fps)
frames = {
bola = require 'scripts.bola.frames'
}
game = {
animation = function(start, frames, loop)
if math.floor(start) > frames then
if loop > 0 then
if loopCounter == nil then
start = 1
loopCounter = 1
elseif loopCounter < loop then
start = 1
loopCounter = loopCounter + 1
else
start = frames
end
elseif loop == 0 then
start = frames
elseif loop == -1 or loop == nil then
start = 1
end
end
return start
end
}
character.bola.stand.start = game.animation(character.bola.stand.start, frames.bola.stand, -1)
character.bola.walk.start = game.animation(character.bola.walk.start, frames.bola.walk, -1)
character.bola.crouchDown.start = game.animation(character.bola.crouchDown.start, frames.bola.crouchDown, 0)
character.bola.crouch.start = game.animation(character.bola.crouch.start, frames.bola.crouch, -1)
character.bola.standUp.start = game.animation(character.bola.standUp.start, frames.bola.standUp, 0)
transform = {
bola = {
origin = {
y = character.bola.origin.y
}
}
}
end
return animationModule
|