-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBee.pde
More file actions
87 lines (57 loc) · 1.54 KB
/
Copy pathBee.pde
File metadata and controls
87 lines (57 loc) · 1.54 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
class Bee extends Obstacles {
// make a fisica body
FCircle bee;
float chosenHeight;
float chosenWidth;
float adjustY;
boolean hitBlob = false;
Animation beez;
Bee(){
// around here
chosenHeight= random(30,height-30);
chosenWidth = random(width, width+500);
beez= new Animation("bee0",3);
if(chosenHeight < height/2){
adjustY = random(0,0.6);
}
else{
adjustY = random(-0.6,0);
}
super.location = new PVector(chosenWidth, chosenHeight);
bee = new FCircle(30);
bee.setStrokeWeight(3);
bee.setStroke(190);
bee.setNoStroke();
bee.setNoFill();
bee.setStatic(true);
bee.setPosition(chosenWidth, chosenHeight);
world.add(bee);
}
void update(){
bee.adjustPosition(-scrollSpeed, adjustY);
location.x-=scrollSpeed;
}
void display(){
beez.display(bee.getX(), bee.getY());
}
void removeWorld(){
world.remove(bee);
}
public boolean hit(float x, float y){
ArrayList<FContact> contactingbody = bee.getContacts();
if(contactingbody.size() > 0){
for(int i = 0; i< contactingbody.size(); i++){
// check if it came in contact with the blob
if( contactingbody.get(i).getBody2() instanceof FCircle){
if(!hitBlob){
return true;
}
}
}
}
return false;
}
public float getHeight(){
return 0;
}
}