summaryrefslogtreecommitdiff
path: root/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/limit.lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/limit.lua')
-rw-r--r--src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/limit.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/limit.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/limit.lua
new file mode 100644
index 0000000..5bc2f2f
--- /dev/null
+++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/limit.lua
@@ -0,0 +1,16 @@
+local limitModule = {}
+
+function limitModule.motion(dt)
+ if character.bola.position.x <= character.bola.origin.x then
+ character.bola.position.x = character.bola.origin.x
+ elseif character.bola.position.x >= windowProfile.mode.width - character.bola.origin.x then
+ character.bola.position.x = windowProfile.mode.width - character.bola.origin.x
+ end
+ if character.bola.position.y <= character.bola.origin.y then
+ character.bola.position.y = character.bola.origin.y
+ elseif character.bola.position.y >= windowProfile.mode.height - character.bola.origin.y then
+ character.bola.position.y = windowProfile.mode.height - character.bola.origin.y
+ end
+end
+
+return limitModule