aniadia Cammy, bot funcional
This commit is contained in:
35
core/src/utilidades/Bot.java
Normal file
35
core/src/utilidades/Bot.java
Normal 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);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user