CCB Premier Import

This commit is contained in:
Christian Cunat-Brulé
2018-07-23 10:52:48 +02:00
commit f55475a23f
765 changed files with 209793 additions and 0 deletions

25
01-SOURCES/Ship.java Normal file
View File

@@ -0,0 +1,25 @@
/*****************************************************
* Beginning Java Game Programming, 2nd Edition
* by Jonathan S. Harbour
* Ship class - polygonal shape of the player's ship
*****************************************************/
import java.awt.Polygon;
import java.awt.Rectangle;
public class Ship extends BaseVectorShape {
//define the ship polygon
private int[] shipx = { -6, -3, 0, 3, 6, 0 };
private int[] shipy = { 6, 7, 7, 7, 6, -7 };
//bounding rectangle
public Rectangle getBounds() {
Rectangle r;
r = new Rectangle((int)getX() - 6, (int) getY() - 6, 12,12);
return r;
}
Ship() {
setShape(new Polygon(shipx, shipy, shipx.length));
setAlive(true);
}
}