diff options
author | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2016-11-27 18:05:36 -0300 |
---|---|---|
committer | coadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu> | 2016-11-28 12:25:57 -0300 |
commit | 65bedc623f667e9b218b5dd5193433d5599fa1ff (patch) | |
tree | 1aa3b21fb29e9aa624b7e581651d1d2570510006 /src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/limit.lua | |
parent | e5f5e6b27405bf70749468ba7d88f5fd8dd9c822 (diff) |
Add walking up and walking down again, modularize motion limitation and fix jumping
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.lua | 16 |
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 |