Class Snake

java.lang.Object
  extended by Item
      extended by MovingItem
          extended by Snake
All Implemented Interfaces:
java.io.Serializable

public class Snake
extends MovingItem

See Also:
Serialized Form

Nested Class Summary
private  class Snake.BodySegment
           
 
Field Summary
private  java.util.Set body
           
private  Snake.BodySegment tail
           
private  Snake.BodySegment tail2
           
 
Constructor Summary
Snake(Vector pos, Environment env)
           
 
Method Summary
 void action()
           
 java.util.Set body()
           
 void classImage(java.awt.Graphics g, Vector pos, double zoom)
           
 void collideAction(Item other, Vector oldPos)
           
 void setBody(java.util.Set s)
           
 void setTail(Snake.BodySegment i)
           
 Snake.BodySegment tail()
           
 
Methods inherited from class MovingItem
checkIfTouching, checkIfTouching, direction, initialTurningSpeed, move, move, moveBackward, setDirection, setInitialTurningSpeed, setSpeed, setTurningSpeed, speed, strafeLeft, strafeRight, turn, turningSpeed, turnLeft, turnRight
 
Methods inherited from class Item
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

body

private java.util.Set body

tail

private Snake.BodySegment tail

tail2

private Snake.BodySegment tail2
Constructor Detail

Snake

public Snake(Vector pos,
             Environment env)
Method Detail

setTail

public void setTail(Snake.BodySegment i)

tail

public Snake.BodySegment tail()

setBody

public void setBody(java.util.Set s)

body

public java.util.Set body()

action

public void action()
Overrides:
action in class Item

collideAction

public void collideAction(Item other,
                          Vector oldPos)
Overrides:
collideAction in class MovingItem

classImage

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