vehicle
Class BasicVehicle

java.lang.Object
  |
  +--vehicle.AbstractVehicle
        |
        +--vehicle.BasicVehicle
Direct Known Subclasses:
AutomaticRightMovingV

public class BasicVehicle
extends AbstractVehicle

Basic Vehicle implementation.

This is a very simple vehicle that demostrates how to create and draw shapes onto the world. In addition, movement controls are handled by the keyboard arrows.
Left arrow key - Turn counterclockwise
Right arrow key - Turn clockwise
Up arrow key - Move forward
Down arrow key - Move backward


Field Summary
private  java.awt.Shape body
           
private  java.awt.Shape head
           
private  java.awt.Shape tail
           
 
Fields inherited from class vehicle.AbstractVehicle
mvTrack, theWorld
 
Constructor Summary
BasicVehicle(World aWorld)
          Create a very simple movement vehicle
 
Method Summary
 void createShapes()
          Create all our shapes representing this vehicle.
 void draw(java.awt.Graphics2D g)
          Use the graphics system to actually paint the shapes we have created.
 void update()
          Called by World when it's time to update.
 
Methods inherited from class vehicle.AbstractVehicle
getOrientation, getTracker, getX, getY, handleCollision, moveBy, moveTo, rotateBy, setOrientation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

body

private java.awt.Shape body

head

private java.awt.Shape head

tail

private java.awt.Shape tail
Constructor Detail

BasicVehicle

public BasicVehicle(World aWorld)
Create a very simple movement vehicle

Method Detail

update

public void update()
Called by World when it's time to update. Checks for button presses, rotating and moving appropriately

Specified by:
update in class AbstractVehicle

createShapes

public void createShapes()
Create all our shapes representing this vehicle. This method is calleteh constructor.


draw

public void draw(java.awt.Graphics2D g)
Use the graphics system to actually paint the shapes we have created.

Specified by:
draw in class AbstractVehicle
Parameters:
g - the graphics system to use