summaryrefslogtreecommitdiff
path: root/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/limit.lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/limit.lua')
-rw-r--r--src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/limit.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/limit.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/limit.lua
new file mode 100644
index 0000000..4cd94f2
--- /dev/null
+++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/limit.lua
@@ -0,0 +1,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