Skip to content

Structure of Scratch Script

Scratch Script is created to embody the functionality of base Scratch, so there must be some way to implement sprites.

Sprites

This functionality is accomplished in Scratch Script by the use of the sprite keyword.

1
2
3
4
5
sprite Stage{}

sprite cat{}

sprite thing{}

The text that comes after sprite will be the name of the sprite.

For example the sprite created on line 3 would be called 'cat'.

If the sprite name is Stage, the sprite is the stage and will have all of it's functionality (including it's lack of position)

Attributes of Sprites

Sprites have attributes such as their costumes or scripts.

sprite cat{
    script{}
    costumes{}
}

Scripts

Inside of scripts, there are functions and commands that are created from top to bottom

sprite cat{
    script{
        start();
        move(10);
    }
}

For more information, go to Scripts

Costumes

Inside of the costumes attribute there is a list of file paths to images. The resulting name of the costume in the scratch website when imported is the filename without the extension.

sprite cat{
    costumes{
        "cat1.svg",
        "foldername/filename.svg"
    }
}

For example, the path "folder1/bestImage.svg" would result in a costume named "bestImage".

Currently the only file extension implemented is svg