SpriteLibrary
SpriteLibrary
SpriteLibrary
Sprite Class
Sprite Methods
MoveTo Method
MoveTo Method (List(Point))
MoveTo Method (Point)
MoveTo Method (Sprite)

# Sprite MoveTo Method (Point)

Tell the Sprite to move towards a destination. You need to give the sprite a MovementSpeed and tell the sprite that it can automatically move. But the sprite will begin a journey towards that point at the MovementSpeed you have set. When it gets to the point, the SpriteArrivedAtEndPoint event will fire off. Also, the SpriteReachedEnd bool will be true.

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

    public void MoveTo(
    	Point Destination
    )

#### Parameters

Destination
  Type: System.Drawing
  Point
  An image-point that the sprite will move to.

Examples
In this example, we are creating a missile sprite and shooting it to where the target sprite currently is. The target may move away and we might miss it entirely.
C#
Copy

    Sprite NewSprite = MySpriteController.DuplicateSprite("Missile");
    NewSprite.AutomaticallyMoves = true;
    NewSprite.PutBaseImageLocation(new Point(startx, starty));
    NewSprite.MoveTo(TargetSprite.BaseImageLocation);
    NewSprite.MovementSpeed = speed;

See Also

#### Reference

Sprite Class
MoveTo Overload
SpriteLibrary Namespace