Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- randomize(); //get random node positions for the sake of this example
- //add 100 nodes to the room
- for (var i=0; i<100;++i)
- {
- instance_create(random(room_width),random(room_height),obj_node);
- }
- //get a random start and end node from all the nodes
- startNode = instance_id[irandom(instance_number(obj_node)-1)];
- endNode = instance_id[irandom(instance_number(obj_node)-1)];
- //start node is green, end node is red
- with (startNode)
- {
- image_blend = c_green;
- }
- with (endNode)
- {
- image_blend = c_red;
- }
- //we will store all nodes from the path here
- //including the start and end nodes
- pathNodes = ds_list_create();
- maxRange = 128; //how far apart can the nodes be before they are too far away from each other
- found = false; //just a boolean if there is a current path found
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement