-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcolloredstripes.pde
More file actions
42 lines (32 loc) · 875 Bytes
/
colloredstripes.pde
File metadata and controls
42 lines (32 loc) · 875 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
ArrayList <Ant> ants = new ArrayList <Ant>();
int numAnts = 25;
void setup(){
size(900,600);
frameRate(60);
for(int i =0; i < numAnts; i++) {
ants.add(new Ant());
//ants.add(i).bodySize =20;//int (random(4,90));
}
}
void draw() {
// background(0);
for (int i =0; i < numAnts; i++) {
ants.get(i).drawAnt();
//if x of some Ant == to x of another Ant-> if y are the same then combine
for (int j=0; j <numAnts; j++){
if (i!=j) {
if (abs(ants.get(i).x-ants.get(j).x) < abs(ants.get(i).bodySize-ants.get(j).bodySize)) {
if (abs(ants.get(i).y-ants.get(j).y) < abs(ants.get(i).bodySize-ants.get(j).bodySize)){
print("Gratulation");
// ants.get(i).speed=(2.0,2.0);
;
}
}
}
}
if (ants.get(i).killAnt==true) {
ants.remove(i);
numAnts--;
}
}
}