blob: c87b51be24849d337a48cb92b81fdefb85210354 (
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
54
55
56
57
58
59
60
|
local motionModule = {}
function motionModule.motion(dt)
if character.bola.jump.higher > 0 and character.bola.actionA == true then
jump(dt)
else
character.bola.jump.limitButtonJump = false
end
if character.bola.actionLeft == true then
walkLeft(dt)
end
if character.bola.actionRight == true then
walkRight(dt)
end
if character.bola.actionUp == true then
walkUp(dt)
end
if character.bola.actionDown == true then
walkDown(dt)
end
end
function jump(dt)
if character.bola.jump.limitButtonJump == false then
character.bola.jump.higher = character.bola.jump.higher - dt
character.bola.jump.velocity = character.bola.jump.velocity + character.bola.jump.height * (dt / character.bola.jump.higherMax)
-- quad.bola = character.bola.jump[math.floor(character.bola.jump.start)]
end
end
function walkLeft(dt)
character.bola.position.x = character.bola.position.x - (character.bola.velocity * dt)
quad.bola = character.bola.walk[math.floor(character.bola.walk.start)]
character.bola.scale.x = -1
end
function walkRight(dt)
character.bola.position.x = character.bola.position.x + (character.bola.velocity * dt)
quad.bola = character.bola.walk[math.floor(character.bola.walk.start)]
character.bola.scale.x = 1
end
function walkUp(dt)
character.bola.position.y = character.bola.position.y - (character.bola.velocity * dt)
character.bola.jump.ground = character.bola.position.y
quad.bola = character.bola.walk[math.floor(character.bola.walk.start)]
end
function walkDown(dt)
character.bola.position.y = character.bola.position.y + (character.bola.velocity * dt)
character.bola.jump.ground = character.bola.position.y
quad.bola = character.bola.walk[math.floor(character.bola.walk.start)]
end
return motionModule
|