Asteroid.java
上传用户:haoxsx
上传日期:2022-03-22
资源大小:20k
文件大小:1k
- package asteroids;
- import java.awt.Polygon;
- import java.awt.Rectangle;
- public class Asteroid extends BaseVectorShape {
-
- private int[] astx={-20,-13,0,20,22,20,12,2,-10,-22,-16};
- private int[] asty={20,23,17,20,16,-20,-22,-14,-17,-20,-5};
-
- protected double rotVel;
-
- public double getRotationVelocity(){return rotVel;}
- public void setRotationVelocity(double v){rotVel=v;}
-
- public Rectangle getBounds(){
- Rectangle r;
- r=new Rectangle((int)getX()-20,(int)getY()-20,40,40);
- return r;
-
- }
- public Asteroid() {
- // TODO Auto-generated constructor stub
- setShape(new Polygon(astx,asty,astx.length));
- setAlive(true);
- setRotationVelocity(0.0);
- }
- }