Click or drag to resize

Sprite Properties

The Sprite type exposes the following members.

Properties
  NameDescription
Public propertyAnimationCount
The number of animations this sprite has
Public propertyAnimationDone
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.
Public propertyAnimationIndex
Get or set the animation nimber. It is best to change the animation using ChangeAnimation. It is safer.
Public propertyAutomaticallyMoves
Determine if the sprite automatically moves (you need to give it a direction [using one of the SetSpriteDirection functions] and speed [MovementSpeed = X] also)
Public propertyBaseImageLocation
The sprite location as found on the base image. This is usually the easiest location to use.
Public propertyDestroying
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.
Public propertyFrameIndex
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.
Public propertyGetSize
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
Public propertyGetVisibleSize
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.
Public propertyHasBeenDrawn
Report whether or not this Sprite has been drawn. If it has, then it needs to be erased at some point in time.
Public propertyID
The Sprite ID as specified by the sprite controller.
Public propertyMovingToPoint
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.
Public propertyOpacity
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 emmediately. If it is not animating, not moving, or just sitting there, then it may not take effect for quite some time.
Public propertyPictureBoxLocation
The sprite location as found on the picture-box that this sprite is associated with. Used when dealing with mouse-clicks
Public propertyRotation
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.
Public propertySpriteName
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.
Public propertySpriteOriginName
Return the name of the sprite that this was duplicated from. A duplicated sprite will have no name, but will have a SpriteOriginName.
Public propertySpriteReachedEndPoint
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.
Public propertyVisibleHeight
The visible Height as seen in the PictureBox. It may be stretched, or shrunk from the actual image size.
Public propertyVisibleWidth
The visible width as seen in the PictureBox. The Sprite may be stretched or shrunk from the actual image size.
Public propertyZvalue
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