Package gui
Class Sprite
java.lang.Object
gui.Sprite
An instance maintains information about a sprite for the GUI. A sprite is defined by a
spritesheet, the information to interpret it (size of each image, etc.), and information
necessary to animate the sprite.
-
Constructor Details
-
Sprite
Constructor: an instance with image at imageLoc, of size (width, height), and number of frames in the animation cycleSize.
-
-
Method Details
-
tick
public void tick()Update the spritesheet's animation by a single frame. -
getSprite
Return offset (dRow, dCol) into the spritesheet. Assume that (dRow, dCol) is the base offset, and subsequent animations are at (dRow, dCol + 1), (dRow, dCol + 2) ... (dRow, dCol + cycleSize - 1)- Parameters:
dRow
- the number of rows to offset into the spritesheet for the first animationdCol
- the number of columns to offset into the spritesheet for the first animation
-