SpriteControllerDuplicateSprite Method (String) |
Find a sprite that has been named with the specified name. Then duplicate that sprite. If you have
SpriteControllers which are linked (see
SpriteController.LinkControllersForSpriteTemplateSharing for how to do this), if the Sprite template is
not contained in this controller, it is looked up in any linked controllers.
Namespace:
SpriteLibrary
Assembly:
SpriteLibrary (in SpriteLibrary.dll) Version: 1.0.0.6 (1.0.0.6)
Syntaxpublic Sprite DuplicateSprite(
string Name
)
Parameters
- Name
- Type: SystemString
The name of a sprite
Return Value
Type:
SpriteA duplicate of the specified sprite. It has no location, and does not retain the sprite name.
Examples
Below is a function that creates a sprite based off a name, and puts it at the designated coordinates.
public void AddSprite(string name, int startx, int starty)
{
Sprite NewSprite = MySpriteController.DuplicateSprite(What.ToString());
if(NewSprite != null)
{
NewSprite.AutomaticallyMoves = true;
NewSprite.CannotMoveOutsideBox = true;
NewSprite.SetSpriteDirectionDegrees(180);
NewSprite.PutBaseImageLocation(new Point(startx, starty));
NewSprite.MovementSpeed = 5;
}
}
See Also