Click or drag to resize
Sprite Events

The Sprite type exposes the following members.

Events
  NameDescription
Public eventCheckBeforeMove
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.
Public eventClick
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.
Public eventClickTransparent
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.
Public eventMouseEnter
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.
Public eventMouseEnterTransparent
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.
Public eventMouseHover
This event happens when the mouse moves over the sprite, and then pauses. We use the hover timing from the parent form.
Public eventMouseHoverTransparent
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.
Public eventMouseLeave
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.
Public eventMouseLeaveTransparent
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.
Public eventSpriteAnimationComplete
Only used when you tell an animation to animate once. At the end of the animation, this function fires off.
Public eventSpriteArrivedAtEndPoint
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.
Public eventSpriteArrivedAtWaypoint
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.
Public eventSpriteBeingDestroyed
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.
Public eventSpriteChangesAnimationFrames
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.
Public eventSpriteExitsPictureBox
This happens when the sprite has exited the picture box. Useful when you want to keep sprites from traveling on forever after exiting.
Public eventSpriteHitsPictureBox
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.
Public eventSpriteHitsSprite
This happens when two sprites hit each-other. The SpriteEventArgs that is returned contains the sprite that this sprite hits.
Public eventSpriteInitializes
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