IA_PathFinder/Obstacles.pde

30 lines
520 B
Plaintext
Raw Normal View History

2022-05-07 12:08:13 +00:00
class Obstacles{
ArrayList<Obstacle> obs;
//constructor
Obstacles(){
obs=new ArrayList<Obstacle>();
}
//add obstacle
void add(Obstacle o){
obs.add(o);
}
//check intersection
boolean isIntersecting(Dot dot){
for(int i=0; i<obs.size(); i++){
if(obs.get(i).isIntersecting(dot)){
return true;
}
}
return false;
}
//display all
void display(){
for(int i=0; i<obs.size(); i++){
obs.get(i).display();
}
}
}