aniadia Cammy, bot funcional

This commit is contained in:
2020-02-19 23:50:47 +01:00
parent f30d646f99
commit d816803514
14 changed files with 291 additions and 16 deletions

View File

@@ -5,16 +5,22 @@ import com.badlogic.gdx.Input;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import utilidades.Bot;
import utilidades.Personaje;
public class Battle extends Menu{
Personaje p1;
Personaje p2;
Bot p2;
Texture suelo;
public Battle() {
this.p2=new Personaje("ken", true);
this.p1=new Personaje("ryu", false);
float contador;
boolean cambio;
public Battle(String np1, String np2) {
this.cambio=true;
this.p2=new Bot(np2, true);
this.p1=new Personaje(np1, false);
this.p1.setEnemigo(p2.getCaja());
this.p2.setEnemigo(p1.getCaja());
suelo = new Texture("sueloChina.png");
}
@@ -23,18 +29,47 @@ public class Battle extends Menu{
batch.draw(suelo,0,0);
if (Gdx.input.isKeyPressed(Input.Keys.E)) {
p1.cambiarEstado(p1.MEDIO);
}else {
}else if(Gdx.input.isKeyPressed(Input.Keys.W)){
p1.cambiarEstado(p1.ALTO);
}else{
p1.cambiarEstado(p1.STAND);
}
this.p1.draw(batch, delta, 150, 10);
this.p2.draw(batch, delta, 250, 10);
return Menu.BATTLE;
contador+=delta;
if(contador>0.5) {
if(cambio) {
p2.cambiarEstado((int)Math.round(Math.random()*2));
cambio=false;
}
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));
this.p1.draw(batch, delta);
this.p2.draw(batch, delta);
return darSeleccionado();
}
@Override
int darSeleccionado() {
return 0;
if(p1.muerto()||p2.muerto()) {
Menu.menus.remove(Menu.BATTLE);
return Menu.INICIAL;
}
return Menu.BATTLE;
}
public void dispose() {
super.dispose();
p1.dispose();
p2.dispose();
}
}