Pencil Code Reference > new Sprite

 

new Sprite creates a new sprite

new Sprite creates a new sprite.

new Sprite can create a blank canvas that you can draw on and create your own shapes. By default, a new sprite is an invisible 256 pixel square, but you can change its color and size.

First, name the sprite by setting a variable. To do this, type:

penny = new Sprite

This will allow you to use commands on the sprite such as fd, home, etc..

Once the sprite has a name like penny, you can draw on it using drawon.

Changing the Sprite

When creating the sprite, you can use optional arguments to change various properties, such as default color, size and opacity.

penny = new Sprite
  color: gray
  height: 50
  width: 75

Sprites can also be made to wear images using wear.

Sprites can be used as new actors when creating animations.