Package doodlepad
Class Sprite
java.lang.Object
doodlepad.Shape
doodlepad.Sprite
A class that loads a sprite sheet image from a file and animates it on a Pad
-
Nested Class Summary
Nested classes/interfaces inherited from class doodlepad.Shape
Shape.ShapeMouseEventHandler, Shape.ShapeSelectionEventHandler
-
Field Summary
Fields inherited from class doodlepad.Shape
draggable, eventsEnabled, fillColor, filled, font, fontFamily, fontSize, fontStyle, height, layer, selectable, selected, shapeListener, strokeColor, stroked, strokeWidth, text, textFillColor, transform, visible, width, x, y
-
Constructor Summary
ConstructorDescriptionSprite
(String path, double x, double y, double frameWidth, int nFrames, double targetWidth, double targetHeight, Layer layer) Constructor for objects of class SpriteSprite
(String path, double x, double y, double frameWidth, int nFrames, int targetWidth, int targetHeight) Constructor for objects of class SpriteConstructor for objects of class SpriteConstructor for objects of class SpriteConstructor for objects of class Sprite -
Method Summary
Methods inherited from class doodlepad.Shape
contains, contains, drawText, getArea, getCenter, getDraggable, getEventsEnabled, getFillAlpha, getFillBlue, getFillColor, getFilled, getFillGreen, getFillRed, getFontFamily, getFontSize, getFontStyle, getHeight, getLayer, getLocation, getPad, getPadLocation, getSelectable, getSelected, getSize, getStrokeAlpha, getStrokeBlue, getStrokeColor, getStroked, getStrokeGreen, getStrokeRed, getStrokeWidth, getText, getTransform, getVisible, getWidth, getWindowLocation, getX, getY, intersects, move, onMouseClicked, onMouseDoubleClicked, onMouseDragged, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onSelectionChanged, repaint, reset, rotate, rotate, scale, scale, scale, scale, setCenter, setCenter, setDraggable, setEventsEnabled, setFillColor, setFillColor, setFillColor, setFillColor, setFilled, setFontFamily, setFontSize, setFontStyle, setHeight, setLocation, setLocation, setMouseClickedHandler, setMouseDoubleClickedHandler, setMouseDraggedHandler, setMouseEnteredHandler, setMouseExitedHandler, setMouseMovedHandler, setMousePressedHandler, setMouseReleasedHandler, setPadLocation, setSelectable, setSelected, setSelectionChangedHandler, setSize, setSize, setStrokeColor, setStrokeColor, setStrokeColor, setStrokeColor, setStroked, setStrokeWidth, setTextColor, setTextColor, setTextColor, setTextColor, setTransform, setVisible, setWidth, setWindowLocation, setX, setY, toBack, toFront, toWindowCoords, toWindowCoords, translate
-
Constructor Details
-
Sprite
Constructor for objects of class Sprite- Parameters:
path
- Path to sprite sheet image file.x
- The x-coordinate of the image upper left corner.y
- The y-coordinate of the image upper left corner.frameWidth
- The width of a single frame in the sprite sheet image.nFrames
- The number of adjacent frames in the entire sprite sheet image.
-
Sprite
Constructor for objects of class Sprite- Parameters:
path
- Path to sprite sheet image file.x
- The x-coordinate of the image upper left corner.y
- The y-coordinate of the image upper left corner.frameWidth
- The width of a single frame in the sprite sheet image.nFrames
- The number of adjacent frames in the entire sprite sheet image.pad
- The Pad to which the Sprite will be added.
-
Sprite
Constructor for objects of class Sprite- Parameters:
path
- Path to sprite sheet image file.x
- The x-coordinate of the image upper left corner.y
- The y-coordinate of the image upper left corner.frameWidth
- The width of a single frame in the sprite sheet image.nFrames
- The number of adjacent frames in the entire sprite sheet image.layer
- The Layer object to which the Image will be added, or null if not to add to a Layer.
-
Sprite
public Sprite(String path, double x, double y, double frameWidth, int nFrames, int targetWidth, int targetHeight) Constructor for objects of class Sprite- Parameters:
path
- Path to image file.x
- The x-coordinate of the image upper left corner.y
- The y-coordinate of the image upper left corner.frameWidth
- The width of a single frame in the sprite sheet image.nFrames
- The number of adjacent frames in the entire sprite sheet image.targetWidth
- The width with which to draw the sprite.targetHeight
- The height with which to draw the sprite.
-
Sprite
public Sprite(String path, double x, double y, double frameWidth, int nFrames, double targetWidth, double targetHeight, Layer layer) Constructor for objects of class Sprite- Parameters:
path
- Path to image file.x
- The x-coordinate of the image upper left corner.y
- The y-coordinate of the image upper left corner.frameWidth
- The width of a single frame in the sprite sheet image.nFrames
- The number of adjacent frames in the entire sprite sheet image.targetWidth
- The width with which to draw the sprite.targetHeight
- The height with which to draw the sprite.layer
- The Layer object to which the Sprite will be added, or null if not to add to a Pad.
-
-
Method Details
-
setText
A no-op to prevent setting text for this Shape. -
toString
Generate a representation of the Sprite object. -
advance
public void advance()Advance the sprite frame and repaint -
draw
Draw the current sprite frame
-