blob: d1532079ca30e1fae8bf2f83432536cc58e46474 (
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 love.keyboard.isDown(button.left) then
left(dt)
elseif love.keyboard.isDown(button.right) then
right(dt)
elseif love.keyboard.isDown(button.down) then
down(dt)
else
stand(dt)
end
end
function left(dt)
character.bola.acceleration = character.bola.acceleration + dt
if character.bola.position.x >= character.bola.origin.x then
if character.bola.acceleration < 3 then
character.bola.position.x = character.bola.position.x - (character.bola.speed * dt) - character.bola.acceleration
else
character.bola.position.x = character.bola.position.x - (character.bola.speed * dt) - 3
end
end
quad = {
bola = character.bola.walk[math.floor(character.bola.walk.start)]
}
character.bola.scale.x = -1
end
function right(dt)
character.bola.acceleration = character.bola.acceleration + dt
if character.bola.position.x <= windowProfile.mode.width - character.bola.origin.x then
if character.bola.acceleration < 3 then
character.bola.position.x = character.bola.position.x + (character.bola.speed * dt) + character.bola.acceleration
else
character.bola.position.x = character.bola.position.x + (character.bola.speed * dt) + 3
end
end
quad = {
bola = character.bola.walk[math.floor(character.bola.walk.start)]
}
character.bola.scale.x = 1
end
function down(dt)
character.bola.acceleration = 0
transform.bola.origin.y = character.bola.origin.y - character.bola.origin.y
quad = {
bola = character.bola.crouch[1]
}
end
function stand(dt)
character.bola.acceleration = 0
quad = {
bola = character.bola.stand[math.floor(character.bola.stand.start)]
}
end
return motionModule
|