SpriteLibrary

SpriteController DuplicateSprite Method (String)

Find a sprite that has been named with the specified name. Then duplicate that sprite

Namespace: SpriteLibrary
Assembly: SpriteLibrary (in SpriteLibrary.dll) Version: 1.0.0.5 (1.0.0.5)
Syntax
C#
Copy

    public Sprite DuplicateSprite(
    	string Name
    )

#### Parameters

Name
  Type: System
  String
  The name of a sprite

#### Return Value

Type: Sprite
A 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.
C#
Copy

    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); //left
             NewSprite.PutBaseImageLocation(new Point(startx, starty));
             NewSprite.MovementSpeed = 5;
         }
    }

See Also

#### Reference

SpriteController Class
DuplicateSprite Overload
SpriteLibrary Namespace