36 lines
604 B
Java

package utilidades;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
public class Bot extends Personaje{
public Bot(String caracter, boolean position) {
super(caracter, position);
}
public void mover() {
int mover = (int)Math.round(Math.random()*3);
if (mover == 1) {
if(this.position) {
this.y++;
}else {
if(!this.caja.overlaps(enemigo)) {
this.y++;
}
}
}
if (mover == 2) {
if(!this.position) {
this.y--;
}else {
if(!this.caja.overlaps(enemigo)) {
this.y--;
}
}
}
this.caja.setPosition(x, y);
}
}