Class Obj

java.lang.Object
  extended by Obj
Direct Known Subclasses:
Bomb, Box, Fire, Player, PowerUp, Wall

public abstract class Obj
extends java.lang.Object

The abstract class that all objects in the grid extend.

Author:
Daniel Kao

Field Summary
private  int currX
           
private  int currY
           
private  Grid g
           
 
Constructor Summary
Obj(Grid gr)
          Constructor.
 
Method Summary
 Grid getGrid()
          Returns the grid that holds the object.
abstract  java.awt.image.BufferedImage getImage()
          Returns the image to be drawn in the grid.
 int getX()
          Returns the x value of the object.
 int getY()
          Returns the y value of the object.
 void moveTo(int x, int y)
          Moves the object from its current location to given coordinates.
 void putSelfInGrid()
          Puts itself into the grid.
 void removeSelfFromGrid()
          Removes itself from the grid.
 void setX(int x)
          Sets the x value of the location to x.
 void setY(int y)
          Sets the y value of the location to y.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currX

private int currX

currY

private int currY

g

private Grid g
Constructor Detail

Obj

public Obj(Grid gr)
Constructor.

Parameters:
gr -
Method Detail

getX

public int getX()
Returns the x value of the object.

Returns:

getY

public int getY()
Returns the y value of the object.

Returns:

getGrid

public Grid getGrid()
Returns the grid that holds the object.

Returns:

setX

public void setX(int x)
Sets the x value of the location to x.

Parameters:
x -

setY

public void setY(int y)
Sets the y value of the location to y.

Parameters:
y -

removeSelfFromGrid

public void removeSelfFromGrid()
Removes itself from the grid.


putSelfInGrid

public void putSelfInGrid()
Puts itself into the grid.


moveTo

public void moveTo(int x,
                   int y)
Moves the object from its current location to given coordinates. If the coordinates are outside the grid, will not move.

Parameters:
x - x-coordinate to move to
y - y-coordinate to move to

getImage

public abstract java.awt.image.BufferedImage getImage()
Returns the image to be drawn in the grid.

Returns:
the image to be drawn.