Ship.java
上传用户:haoxsx
上传日期:2022-03-22
资源大小:20k
文件大小:0k
源码类别:

Applet

开发平台:

Java

  1. package asteroids;
  2. import java.awt.Polygon;
  3. import java.awt.Rectangle;
  4. public class Ship extends BaseVectorShape {
  5. private int[] shipx = {-6,-3,0,3,6,0};
  6.     private int[] shipy = {6,7,7,7,6,-7};
  7.     
  8.     public Rectangle getBounds(){
  9.        Rectangle r;
  10.        r= new Rectangle((int)getX()-6,(int)getY()-6,12,12);
  11.        return r;
  12.     }
  13. public Ship() {
  14. // TODO Auto-generated constructor stub
  15. setShape(new Polygon(shipx,shipy,shipx.length));
  16. setAlive(true);
  17. }
  18. }