preparando mas jugadores

This commit is contained in:
Guillermo Roche 2020-02-21 14:19:05 +01:00
parent 0d97bbafd0
commit 1c3b48c533
3 changed files with 29 additions and 5 deletions

View File

@ -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();
}

View File

@ -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();

View File

@ -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);
}
}