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

@@ -0,0 +1,35 @@
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);
}
}