Class MovingItem

java.lang.Object
  extended by Item
      extended by MovingItem
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ExplorerBot, Organism, Organism.BodySegment, Player, PushableItem, Snake, Snake.BodySegment, Square, Square.BodySegment

public class MovingItem
extends Item

See Also:
Serialized Form

Field Summary
private  Vector direction
           
private  double initialTurningSpeed
           
private  double speed
           
private  double turningSpeed
           
 
Constructor Summary
MovingItem(Vector pos, Environment env)
           
 
Method Summary
 Item checkIfTouching(java.util.Set items)
           
 Item checkIfTouching(java.util.Set items, Vector pos)
           
 void classImage(java.awt.Graphics g, Vector pos, double zoom)
           
 void collideAction(Item other, Vector oldPos)
           
 Vector direction()
           
 double initialTurningSpeed()
           
 boolean move()
           
 boolean move(double dist, Vector dir)
           
 boolean moveBackward()
           
 void setDirection(Vector dir)
           
 void setInitialTurningSpeed(double a)
           
 void setSpeed(double s)
           
 void setTurningSpeed(double s)
           
 double speed()
           
 boolean strafeLeft()
           
 boolean strafeRight()
           
 void turn(double angle)
           
 double turningSpeed()
           
 void turnLeft()
           
 void turnRight()
           
 
Methods inherited from class Item
action, age, className, color, displacement, displacement, distanceFrom, distanceFrom, environment, image, incrementAge, isActive, isAlive, isEdible, isPortable, isPushable, isSolid, message, messageCounter, performSpecificFunction, position, radiusOfContact, reduceMessageCounter, remove, setActive, setAge, setColor, setEnvironment, setImage, setMessage, setPosition, setRadiusOfContact, showMessage, theCloser, toImage, touchingDistance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

direction

private Vector direction

speed

private double speed

turningSpeed

private double turningSpeed

initialTurningSpeed

private double initialTurningSpeed
Constructor Detail

MovingItem

public MovingItem(Vector pos,
                  Environment env)
Method Detail

move

public boolean move()

move

public boolean move(double dist,
                    Vector dir)

collideAction

public void collideAction(Item other,
                          Vector oldPos)

turnRight

public void turnRight()

turnLeft

public void turnLeft()

turn

public void turn(double angle)

direction

public Vector direction()

setDirection

public void setDirection(Vector dir)

speed

public double speed()

setSpeed

public void setSpeed(double s)

turningSpeed

public double turningSpeed()

setTurningSpeed

public void setTurningSpeed(double s)

setInitialTurningSpeed

public void setInitialTurningSpeed(double a)

initialTurningSpeed

public double initialTurningSpeed()

moveBackward

public boolean moveBackward()

strafeRight

public boolean strafeRight()

strafeLeft

public boolean strafeLeft()

checkIfTouching

public Item checkIfTouching(java.util.Set items)

checkIfTouching

public Item checkIfTouching(java.util.Set items,
                            Vector pos)

classImage

public void classImage(java.awt.Graphics g,
                       Vector pos,
                       double zoom)
Overrides:
classImage in class Item