SpriteLibrary
SpriteLibrary
SpriteLibrary
Sprite Class
Sprite Properties
AnimationCount Property
AnimationDone Property
AnimationIndex Property
AutomaticallyMoves Property
BaseImageLocation Property
Destroying Property
FrameIndex Property
GetSize Property
GetVisibleSize Property
HasBeenDrawn Property
ID Property
MovingToPoint Property
Opacity Property
PictureBoxLocation Property
Rotation Property
SpriteName Property
SpriteOriginName Property
SpriteReachedEndPoint Property
VisibleHeight Property
VisibleWidth Property
Zvalue Property

# Sprite Properties

The Sprite type exposes the following members.

Properties

| Name | Description
--- | --- | ---
| AnimationCount | The number of animations this sprite has
| AnimationDone | Report whether or not the animation has been completed. When you tell a Sprite to AnimateOnce, this will report "false" until the animation sequence has been finished. At that time, the value will be "True." The tricky bit is that this is a boolean. If you have not told a sprite to animate once, it will always return "false." If a sprite is paused, this returns "false." The only time this returns "true" is when you tell a sprite to animate once, or animate a few times, and those times have completed. At that time, this will report "True". If you have a sprite with only one frame, it may not look like it is "animating", but it is. It is simply animating that one frame over and over. So, AnimationDone reports false, unless you have told it to animate_once.
| AnimationIndex | Get or set the animation nimber. It is best to change the animation using ChangeAnimation. It is safer.
| AutomaticallyMoves | Determine if the sprite automatically moves (you need to give it a direction [using one of the SetSpriteDirection functions] and speed [MovementSpeed = X] also)
| BaseImageLocation | The sprite location as found on the base image. This is usually the easiest location to use. Use this to figure out where the sprite is, but use the PutBaseImageLocation(Point) function to move it to another location.
| Destroying | If the Sprite is in the middle of being Destroyed, this is set to true. When a Sprite is Destroyed, it needs to erase itself and do some house-cleaning before it actually vanishes. During this time, you may not want to use it. It is always a good thing to verify a Sprite is not in the middle of being destroyed before you do something important with it. To Destroy a Sprite, use the Sprite.Destroy() function.
| FrameIndex | This is the frame of the current animation sequence. You can use this if you need to figure out what frame index to resume something at, or something like that.
| GetSize | Return the size of the sprite in reference to the image on which it is drawn. To get the size of the Sprite in relation to the PictureBox, use GetVisibleSize
| GetVisibleSize | Return the relative size of the Sprite in relation to the PictureBox. If the box has been stretched or shrunk, that affects the visible size of the sprite.
| HasBeenDrawn | Report whether or not this Sprite has been drawn. If it has, then it needs to be erased at some point in time.
| ID | The Sprite ID as specified by the sprite controller.
| MovingToPoint | Tells us if we are in the process of doing a MoveTo operation. This boolean should be the opposite of SpriteReachedEndpoint, but that boolean is poorly named. This is usually the easier one to use.
| Opacity | Set the opacity of the sprite. The value should be between 0 and 1. 1 is solid, 0 is transparent. Sometimes you want to drag a sprite around the map, or show a sprite that "could be there." Setting the sprite opacity is usually how you do that. One warning, however. The opacity value takes effect the next time it is drawn. If the sprite is animating rapidly, it will take effect nearly immediately. If it is not animating, not moving, or just sitting there, then it may not take effect for quite some time.
| PictureBoxLocation | The sprite location as found on the picture-box that this sprite is associated with. Used when dealing with mouse-clicks
| Rotation | Change the rotation of the sprite, using degrees. 0 degrees is to the right. 90 is up. 180 left, 270 down. But, if your sprite was drawn facing up, then rotating it 90 degrees will have it pointing left. The angle goes counter-clockwise. The image will be scaled such that it continues to fit within the rectangle that it was originally in. This results in a little bit of shrinking at times, but you should rarely notice that.
| SpriteName | The name of the sprite. Use SetSpriteName(Name) to change this name. Most Named sprites are used to define what a sprite is. Once you have created a named sprite, you usually use DuplicateSprite(String) to clone the sprite for use. The basic rule of thumb is to load your sprites from images once, and name the initial sprites. Then, when you go to use those sprites, get duplicates of them. The reason for this is because it takes more processing time to initially create the sprites than it takes to duplicate them.
| SpriteOriginName | Return the name of the sprite that this was duplicated from. A duplicated sprite will have no name, but will have a SpriteOriginName.
| SpriteReachedEndPoint | This is true unless we are using MoveTo(point) or MoveTo(list of points) to tell the sprite to move from one place to the next. This boolean tells us if it has finished or not.
| VisibleHeight | The visible Height as seen in the PictureBox. It may be stretched, or shrunk from the actual image size.
| VisibleWidth | The visible width as seen in the PictureBox. The Sprite may be stretched or shrunk from the actual image size.
| Zvalue | A number from 0 to 100. Default = 50. Higher numbers print on top of lower numbers. If you want a sprite to always be drawn on top of other sprites, give it a number higher than 50. If you want a sprite to go under other sprites, make its number lower than 50.

Top
See Also

#### Reference

Sprite Class
SpriteLibrary Namespace