Nuevos sprites mejorados, valanceo de ataques y combos

This commit is contained in:
2020-02-20 21:43:10 +01:00
parent 8bf3cbd393
commit 9884106a7d
70 changed files with 404 additions and 57 deletions

View File

@@ -15,7 +15,9 @@ public class Battle extends Menu{
Texture suelo;
float contador;
boolean cambio;
boolean finalRound;
public Battle(String np1, String np2) {
this.finalRound=false;
this.cambio=true;
this.p2=new Bot(np2, true);
this.p1=new Personaje(np1, false);
@@ -31,6 +33,8 @@ public class Battle extends Menu{
p1.cambiarEstado(p1.MEDIO);
}else if(Gdx.input.isKeyPressed(Input.Keys.W)){
p1.cambiarEstado(p1.ALTO);
}else if(Gdx.input.isKeyPressed(Input.Keys.S)){
p1.cambiarEstado(p1.BAJO);
}else{
p1.cambiarEstado(p1.STAND);
}
@@ -40,27 +44,56 @@ public class Battle extends Menu{
p2.cambiarEstado((int)Math.round(Math.random()*2));
cambio=false;
}
if(contador>1) {
contador=0;
cambio=true;
if(finalRound) {
if(contador>2) {
contador=0;
cambio=true;
}
}else {
if(contador>1) {
contador=0;
cambio=true;
}
}
}else {
p2.cambiarEstado(p2.STAND);
}
p1.mover();
p2.mover();
p2.recivir(p1.atacar(delta));
p1.recivir(p2.atacar(delta));
if(finalRound) {
p1.recivir(p2.atacar(delta).ataqueFinal());
}else {
p1.recivir(p2.atacar(delta));
}
this.p1.draw(batch, delta);
this.p2.draw(batch, delta);
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);
}
return darSeleccionado();
}
@Override
int darSeleccionado() {
if(p1.muerto()||p2.muerto()) {
if(p1.muerto()) {
Menu.menus.remove(Menu.BATTLE);
return Menu.INICIAL;
return Menu.FINAL;
}else if(p2.muerto()) {
if(finalRound) {
Menu.menus.remove(Menu.BATTLE);
return Menu.FINAL;
}else {
this.p1=new Personaje(p1.toString(), false);
this.p2=new Bot(p2.toString(),true);
this.p1.setEnemigo(p2.getCaja());
this.p2.setEnemigo(p1.getCaja());
finalRound=true;
}
}
return Menu.BATTLE;