blob: 42fd2d94b11cf5c42044d356ab29091acf7d5eb2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
game.gravity = function(character, dt)
if character.jump.velocity ~= 0 then
character.jump.isJumping = true
character.position.y = character.position.y + (character.jump.velocity * dt)
character.jump.velocity = character.jump.velocity - (character.gravity * dt)
end
if character.position.y > character.jump.ground then
character.jump.velocity = 0
character.position.y = character.jump.ground
character.jump.higher = character.jump.higherMax
character.jump.limitButtonJump = false
character.jump.isJumping = false
character.actionA = false
if love.keyboard.isScancodeDown(button.up) then
character.actionUp = true
elseif love.keyboard.isScancodeDown(button.down) then
character.actionDown = true
end
end
end
|