forked from APCSLowell/AsteroidsGame
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMissile.pde
38 lines (38 loc) · 1.39 KB
/
Missile.pde
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
public class Missile extends Floater
{
int speed;
public Missile()
{
//yCorners=new int[]{-10,0,10,0};
//xCorners=new int[]{-20,20,-20,-10};
//corners=4;
//myColor=color(240,248,255);
yCorners=new int[]{0,-1,-2,-2,-1,-1,-2,-3,-3,-2,-1,1,2,3,3,2,1,1,2,2,1};
xCorners=new int[]{10,8,4,2,0,-1,-2,-4,-8,-6,-5,-5,-6,-8,-4,-2,-1,0,2,4,8};
corners=21;
myColor=color(0,0,255);
myCenterX=ship.getX();
myCenterY=ship.getY();
myDirectionX=ship.getDirectionX();
myDirectionY=ship.getDirectionY();
myPointDirection=ship.getPointDirection();
}
public void setX(int x){myCenterX=x;}
public int getX(){return (int)myCenterX;}
public void setY(int y){myCenterY=y;}
public int getY(){return (int)myCenterY;}
public void setDirectionX(double x){myDirectionX=x;}
public double getDirectionX(){return myDirectionX;}
public void setDirectionY(double y){myDirectionY=y;}
public double getDirectionY(){return myDirectionY;}
public void setPointDirection(int degrees){myPointDirection=degrees;}
public double getPointDirection(){return myPointDirection;}
public void accelerate(int x)
{
//double dRadians=myPointDirection*(Math.PI/180);
//myDirectionX+=(x)*Math.cos(dRadians);
//myDirectionY+=(x) * Math.sin(dRadians);
speed+=x;
super.accelerate(x);
}
}