From ef5bce4721d1307200b1335565303a7832f77535 Mon Sep 17 00:00:00 2001 From: "coadde [Márcio Alexandre Silva Delgado]" Date: Sat, 3 Dec 2016 18:39:56 -0300 Subject: Keep the code more KISS - part 2 --- .../scripts/update/limit.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/limit.lua (limited to 'src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/limit.lua') diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/limit.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/limit.lua new file mode 100644 index 0000000..9df7079 --- /dev/null +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/limit.lua @@ -0,0 +1,12 @@ +update.limit = function(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 -- cgit v1.2.3-54-g00ecf