The Alien Sprite


The User's Touring Sprite

TourSprite subclasses Sprite3D to specify the movement step and rotation amounts of the user's sprite. Here are the relevant methods:

     private final static double MOVERATE = 0.3;     private final static double ROTATE_AMT = Math.PI / 16.0;     public TourSprite(String fnm, Obstacles obs)     { super(fnm, obs);  }     public boolean moveForward( )     { return moveBy(0.0, MOVERATE); }     public void rotClock( )     { doRotateY(-ROTATE_AMT); }  // clockwise

TourSprite doesn't contain any behavior code to specify when the move and rotation methods should be called and is placed in a separate Behavior class (TouristControls for TourSprite). Behavior classes are explained after the next section.



Killer Game Programming in Java
Killer Game Programming in Java
ISBN: 0596007302
EAN: 2147483647
Year: 2006
Pages: 340

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net