SpriteLibrary

# Sprite Events

The Sprite type exposes the following members.

Events

| Name | Description
--- | --- | ---
| CheckBeforeMove | This event fires off before a sprite is drawn. Use it if you have constraints. You can change the location or cancel the move entirely.
| Click | This event happens when someone clicks on the sprite (on the rectangle in which the sprite is). If you want the event to fire off only when someone clicks on the visible part of the sprite, use ClickTransparent instead.
| ClickTransparent | This event happens when someone clicks on the sprite (on the sprite image itself). If the sprite is sometimes hidden, but you want the click to work even if it is not visible at that instant, use Click instead.
| MouseEnter | When the mouse moves over the sprite. Use this for a menu, when you want the menu item to glow when the mouse is over the menu item sprite.
| MouseEnterTransparent | When the mouse moves over a non-transparent portoin of the sprite. Use this for a menu, when you want the menu item to glow when the mouse is over the menu item sprite.
| MouseHover | This event happens when the mouse moves over the sprite, and then pauses. We use the hover timing from the parent form.
| MouseHoverTransparent | This event happens when the mouse moves over a non-transparent portion of the sprite, and then pauses. We use the hover timing from the parent form.
| MouseLeave | When the mouse moves off the sprite. Use this for a menu, when you want the menu item to stop glowing when the mouse moves away from the menu item sprite.
| MouseLeaveTransparent | When the mouse moves off the non-transparent portion of the sprite. Use this for a menu, when you want the menu item to stop glowing when the mouse moves away from the menu item sprite.
| SpriteAnimationComplete | Only used when you tell an animation to animate once. At the end of the animation, this function fires off.
| SpriteArrivedAtEndPoint | An event for when you tell a Sprite to MoveTo(Point) a specific point, or, when you tell the Sprite to MoveTo(list of points). When the Sprite has reached the final destination, the Sprite fires off this event.
| SpriteArrivedAtWaypoint | When you tell a sprite to MoveTo(list of points), this fires off every time it gets to one of the points. When it gets to the final point, only the SpriteAtEndPoint event fires off.
| SpriteBeingDestroyed | The Sprite has just been told to be destroyed. You might want to do some cleanup. If you need to destroy some payload data, or tell something to cleanup after the sprite this is where to do that.
| SpriteChangesAnimationFrames | When the frame of an animation changes. If you want to have something happen every time the foot of your monster comes down, when the swing of your sword is at certain points, etc. Check to see that the Animaton and FrameIndex are what you expect them to be.
| SpriteExitsPictureBox | This happens when the sprite has exited the picture box. Useful when you want to keep sprites from traveling on forever after exiting.
| SpriteHitsPictureBox | This happens when the sprite hits the border of the picture-box. Useful for when you want to have shots explode when they hit the side.
| SpriteHitsSprite | This happens when two sprites hit each-other. The SpriteEventArgs that is returned contains the sprite that this sprite hits.
| SpriteInitializes | This event happens right after the sprite is created. Use this to immediately set a sprite to animate once or something like that.

Top
See Also

#### Reference

Sprite Class
SpriteLibrary Namespace