diff --git a/MerchantRPGCSE2102/src/sprites/MerchantSprite.java b/MerchantRPGCSE2102/src/sprites/MerchantSprite.java new file mode 100644 index 0000000..ba6414b --- /dev/null +++ b/MerchantRPGCSE2102/src/sprites/MerchantSprite.java @@ -0,0 +1,30 @@ +package sprites; + +import java.awt.Graphics2D; +import java.awt.Rectangle; + +public class MerchantSprite { + private int x, y; + private static final int WIDTH = 30; + + public MerchantSprite(int row, int col) { + this.x = col*WIDTH; + this.y = row*WIDTH; + } + + /** + * Paints the sprite at its current location + * @param g Graphics2D for painting + */ + public void paint(Graphics2D g) { + g.fillRect(x, y, WIDTH, WIDTH); + } + + /** + * Gets the bounds of the sprite in the form of a Rectangle + * @return the Rectangle formed by the sprite + */ + public Rectangle getBounds() { + return new Rectangle(x, y, WIDTH, WIDTH); + } +}