blob: 64bc1c7414bd076be4ec56986040316bc068d6e8 (
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
local motionModule = {}
function motionModule.motion(dt)
if love.keyboard.isDown(button.left) then
left(dt)
elseif love.keyboard.isScancodeDown(button.right) then
right(dt)
elseif love.keyboard.isScancodeDown(button.down) then
crouch(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 crouchDown(dt)
character.bola.acceleration = 0
transform.bola.origin.y = character.bola.origin.crouchDown.y[math.floor(character.bola.crouchDown.start)]
quad = {
bola = character.bola.crouchDown[math.floor(character.bola.crouchDown.start)]
}
end
function crouch(dt)
character.bola.acceleration = 0
transform.bola.origin.y = character.bola.origin.crouch.y[math.floor(character.bola.crouch.start)]
quad = {
bola = character.bola.crouch[math.floor(character.bola.crouch.start)]
}
end
function standUp(dt)
character.bola.acceleration = 0
quad = {
bola = character.bola.standUp[math.floor(character.bola.standUp.start)]
}
end
function stand(dt)
character.bola.acceleration = 0
quad = {
bola = character.bola.stand[math.floor(character.bola.stand.start)]
}
end
return motionModule
|