summaryrefslogtreecommitdiff
path: root/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/limit.lua
blob: 4cd94f2dec64016a00a80312c1eb0574c66a0de9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
game.limit = function(character, dt)
  if character.position.x <= character.origin.x then
    character.position.x = character.origin.x
  elseif character.position.x >= windowProfile.mode.width - character.origin.x then
    character.position.x = windowProfile.mode.width - character.origin.x
  end

  if character.position.y <= character.origin.y then
    character.position.y = character.origin.y
  elseif character.position.y >= windowProfile.mode.height - character.origin.y then
    character.position.y = windowProfile.mode.height - character.origin.y
  end
end