Files
GTSchoolShit/CS1322/p6/MyWay2/CTile.java
2025-06-07 01:59:34 -04:00

126 lines
2.8 KiB
Java

/**
* <PRE>
* Tile.java
*
* Revisions: 1.0 Nov. 12, 2002
* Created the Tile class
*
* </PRE>
*
* @author <A HREF="mailto:gtg184g@mail.gatech.edu">Jose Manuel Caban</A>
* @version Version 1.0, Nov. 12, 2002
*/
import javax.swing.*;
/**
*CTile "is-a" Coordinate, however, it is used for both walls and floor
*using the height. The AI will be built specificaly for say level 1, which is
*the ground height of the floor and level 2, the walls, will be left out
*
*Addendum: CTile is pacman specific is not fully generalized, it also removes
* support for animated tiles such as water
*/
public class CTile extends CCoord{
/**
*Defines whether the object is coming from the ground up to a given level
*or whether it is a floating object (i.e. a bridge)
*NOT IMPLEMENTED IN PACMAN
*/
private boolean bIsFloating; //special note, this will NOT be implemented
//in standard Pacman, it is meant for future
//manipulation
/**
*Define whether block has a special nibble
*/
private boolean bHasSpecial;
/**
*Define whether block has a nibble
*/
private boolean bHasNibble;
/**
*Holds the tile picture data
*/
ImageIcon imgTile;
////////////////
//Constructors//
////////////////
/**
*@param x, the x-coord
*@param y, the y-coord
*@param z, the z-coord
*/
public CTile(int x, int y, int z){
this(x,y,z,false);
//imgTile = new ImageIcon(icon);
}
/**
*Same as other constructor but adds
*@param bIsFloating, defines whether the object is floating or not
*/
public CTile(int x, int y, int z, boolean bFloating){
super(x,y,z);
bIsFloating = bFloating;
bHasSpecial = false;
bHasNibble = false;
}
///////////////////////
//Accessors/Modifiers//
///////////////////////
/**
*@return true if object can be passed over
*/
public boolean isPassable(CCoord op){
if(op.getZ() == this.iZ){
return true;
}
return false;
}
public boolean isSpecial(){
return bHasSpecial;
}
public boolean isNibble(){
return bHasNibble;
}
public void setImage(String filename){
imgTile = new ImageIcon(filename);
}
/**
*@param nibble, whether or not it has a nibble
*@param special, whether or not it has a special
*/
public void setItems(boolean nibble, boolean special){
bHasNibble = nibble;
bHasSpecial = special;
}
/**
* Debugging main for class Tile.
* This method will rigorously test my code.
*
* <br><br>
* @param args a String array of command line arguments.
*/
public static void main(String[] args) {
}// end of main(String[] args)
}// end of class Tile