SpriteLibrary
SpriteLibrary
SpriteLibrary
Sprite Class
Sprite Events
CheckBeforeMove Event
Click Event
ClickTransparent Event
MouseEnter Event
MouseEnterTransparent Event
MouseHover Event
MouseHoverTransparent Event
MouseLeave Event
MouseLeaveTransparent Event
SpriteAnimationComplete Event
SpriteArrivedAtEndPoint Event
SpriteArrivedAtWaypoint Event
SpriteBeingDestroyed Event
SpriteChangesAnimationFrames Event
SpriteExitsPictureBox Event
SpriteHitsPictureBox Event
SpriteHitsSprite Event
SpriteInitializes Event

# Sprite SpriteAnimationComplete Event

Only used when you tell an animation to animate once. At the end of the animation, this function fires off. In the AdvDemo example, the dragon sprite has multiple animations. At the end of each of them, the game randomly chooses which animation to show next. And, it even chooses, every once in a while, to breathe fire.

Namespace: SpriteLibrary
Assembly: SpriteLibrary (in SpriteLibrary.dll) Version: 1.0.0.6 (1.0.0.6)
Syntax
C#
Copy

    public event SpriteSpriteEventHandler SpriteAnimationComplete

#### Value

Type: SpriteLibrary
Sprite
SpriteEventHandler
Examples
Here is an example of us defining an explosion Sprite. We retrieve a named Sprite and set the function on the master template to call the SpriteDoneAnimating function whenever the Sprite animation has finished. Because it is an "explosion", we want to destroy the sprite once it has finished. We do not want the Sprite to explode over and over and over, we do it once, and then it is done.

You only need to add the function once, if you are putting it on the Named Sprite. After that time, all the sprites duplicated from the template will have this function set for them.
Copy

    public void DefineSprite()
    {
        Sprite mySprite = MySpriteController.SpriteFromName("Explosion");
        mySprite.SpriteAnimationComplete += SpriteDoneAnimating;
    }

    public void MakeAnExplosion(Point Where)
    {
        Sprite mySprite = MySpriteController.DuplicateSprite("Explosion");
        mySprite.PutBaseImageLocation(Where);
        mySprite.AnimateOnce();
    }

    public void SpriteDoneAnimating(object sender, EventArgs e)
    {
       Sprite me = (Sprite)sender;
       me.Destroy();
    }

See Also

#### Reference

Sprite Class
SpriteLibrary Namespace