Piece - import java.awt.*; /* An instance is a piece for...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.awt.*; /** An instance is a piece for use in the J*Man!! assignment 2.*/ public abstract class Piece{ /** Constants that identify the kind of a piece. */ public static final int BLOCK= 0; // piece is a block public static final int JMAN= 1; // piece is the J*man public static final int WALKER= 2; // piece is a walker public static final int PILLAR= 3; // piece is a pillar /** Create Variables for type and Map. */ private int type; /** Type of piece (BLOCK, JMAN, WALKER, or PILLAR). */ private Map pieceMap; /** Map . */ private int yPos; /** y position. */ private int xPos; /**x position. */ private Color col; /** color of piece. */ private boolean act; /** behavior of piece. */ /** Constructor: a Piece on Map m with type t. Precondition: type is one of the four constants of this class. */ public Piece(int t, Map m){ type = t; pieceMap = m; } /** = this piece's type: (one of the four constants of this class). */ public int getType(){ return type; } /** = this piece's x location. */ public int getX(){
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

Piece - import java.awt.*; /* An instance is a piece for...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online