diff --git a/core/assets/musica.mp3 b/core/assets/musica.mp3 new file mode 100644 index 0000000..19d3897 Binary files /dev/null and b/core/assets/musica.mp3 differ diff --git a/core/bin/main/com/mygdx/game/MyGdxGame.class b/core/bin/main/com/mygdx/game/MyGdxGame.class index df32f91..23e3e5d 100644 Binary files a/core/bin/main/com/mygdx/game/MyGdxGame.class and b/core/bin/main/com/mygdx/game/MyGdxGame.class differ diff --git a/core/bin/main/menus/MenuOpcions.class b/core/bin/main/menus/MenuOpcions.class index 0d23d77..a9bc287 100644 Binary files a/core/bin/main/menus/MenuOpcions.class and b/core/bin/main/menus/MenuOpcions.class differ diff --git a/core/src/com/mygdx/game/MyGdxGame.java b/core/src/com/mygdx/game/MyGdxGame.java index a8f115d..cfb33e0 100644 --- a/core/src/com/mygdx/game/MyGdxGame.java +++ b/core/src/com/mygdx/game/MyGdxGame.java @@ -2,12 +2,12 @@ package com.mygdx.game; import com.badlogic.gdx.ApplicationAdapter; import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.audio.Music; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.SpriteBatch; -import menus.Battle; import menus.Fin; import menus.Menu; import menus.MenuInicio; @@ -27,8 +27,12 @@ public class MyGdxGame extends ApplicationAdapter { int aux=menuSeleccionado; boolean fin=false; Color color; + Music musica; @Override public void create () { + this.musica=Gdx.audio.newMusic(Gdx.files.internal("musica.mp3")); + musica.play(); + musica.setLooping(true); this.color=new Color(); color.set(0.5f, 0, 0, 1); batch = new SpriteBatch(); @@ -55,6 +59,7 @@ public class MyGdxGame extends ApplicationAdapter { @Override public void dispose () { + musica.dispose(); batch.dispose(); font.dispose(); Menu.menus.get(this.menuSeleccionado).dispose(); diff --git a/core/src/menus/Battle.java b/core/src/menus/Battle.java index f20f9c9..f741e90 100644 --- a/core/src/menus/Battle.java +++ b/core/src/menus/Battle.java @@ -37,18 +37,18 @@ public class Battle extends Menu{ public int draw(SpriteBatch batch, float delta) { batch.draw(suelo,0,0); if (Gdx.input.isKeyPressed(Input.Keys.E)) { - p1.cambiarEstado(p1.MEDIO); + p1.cambiarEstado(Personaje.MEDIO); }else if(Gdx.input.isKeyPressed(Input.Keys.W)){ - p1.cambiarEstado(p1.ALTO); + p1.cambiarEstado(Personaje.ALTO); }else if(Gdx.input.isKeyPressed(Input.Keys.S)){ - p1.cambiarEstado(p1.BAJO); + p1.cambiarEstado(Personaje.BAJO); }else{ - p1.cambiarEstado(p1.STAND); + p1.cambiarEstado(Personaje.STAND); } contador+=delta; if(contador>0.5) { if(cambio) { - p2.cambiarEstado((int)Math.round(Math.random()*2)); + p2.cambiarEstado((int)Math.round(Math.random()*3)); cambio=false; } if(finalRound) { @@ -64,7 +64,7 @@ public class Battle extends Menu{ } }else { - p2.cambiarEstado(p2.STAND); + p2.cambiarEstado(Personaje.STAND); } p1.mover(); p2.mover(); @@ -87,11 +87,11 @@ public class Battle extends Menu{ @Override int darSeleccionado() { if(p1.muerto()) { - Menu.menus.remove(Menu.BATTLE); + //Menu.menus.remove(Menu.BATTLE); return Menu.FINAL; }else if(p2.muerto()) { if(finalRound) { - Menu.menus.remove(Menu.BATTLE); + //Menu.menus.remove(Menu.BATTLE); return Menu.FINAL; }else { this.p1=new Personaje(p1.toString(), false); diff --git a/core/src/menus/Battle2.java b/core/src/menus/Battle2.java index 2f5c674..d93316b 100644 --- a/core/src/menus/Battle2.java +++ b/core/src/menus/Battle2.java @@ -62,7 +62,7 @@ public class Battle2 extends Menu{ @Override int darSeleccionado() { if(p1.muerto()||p2.muerto()) { - Menu.menus.remove(Menu.BATTLE); + //Menu.menus.remove(Menu.BATTLE); return Menu.FINAL; } diff --git a/core/src/menus/Fin.java b/core/src/menus/Fin.java index a85cba7..edf63f0 100644 --- a/core/src/menus/Fin.java +++ b/core/src/menus/Fin.java @@ -3,18 +3,27 @@ package menus; import com.badlogic.gdx.graphics.g2d.SpriteBatch; public class Fin extends Menu{ - + float contador=0; @Override public int draw(SpriteBatch batch, float delta) { try { - Thread.sleep(5000); + Thread.sleep(400); + Menu.menus.get(BATTLE).draw(batch, delta); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } - return Menu.INICIAL; + if(contador>1) { + Menu.menus.remove(Menu.BATTLE); + return Menu.INICIAL; + }else { + contador++; + return Menu.FINAL; + } + + } - + @Override int darSeleccionado() { // TODO Auto-generated method stub diff --git a/core/src/menus/MenuOpcions.java b/core/src/menus/MenuOpcions.java index 477e765..6b71ef1 100644 --- a/core/src/menus/MenuOpcions.java +++ b/core/src/menus/MenuOpcions.java @@ -20,7 +20,6 @@ public class MenuOpcions extends Menu{ this.opcion1=0; this.opcion2=0; this.n_opciones=2; - this.pres=true; this.local=Menu.OPCIONES; } @@ -109,6 +108,8 @@ public class MenuOpcions extends Menu{ } int darSeleccionado() { + Menu.menus.get(Menu.INICIAL).pres=true; + this.pres=true; return Menu.INICIAL; } diff --git a/core/src/utilidades/Ataque.java b/core/src/utilidades/Ataque.java index b067aa0..6fd6873 100644 --- a/core/src/utilidades/Ataque.java +++ b/core/src/utilidades/Ataque.java @@ -3,7 +3,9 @@ package utilidades; public class Ataque { int tipo; float valor; + boolean esquivado; public Ataque(int tipo, float valor) { + esquivado=false; this.tipo=tipo; this.valor=valor; } @@ -17,6 +19,7 @@ public class Ataque { switch(this.tipo) { case Personaje.ALTO: if(tipo==Personaje.BAJO) { + this.esquivado=true; return 0; }else { return valor*2; diff --git a/core/src/utilidades/Bot.java b/core/src/utilidades/Bot.java index 606e241..29e58df 100644 --- a/core/src/utilidades/Bot.java +++ b/core/src/utilidades/Bot.java @@ -19,14 +19,13 @@ public class Bot extends Personaje{ } if (mover == 2) { if((!this.position)) { - if(y>0)this.y--; + if(y>0)this.y-=2; }else { if((!this.caja.overlaps(enemigo))) { - this.y--; + this.y-=2; } } } - System.out.println(y); if(position) { this.caja.setPosition(x, y+120); }else { diff --git a/core/src/utilidades/Personaje.java b/core/src/utilidades/Personaje.java index 1a140ed..490f861 100644 --- a/core/src/utilidades/Personaje.java +++ b/core/src/utilidades/Personaje.java @@ -26,6 +26,8 @@ public class Personaje { int y; float contadorCombo; float tempCombo; + float contadorComboDefensa; + float tempComboDefensa; private float vida; Rectangle caja; Rectangle enemigo; @@ -156,7 +158,12 @@ public class Personaje { public void recivir(Ataque ataque) { if(this.caja.overlaps(enemigo)) { - this.vida-=ataque.danio(this.estado)/this.coeficienteDef; + if(this.tempComboDefensa>1) { + this.vida-=ataque.danio(this.estado)/(this.coeficienteDef*2); + }else { + this.vida-=ataque.danio(this.estado)/this.coeficienteDef; + if(ataque.esquivado)this.tempComboDefensa++; + } } } @@ -213,17 +220,39 @@ public class Personaje { }else { this.actual.draw(batch, this.y, this.x); } + this.dibujarBoost(batch, delta); + } + + void dibujarBoost(SpriteBatch batch, float delta) { batch.end(); if(tempCombo>0) { Gdx.gl.glEnable(GL20.GL_BLEND); Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA); shapeDrawer.begin(ShapeType.Filled); shapeDrawer.setColor(1f,0f,0f,0.3f); - shapeDrawer.circle(70+(1.35f*y), x+80, 80); + if(this.position) { + shapeDrawer.circle((y*1.1f)+200, x+80, 80); + }else { + shapeDrawer.circle((y*1.1f)+70, x+80, 80); + } shapeDrawer.end(); Gdx.gl.glDisable(GL20.GL_BLEND); tempCombo-=delta; } + if(tempComboDefensa>0) { + Gdx.gl.glEnable(GL20.GL_BLEND); + Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA); + shapeDrawer.begin(ShapeType.Filled); + shapeDrawer.setColor(0f,0f,1f,0.3f); + if(this.position) { + shapeDrawer.circle((y*1.1f)+200, x+80, 80); + }else { + shapeDrawer.circle((y*1.1f)+70, x+80, 80); + } + shapeDrawer.end(); + Gdx.gl.glDisable(GL20.GL_BLEND); + tempComboDefensa-=delta; + } batch.begin(); } diff --git a/desktop/bin/main/musica.mp3 b/desktop/bin/main/musica.mp3 new file mode 100644 index 0000000..19d3897 Binary files /dev/null and b/desktop/bin/main/musica.mp3 differ