Sprite
A sprite: a movable target with a position, size and orientation. Extends
Target, so it has all the costume, sound, variable, list and
block members documented there — this page covers only the sprite-specific
additions.
Get a sprite from project.sprite(name),
project.sprites, or project.addSprite(...).
Accessors
All are get/set, all coerce on assignment, and all read through to
sprite.json.
sprite.isStage
- Type:
false(getter) — alwaysfalse. DiscriminatesSpritefromStagein the union.
sprite.x
- Type:
number— X position on the stage (−240…240). Default0.
sprite.y
- Type:
number— Y position on the stage (−180…180). Default0.
sprite.size
- Type:
number— size as a percentage (100 = original). Default100.
sprite.direction
- Type:
number— direction in degrees (90 = pointing right). Default90.
sprite.visible
- Type:
boolean— whether the sprite is shown. Defaulttrue.
sprite.draggable
- Type:
boolean— whether the sprite can be dragged in the player. Defaultfalse.
sprite.rotationStyle
- Type:
string— one ofall around,left-right,don't rotate. Defaultall around.
sprite.layerOrder
- Type:
number— stacking order; higher draws on top. New sprites fromaddSpriteare placed above every existing target.
Inherited from Target
Name, volume, costumes, sounds, variables, lists and blocks all come from
Target. For example: