From 1e73ebf3e32b6759038b7bcb5335e5f1b544f3a4 Mon Sep 17 00:00:00 2001 From: John W Bojorquez Date: Sat, 14 Mar 2015 11:36:49 -0400 Subject: [PATCH] Committing MerchantSprite class that wasn't committed before. --- .../src/sprites/MerchantSprite.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 MerchantRPGCSE2102/src/sprites/MerchantSprite.java 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); + } +}