forked from APCSLowell/AsteroidsGame
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAsteroid.pde
More file actions
27 lines (22 loc) · 714 Bytes
/
Asteroid.pde
File metadata and controls
27 lines (22 loc) · 714 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
class Asteroid extends Floater{
double rodSpeed = (int)(Math.random()*20 -10);
public Asteroid(){
myColor = 115;
myCenterX = (int)(Math.random()*500);
myCenterY = (int)(Math.random()*500);
myXspeed = (double)(Math.random()*2 -1);
myYspeed = (double)(Math.random()*2 -1);
myPointDirection = 1;
corners = 6;
xCorners = new int[corners];
yCorners = new int[corners];
xCorners = new int[] {-11, 7, 13, 6, -11, -5};
yCorners = new int[] {-8, -8, 0, 10, 8, 0};
}
public void move(){
turn(rodSpeed);
super.move();
}
public double getCenterX(){return myCenterX;}
public double getCenterY(){return myCenterY;}
}