summaryrefslogtreecommitdiff
path: root/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/motion.lua
blob: 7fb8fb0d38be49cd3b8bbaebe6eac31fa67b1cdf (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
require 'scripts.game.animation'
require 'scripts.game.jump'
require 'scripts.game.stand'
require 'scripts.game.walk_left'
require 'scripts.game.walk_right'
require 'scripts.game.walk_up'
require 'scripts.game.walk_down'

game.motion = function(metaSprites, character, dt)
  game.animation(character.stand, dt)
  metaSprites.quad = character.stand[character.stand.currentFrame]

  if character.jump.higher > 0 and character.actionA == true then
    game.jump(metaSprites, character, dt)
  end

  if character.actionLeft == true and character.actionRight == false then
    game.walkLeft(metaSprites, character, dt)
  end

  if character.actionRight == true and character.actionLeft == false then
    game.walkRight(metaSprites, character, dt)
  end

  if character.actionLeft == true and character.actionRight == true then
    game.stand(metaSprites, character, dt)
  end

  if character.actionUp == true and character.actionDown == false then
    game.walkUp(metaSprites, character, dt)
  end

  if character.actionDown == true and character.actionUp == false then
    game.walkDown(metaSprites, character, dt)
  end

  if character.actionUp == true and character.actionDown == true then
    game.stand(metaSprites, character, dt)
  end
end