From 1c3b48c5335c912b7d9ecada8a4308776df5405b Mon Sep 17 00:00:00 2001 From: groche97 Date: Fri, 21 Feb 2020 14:19:05 +0100 Subject: [PATCH] preparando mas jugadores --- core/src/menus/Battle.java | 10 +++++++++- core/src/menus/Battle2.java | 14 +++++++++++--- core/src/menus/MenuSeleccion.java | 10 +++++++++- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/core/src/menus/Battle.java b/core/src/menus/Battle.java index f741e90..a5058c1 100644 --- a/core/src/menus/Battle.java +++ b/core/src/menus/Battle.java @@ -1,5 +1,7 @@ package menus; +import java.time.LocalTime; + import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Input; import com.badlogic.gdx.graphics.Texture; @@ -16,7 +18,10 @@ public class Battle extends Menu{ float contador; boolean cambio; boolean finalRound; + LocalTime tiempo; + LocalTime aux; public Battle(String np1, String np2) { + tiempo=LocalTime.now(); this.finalRound=false; this.cambio=true; this.p2=new Bot(np2, true); @@ -79,7 +84,10 @@ public class Battle extends Menu{ if(p1.muerto()) { font.draw(batch, "Has perdido", Gdx.graphics.getWidth()/4,Gdx.graphics.getHeight()/2.6f); }else if(p2.muerto()){ - font.draw(batch, "Has ganado", Gdx.graphics.getWidth()/4,Gdx.graphics.getHeight()/2.6f); + String puntos = ""+(aux.getSecond()+this.tiempo.getSecond()); + font.draw(batch, "Has ganado en "+puntos+"s", Gdx.graphics.getWidth()/4,Gdx.graphics.getHeight()/2.6f); + }else { + aux=LocalTime.now(); } return darSeleccionado(); } diff --git a/core/src/menus/Battle2.java b/core/src/menus/Battle2.java index d93316b..b7bd209 100644 --- a/core/src/menus/Battle2.java +++ b/core/src/menus/Battle2.java @@ -1,5 +1,7 @@ package menus; +import java.time.LocalTime; + import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Input; import com.badlogic.gdx.graphics.Texture; @@ -12,8 +14,10 @@ public class Battle2 extends Menu{ Personaje p1; Personaje2 p2; Texture suelo; - + LocalTime tiempo; + LocalTime aux; public Battle2(String np1, String np2) { + this.tiempo=LocalTime.now(); this.p2=new Personaje2(np2, true); this.p1=new Personaje(np1, false); this.p1.setEnemigo(p2.getCaja()); @@ -51,9 +55,13 @@ public class Battle2 extends Menu{ this.p1.draw(batch, delta); this.p2.draw(batch, delta); if(p1.muerto()) { - font.draw(batch, "Ha ganado el jugador 2", Gdx.graphics.getWidth()/4,Gdx.graphics.getHeight()/2.6f); + String puntos = ""+(aux.getSecond()+this.tiempo.getSecond()); + font.draw(batch, "Ha ganado el jugador 2 en "+puntos+"s", Gdx.graphics.getWidth()/4,Gdx.graphics.getHeight()/2.6f); }else if(p2.muerto()){ - font.draw(batch, "Ha ganado el jugador 1", Gdx.graphics.getWidth()/4,Gdx.graphics.getHeight()/2.6f); + String puntos = ""+(aux.getSecond()+this.tiempo.getSecond()); + font.draw(batch, "Ha ganado el jugador 1 en "+puntos+"s", Gdx.graphics.getWidth()/4,Gdx.graphics.getHeight()/2.6f); + }else { + aux=LocalTime.now(); } return darSeleccionado(); diff --git a/core/src/menus/MenuSeleccion.java b/core/src/menus/MenuSeleccion.java index 018d63c..5f0d9b0 100644 --- a/core/src/menus/MenuSeleccion.java +++ b/core/src/menus/MenuSeleccion.java @@ -39,7 +39,15 @@ public class MenuSeleccion extends Menu{ } this.caratulas.get(i).draw(batch, 10+i*200, 300); }else { - this.caratulas.get(i).draw(batch, 10+(i-2)*200, 150); + if(i==this.position) { + batch.end(); + shapeDrawer.begin(ShapeType.Filled); + shapeDrawer.setColor(Color.GRAY); + shapeDrawer.rect(10+(i-3)*280, 280, 190, 180); + shapeDrawer.end(); + batch.begin(); + } + this.caratulas.get(i).draw(batch, 10+(i-3)*200, 150); } }