Class DrawingSprite
java.lang.Object
org.openpatch.scratch.Sprite
org.openpatch.scratch.drawing.DrawingSprite
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
BitmapText
A sprite that draws itself with shapes and images instead of a costume: override
draw(Drawing). It is drawn in its layer behind the ordinary sprites of that layer.
class Road extends DrawingSprite {
public void draw(Drawing drawing) {
drawing.rectangle(0, 0, 320, 180, new Color(90, 170, 220));
}
}
-
Field Summary
Fields inherited from class Sprite
DIRECTION_DOWN, DIRECTION_LEFT, DIRECTION_RIGHT, DIRECTION_UP -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class Sprite
addAnimation, addAnimation, addAnimation, addCostume, addCostume, addCostume, addCostumes, addSound, addSound, ask, broadcast, changeColorEffect, changeHeight, changePosition, changePosition, changeSize, changeTransparency, changeVolume, changeWidth, changeX, changeY, createClone, debug, deleteThisClone, disableHitbox, disableNineSlice, distanceToMousePointer, distanceToSprite, enableHitbox, extension, getAnimationFrame, getAnimationInterval, getAnswer, getColorEffect, getCurrentCostumeIndex, getCurrentCostumeName, getDirection, getHeight, getHitbox, getLayer, getMouse, getMouseX, getMouseY, getPen, getPosition, getRotationStyle, getShaders, getSize, getStage, getText, getTimer, getTint, getTouchingSprite, getTouchingSprites, getTransparency, getVolume, getWidth, getX, getY, glide, goLayersBackwards, goLayersForwards, goToBackLayer, goToFrontLayer, goToMousePointer, goToRandomPosition, goToSprite, hide, hideVariable, ifOnEdgeBounce, isAnimationPlayed, isAsking, isClone, isColorTouchingColor, isGliding, isKeyPressed, isMouseDown, isSoundPlaying, isTouchingColor, isTouchingColor, isTouchingEdge, isTouchingMousePointer, isTouchingSprite, isTouchingSprite, isVisible, move, nextCostume, pickRandom, playAnimation, playAnimation, playSound, playSoundCopy, pointTowards, pointTowards, pointTowardsMousePointer, previousCostume, remove, resetAnimation, run, say, say, setAnimationFrame, setAnimationInterval, setColorEffect, setDirection, setHeight, setHitbox, setLayer, setNineSlice, setPosition, setPosition, setRotationCenter, setRotationStyle, setSize, setTint, setTint, setTransparency, setVolume, setWidth, setX, setY, show, showVariable, stamp, stamp, stopAllSounds, stopSound, switchCostume, switchCostume, think, think, toString, turnLeft, turnRight, whenAddedToStage, whenBackdropSwitches, whenClicked, whenIReceive, whenKeyPressed, whenKeyReleased, whenMouseClicked, whenMouseMoved, whenRemovedFromStage, whenStartsAsClone
-
Constructor Details
-
DrawingSprite
public DrawingSprite()A drawing sprite; it has no hitbox unless given one.
-
-
Method Details
-
draw
Draws the sprite; called every frame on the game thread.- Parameters:
drawing- what to draw with, in the sprite's own coordinates
-