-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from gal11002/master
Pulling master into Gavin-L
- Loading branch information
Showing
8 changed files
with
409 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
Oops, something went wrong.