//iterates over the path find and moves single spaces public static void moveToPlayer(GameCharacter enemy, GameCharacter target, Board board) { var pointList = PathFind.Pathfind(board, enemy.x, enemy.y, target.x, target.y); foreach (var p in pointList) { board.MoveCharacter(enemy, board.getTileFromLocation(p.x, p.y)); } }
private bool Move(GameCharacter character, int x, int y) { if (!CoreHelper.checkEffect(character.activeEffects, character.passiveEffects, StatType.Stun)) { bool canMove = board.MoveCharacter(character, board.getTileFromLocation(x, y)); if (canMove) { battleLog.AddEntry(string.Format("{0} moved to {1},{2}", character.name, x, y)); } else { battleLog.AddEntry(string.Format("{0} was unable to move to {1},{2}", character.name, x, y)); } return(canMove); } else { battleLog.AddEntry(string.Format("{0} is stunned and unable to move.", character.name)); } return(false); }
//iterates over the path find and moves single spaces public static void moveToPlayer(GameCharacter enemy, GameCharacter target, Board board) { var pointList = PathFind.Pathfind(board, enemy.x, enemy.y, target.x, target.y); foreach(var p in pointList) { board.MoveCharacter(enemy, board.getTileFromLocation(p.x, p.y)); } }