summaryrefslogtreecommitdiff
path: root/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/motion
diff options
context:
space:
mode:
Diffstat (limited to 'src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/motion')
-rw-r--r--src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/motion/default.lua32
-rw-r--r--src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/motion/jump.lua9
-rw-r--r--src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/motion/stand.lua4
-rw-r--r--src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/motion/walk_down.lua6
-rw-r--r--src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/motion/walk_left.lua6
-rw-r--r--src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/motion/walk_right.lua7
-rw-r--r--src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/motion/walk_up.lua6
7 files changed, 70 insertions, 0 deletions
diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/motion/default.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/motion/default.lua
new file mode 100644
index 0000000..d260891
--- /dev/null
+++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/motion/default.lua
@@ -0,0 +1,32 @@
+update.motion = function(dt)
+ game.animation(character.bola.stand, dt)
+ metaSprites.bola.quad = character.bola.stand[character.bola.stand.currentFrame]
+
+ if character.bola.jump.higher > 0 and character.bola.actionA == true then
+ jump(dt)
+ end
+
+ if character.bola.actionLeft == true and character.bola.actionRight == false then
+ walkLeft(dt)
+ end
+
+ if character.bola.actionRight == true and character.bola.actionLeft == false then
+ walkRight(dt)
+ end
+
+ if character.bola.actionLeft == true and character.bola.actionRight == true then
+ stand(dt)
+ end
+
+ if character.bola.actionUp == true and character.bola.actionDown == false then
+ walkUp(dt)
+ end
+
+ if character.bola.actionDown == true and character.bola.actionUp == false then
+ walkDown(dt)
+ end
+
+ if character.bola.actionUp == true and character.bola.actionDown == true then
+ stand(dt)
+ end
+end
diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/motion/jump.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/motion/jump.lua
new file mode 100644
index 0000000..1005a53
--- /dev/null
+++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/motion/jump.lua
@@ -0,0 +1,9 @@
+function jump(dt)
+ if character.bola.jump.limitButtonJump == false then
+ character.bola.jump.higher = character.bola.jump.higher - dt
+ character.bola.jump.velocity = character.bola.jump.velocity + character.bola.jump.height * (dt / character.bola.jump.higherMax)
+
+ -- game.animation(character.bola.jump, dt)
+ -- metaSprites.bola.quad = character.bola.jump[character.bola.jump.currentFrame]
+ end
+end
diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/motion/stand.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/motion/stand.lua
new file mode 100644
index 0000000..04010ce
--- /dev/null
+++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/motion/stand.lua
@@ -0,0 +1,4 @@
+function stand(dt)
+ game.animation(character.bola.stand, dt)
+ metaSprites.bola.quad = character.bola.stand[character.bola.stand.currentFrame]
+end
diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/motion/walk_down.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/motion/walk_down.lua
new file mode 100644
index 0000000..ba393c7
--- /dev/null
+++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/motion/walk_down.lua
@@ -0,0 +1,6 @@
+function walkDown(dt)
+ character.bola.position.y = character.bola.position.y + (character.bola.velocity * dt)
+ character.bola.jump.ground = character.bola.position.y
+ game.animation(character.bola.walk, dt)
+ metaSprites.bola.quad = character.bola.walk[character.bola.walk.currentFrame]
+end
diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/motion/walk_left.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/motion/walk_left.lua
new file mode 100644
index 0000000..17f31f3
--- /dev/null
+++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/motion/walk_left.lua
@@ -0,0 +1,6 @@
+function walkLeft(dt)
+ character.bola.position.x = character.bola.position.x - (character.bola.velocity * dt)
+ game.animation(character.bola.walk, dt)
+ metaSprites.bola.quad = character.bola.walk[character.bola.walk.currentFrame]
+ character.bola.scale.x = -1
+end
diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/motion/walk_right.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/motion/walk_right.lua
new file mode 100644
index 0000000..712c680
--- /dev/null
+++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/motion/walk_right.lua
@@ -0,0 +1,7 @@
+function walkRight(dt)
+ character.bola.position.x = character.bola.position.x + (character.bola.velocity * dt)
+ game.animation(character.bola.walk, dt)
+ metaSprites.bola.quad = character.bola.walk[character.bola.walk.currentFrame]
+ character.bola.scale.x = 1
+end
+
diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/motion/walk_up.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/motion/walk_up.lua
new file mode 100644
index 0000000..a8bd29b
--- /dev/null
+++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/motion/walk_up.lua
@@ -0,0 +1,6 @@
+function walkUp(dt)
+ character.bola.position.y = character.bola.position.y - (character.bola.velocity * dt)
+ character.bola.jump.ground = character.bola.position.y
+ game.animation(character.bola.walk, dt)
+ metaSprites.bola.quad = character.bola.walk[character.bola.walk.currentFrame]
+end