Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function letsShoot(cellsToShootFrom,myWalkableCells,me,my_mp,enemy_id){
- var closestCellToShootFrom = getPathLength(me, getCell(306));
- if(!isEmpty(cellsToShootFrom)){
- for (var i = 0; i < count(cellsToShootFrom); i++) {
- var shortestDistance = getPathLength(me, cellsToShootFrom[i]);
- if(shortestDistance < closestCellToShootFrom && getPathLength(me,cellsToShootFrom[i]) <= my_mp && !inArray(cellsToShootFrom, me)){
- closestCellToShootFrom = cellsToShootFrom[i];
- }
- }
- moveTowardCell(closestCellToShootFrom);
- } else{
- moveToward(enemy_id);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement