Advertisement
Guest User

scr_getNeighbours

a guest
Feb 12th, 2018
800
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. ///scr_getNeighbours(node, max range)
  2.  
  3. //gets all neighbour nodes that are close to the
  4. //current node (determined by maxRange) and adds
  5. //them to a ds_list of nodes
  6.  
  7. var node = argument0;
  8. var maxRange = argument1;
  9. var neighbours = ds_list_create();
  10.  
  11. with (obj_node)
  12. {
  13. if (id != node.id)
  14. {
  15. if (distance_to_object(node) <= maxRange)
  16. {
  17. ds_list_add(neighbours,id);
  18. }
  19. }
  20. }
  21.  
  22. return neighbours;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement