Scratch for Java

Pen()

A pen draws lines onto the canvas of its layer, like Scratch's pen. Every sprite has one (getPen()) that follows it; a pen of your own can be added to a stage and moved with setPosition(double, double).

What a pen draws stays where it was drawn on the screen: a camera moving later does not move it. A sprite's pen draws onto Layer.BACKGROUND, behind the sprites, unless it is moved with setLayer(Layer).

this.getPen().setColor(new Color(255, 0, 0));
this.getPen().setSize(4);
this.getPen().down();
this.move(50);

Syntax

Java

new Pen()
Pen()

Create Shareable URL

Select Sections