Skip to content
Tesserex edited this page Jan 24, 2012 · 1 revision

The sprite component gives an entity the ability to appear on the screen using sprites. The component can control which sprite is showing at a given time, the palette used, and more.

For information on how to define sprites, see the Sprite page. This page focuses on the commands available to control them.

##Usage

Like all components, the commands are enclosed in a parent Sprite tag.

<Sprite>
    <Name>Standing</Name>
</Sprite>

###Name

As shown in the example above, the Name tag tells the component to switch sprites. The content of the tag is the name of the sprite to use, as defined in the "name" attribute of the sprite definition.

###Group

The Group tag is poorly named from the early days. It should really say "Palette". It causes the sprite to switch palettes, but it keeps the sprite at its current frame of playback. For example, it is used for Mega Man's charging animation:

<Trigger>
    <Condition>Timer.Value("ChargeLow") == 4</Condition>
    <Effect>
        <Sprite>
            <Group>Charge1</Group>
        </Sprite>
    </Effect>
</Trigger>

For more information about the tags used in the above example, see Triggers and Timers.

###Playing

The Playing tag starts and stops the playing of the sprite. The contents should be either "True" or "False" (case insensitive.) Animation will stop at the current frame and not reset to the first frame. This is used, for example, when Mega Man climbs a ladder.

<Trigger>
    <States>Climbing, ClimbTop</States>
    <Condition>Input.Up == False And Input.Down == False</Condition>
    <Effect>
        <Movement><Y magnitude="0" /></Movement>
        <Sprite>
            <Playing>False</Playing>
        </Sprite>
    </Effect>
</Trigger>

###Visible

The Visible tag controls the visibility of the sprite. Like the Playing command, it takes a boolean "True" or "False". One use of this is in controlling Yoku (disappearing) blocks.

<State name="Show">
    <Sprite>
        <Visible>True</Visible>
    </Sprite>
    ...
</State>