blob: a8c927a85b1493098c57dd9fd32de63d04c2843f (
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
|
local gravityModule = {}
function gravityModule.motion(dt)
gravity(dt)
end
function gravity(dt)
if character.bola.jump.velocity ~= 0 then
character.bola.jump.isJumping = true
character.bola.position.y = character.bola.position.y + (character.bola.jump.velocity * dt)
character.bola.jump.velocity = character.bola.jump.velocity - (character.bola.gravity * dt)
end
if character.bola.position.y > character.bola.jump.ground then
character.bola.jump.velocity = 0
character.bola.position.y = character.bola.jump.ground
character.bola.jump.higher = character.bola.jump.higherMax
character.bola.jump.limitButtonJump = false
character.bola.jump.isJumping = false
character.bola.actionA = false
if love.keyboard.isScancodeDown(button.up) then
character.bola.actionUp = true
elseif love.keyboard.isScancodeDown(button.down) then
character.bola.actionDown = true
end
end
end
return gravityModule
|