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

# Sprite MoveTo Method (List Point )

Tell the sprite to move towards each point in turn. The sprite will move in a straight line until the first point. From there it moves to the next point, until it has reached the last point. Every time it reaches a point, the SpriteArrivedAtWaypoint event is triggered. When it reaches the final point in the list, the SpriteArrivedAtEndPoint event is triggered. While the sprite is moving, the SpriteReachedEndPoint attribute is set to false. When it has arrived, it is set to true.

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

    public void MoveTo(
    	List<Point> DestinationList
    )

#### Parameters

DestinationList
  Type: System.Collections.Generic
  List
  Point
  A list of Image-Points that the sprite will follow, one after the other

Examples
In this example, we are creating a missile sprite and giving it a path to follow to get where we want it to go. The path is somewhat curved. The missile will fly straight between each of the different points listed.
C#
Copy

    Sprite NewSprite = MySpriteController.DuplicateSprite("Missile");
    NewSprite.AutomaticallyMoves = true;
    NewSprite.PutBaseImageLocation(new Point(100, 100));
    List<Point> MyWaypoints = new List<Point>();
    MyWaypoints.Add(new Point(100,100));
    MyWaypoints.Add(new Point(120, 90));
    MyWaypoints.Add(new Point(130, 80));
    MyWaypoints.Add(new Point(140, 90));
    MyWaypoints.Add(new Point(180,100));
    NewSprite.MoveTo(TargetSprite.BaseImageLocation);
    NewSprite.MovementSpeed = speed;

See Also

#### Reference

Sprite Class
MoveTo Overload
SpriteLibrary Namespace