65 lines
1.3 KiB
Java
65 lines
1.3 KiB
Java
package utilidades;
|
|
|
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
|
|
|
public class Personaje {
|
|
Gifs standby;
|
|
Gifs medio;
|
|
Gifs alto;
|
|
Gifs bajo;
|
|
Gifs actual;
|
|
public static final int STAND=0;
|
|
public static final int ALTO=1;
|
|
public static final int MEDIO=2;
|
|
public static final int BAJO=3;
|
|
public Personaje(String caracter, boolean position) {
|
|
switch (caracter) {
|
|
case "ryu":
|
|
this.ryu(position);
|
|
break;
|
|
case "ken":
|
|
this.ken(position);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
this.actual=this.standby;
|
|
}
|
|
|
|
public void cambiarEstado(int estado) {
|
|
switch(estado) {
|
|
case STAND:
|
|
this.actual=this.standby;
|
|
break;
|
|
case ALTO:
|
|
this.actual=this.alto;
|
|
break;
|
|
case MEDIO:
|
|
this.actual=this.medio;
|
|
break;
|
|
case BAJO:
|
|
this.actual=this.bajo;
|
|
break;
|
|
}
|
|
}
|
|
|
|
public void draw(SpriteBatch batch, float delta, int x, int y) {
|
|
this.actual.avanzar(10, delta);
|
|
this.actual.draw(batch, x, y);
|
|
}
|
|
|
|
public void dispose() {
|
|
this.actual.dispose();
|
|
}
|
|
|
|
private void ryu(boolean position) {
|
|
this.standby=new Gifs("p1.png", 5, 0, 74, 120, 70, 100, position);
|
|
this.medio=new Gifs("p1.png", 3, 4, 93, 355, 88, 100, position);
|
|
}
|
|
|
|
private void ken(boolean position) {
|
|
this.standby=new Gifs("p2.png", 5, 0, 70, 863, 67, 93, position);
|
|
this.medio=new Gifs("p2.png", 2, 0, 70, 1145, 72, 100, position);
|
|
}
|
|
}
|