diff options
author | coadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu> | 2016-12-03 18:39:56 -0300 |
---|---|---|
committer | coadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu> | 2016-12-03 18:39:56 -0300 |
commit | ef5bce4721d1307200b1335565303a7832f77535 (patch) | |
tree | f1840a3e31dcf4cda066d5f377edb4ff2af31622 /src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/limit.lua | |
parent | 1a9e17acb3a65a98305d19363f6b4e7185356c74 (diff) |
Keep the code more KISS - part 2
Diffstat (limited to 'src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/limit.lua')
-rw-r--r-- | src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/limit.lua | 12 |
1 files changed, 12 insertions, 0 deletions
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 |