12,297
edits
(Created page with "<syntaxhighlight lang="javaScript"> // Using this variable to decide whether to draw all the stuff boolean debug = true; // A path object (series of connected points) Path p...") |
No edit summary |
||
Line 1: | Line 1: | ||
<syntaxhighlight lang="javaScript"> | <syntaxhighlight lang="javaScript"> | ||
// Using this variable to decide whether to draw all the stuff | /// Using this variable to decide whether to draw all the stuff | ||
boolean debug = true; | boolean debug = true; | ||
Line 26: | Line 26: | ||
// The boids follow the path | // The boids follow the path | ||
for (int i= vehicles.size()-1; i >= 0; i--) { | |||
Vehicle v = vehicles.get(i); | |||
v.follow(path); | |||
// Call the generic run method (update, borders, display, etc.) | // Call the generic run method (update, borders, display, etc.) | ||
v.run(); | |||
if (v.position.x > width){vehicles.remove(i);} | |||
// Instructions | // Instructions | ||
fill(0); | fill(0); | ||
Line 60: | Line 61: | ||
/ | /class Path { | ||
class Path { | |||
// A Path is an arraylist of points (PVector objects) | // A Path is an arraylist of points (PVector objects) | ||
Line 116: | Line 112: | ||
} | } | ||
} | } | ||
class Vehicle { | class Vehicle { | ||
Line 299: | Line 286: | ||
endShape(); | endShape(); | ||
popMatrix(); | popMatrix(); | ||
} | } | ||
} | } |