Class Evolution.Drawable

java.lang.Object
  extended by Evolution.Drawable
Direct Known Subclasses:
Evolution.Animal, Evolution.Hazard, Evolution.Plant
Enclosing class:
Evolution

private abstract class Evolution.Drawable
extends java.lang.Object

Inner class for all drawable items to derive from.

Author:
Townsend

Field Summary
 int id
          A unique-enough id
 double positionX
          Item's X Coordinate
 double positionY
          Item's Y Coordinate
 int[] sprite
          Item's sprite as an array of pixels
 
Constructor Summary
private Evolution.Drawable()
           
 
Method Summary
 void die()
           
 void drawSprite()
          Overload for drawSprite, using the current position and default pixel array
 void drawSprite(int[] image)
          Overload for drawSprite, using the current position
 void drawSprite(int x, int y, int[] image)
          Draw the sprite at the specified position.
 int getPositionX()
           
 int getPositionY()
           
 int[] getSprite()
          Getter for the sprite (can be overridden)
 void setPositionX(int positionX)
           
 void setPositionY(int positionY)
           
 void setSprite(int[] sprite)
          Setter for the sprite (can be overridden)
 void wipeSprite()
          Overload of wipeSprite, using the default pixel arrays.
 void wipeSprite(int[] setImage, int[] fromImage)
          Wipe this sprite from the screen.
 void wrapPosition()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

public int id
A unique-enough id


positionX

public double positionX
Item's X Coordinate


positionY

public double positionY
Item's Y Coordinate


sprite

public int[] sprite
Item's sprite as an array of pixels

Constructor Detail

Evolution.Drawable

private Evolution.Drawable()
Method Detail

getSprite

public int[] getSprite()
Getter for the sprite (can be overridden)

Returns:
int array of the pixels for this sprite

setSprite

public void setSprite(int[] sprite)
Setter for the sprite (can be overridden)

Parameters:
sprite - int array of the pixels for this sprite

wipeSprite

public void wipeSprite()
Overload of wipeSprite, using the default pixel arrays.


wipeSprite

public void wipeSprite(int[] setImage,
                       int[] fromImage)
Wipe this sprite from the screen. Basically an "undraw" method, which sets the pixels this sprite occupied back to the default background colour.


drawSprite

public void drawSprite()
Overload for drawSprite, using the current position and default pixel array


drawSprite

public void drawSprite(int[] image)
Overload for drawSprite, using the current position

Parameters:
image -

drawSprite

public void drawSprite(int x,
                       int y,
                       int[] image)
Draw the sprite at the specified position. Only draws non-background pixels, which allows for sprites to overlap (and saves a bit of work.)

Parameters:
x - X Coordinate
y - Y Coordinate

getPositionX

public int getPositionX()

setPositionX

public void setPositionX(int positionX)

getPositionY

public int getPositionY()

setPositionY

public void setPositionY(int positionY)

wrapPosition

public void wrapPosition()

die

public void die()