Skip to content

Commit

Permalink
Committing MerchantSprite class that wasn't committed before.
Browse files Browse the repository at this point in the history
  • Loading branch information
john committed Mar 14, 2015
1 parent 8018789 commit 1e73ebf
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions MerchantRPGCSE2102/src/sprites/MerchantSprite.java
Original file line number Diff line number Diff line change
@@ -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);
}
}

0 comments on commit 1e73ebf

Please sign in to comment.