Class DrawingSprite

java.lang.Object
org.openpatch.scratch.Sprite
org.openpatch.scratch.drawing.DrawingSprite
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
BitmapText

public class DrawingSprite extends Sprite
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));
  }
}
  • Constructor Details

    • DrawingSprite

      public DrawingSprite()
      A drawing sprite; it has no hitbox unless given one.
  • Method Details

    • draw

      public void draw(Drawing drawing)
      Draws the sprite; called every frame on the game thread.
      Parameters:
      drawing - what to draw with, in the sprite's own coordinates