Skip to content

ZestSprite

Kevin Cross edited this page Apr 18, 2023 · 2 revisions

Available Functions

ZestCreateSprite(zestWidgetParameters as string)

Creates a sprite and returns a sprite ID. See Available Parameters section below for the options.

ZestPinSpriteToBottomCentreOfSprite(zestSpriteA as integer, zestSpriteB as integer, zestOffsetX as float, zestOffsetY as float)

Pins a sprite to the bottom centre of another sprite. Allows an offset to be set.

ZestPinSpriteToBottomLeftOfSprite(zestSpriteA as integer, zestSpriteB as integer, zestOffsetX as float, zestOffsetY as float)

Pins a sprite to the bottom left of another sprite. Allows an offset to be set.

ZestPinSpriteToBottomRightOfSprite(zestSpriteA as integer, zestSpriteB as integer, zestOffsetX as float, zestOffsetY as float)

Pins a sprite to the bottom right of another sprite. Allows an offset to be set.

ZestPinSpriteToCentreLeftOfSprite(zestSpriteA as integer, zestSpriteB as integer, zestOffsetX as float, zestOffsetY as float)

Pins a sprite to the centre left of another sprite. Allows an offset to be set.

ZestPinSpriteToCentreOfSprite(zestSpriteA as integer, zestSpriteB as integer, zestOffsetX as float, zestOffsetY as float)

Pins a sprite to the centre of another sprite. Allows an offset to be set.

ZestPinSpriteToCentreRightOfSprite(zestSpriteA as integer, zestSpriteB as integer, zestOffsetX as float, zestOffsetY as float)

Pins a sprite to the centre right of another sprite. Allows an offset to be set.

ZestPinSpriteToSprite(zestSpriteA as integer, zestSpriteB as integer, zestOffsetX as float, zestOffsetY as float)

Pins a sprite to another sprite. Allows an offset to be set.

ZestPinSpriteToTopCentreOfSprite(zestSpriteA as integer, zestSpriteB as integer, zestOffsetX as float, zestOffsetY as float)

Pins a sprite to top centre of another sprite. Allows an offset to be set.

ZestPinSpriteToTopLeftOfSprite(zestSpriteA as integer, zestSpriteB as integer, zestOffsetX as float, zestOffsetY as float)

Pins a sprite to top left of another sprite. Allows an offset to be set.

ZestPinSpriteToTopRightOfSprite(zestSpriteA as integer, zestSpriteB as integer, zestOffsetX as float, zestOffsetY as float)

Pins a sprite to top right of another sprite. Allows an offset to be set.

ZestUpdateSprite(zestSpriteID as integer, zestWidgetParameters as string)

Updates a sprite. See Available Parameters section below for the options.

Available Parameters (all optional)

Parameter Description
angle The angle of the sprite.
color The colour of the sprite. Accepts RGB values, and RGBA values (comma delimited) Also accepts MakeColor() value/id, and hex color codes.
depth The depth of the sprite.
fixToScreen Fixes the sprite to screen.
group The group the sprite belongs to.
height The height of the sprite. Accepts decimals.
imageID Apply an image to the sprite. Requires a LoadImage() value/id.
offset The x and y position where the offset should be placed, comma delimited. Also accepts any of these case in-sensitive single values: 'bottomCenter', 'bottomLeft', 'bottomRight', 'center', 'centerLeft', 'centerRight', 'topCenter', 'topLeft', 'topRight'. Accepts decimals.
position The x and y position where the sprite should be placed, comma delimited.
size The width and height of the sprite, comma delimited. Also accepts -1 in either one to create a square sprite. Accepts decimals.
spriteShader Apply a sprite shader to the sprite. Requires a LoadSpriteShader() value/id.
width The width of the sprite. Accepts decimals.
x The x position where the sprite should be placed.
y The y position where the sprite should be placed.

Example Code

Example

sprBox1 as integer : sprBox1 = ZestCreateSprite("size:20,-1;color:231,76,60;offset:center;angle:45;position:50,50")
sprBox2 as integer : sprBox2 = ZestCreateSprite("size:10,-1;color:230,126,34;offset:center")
sprBox3 as integer : sprBox3 = ZestCreateSprite("size:5,-1;color:241,196,15;offset:center")
sprBox4 as integer : sprBox4 = ZestCreateSprite("size:5,-1;color:241,196,15;offset:center")
ZestPinSpriteToCentreOfSprite(sprBox2, sprBox1, 0, 0)
ZestPinSpriteToCentreLeftOfSprite(sprBox3, sprBox2, 0, 0)
ZestPinSpriteToCentreRightOfSprite(sprBox4, sprBox2, 0, 0)

do
    angle# = angle# + 1
    ZestUpdateSprite(sprBox3, "angle:" + str(angle#))
    ZestUpdateSprite(sprBox4, "angle:" + str(angle#))
	
    ZestSync()
loop

Clone this wiki locally