Back to project page TileArena.
The source code is released under:
MIT License
If you think the Android project TileArena listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package game.tile.arena.entity.enemy.ai; //ww w . j a va 2 s .c om import game.tile.arena.util.Position; public class EnemyRandomAI extends EnemyAI { Position currentMovement; public EnemyRandomAI() { currentMovement = new Position(Math.random()-0.5, Math.random()-0.5); } @Override public Position getRelativePosition() { if ((int)(Math.random()*100) == 1) currentMovement = new Position(Math.random()-0.5, Math.random()-0.5); if (!enemy.pos.add(currentMovement).inWorld(0)) currentMovement = currentMovement.scale(-1); return currentMovement; } }