SpriteMoveTo 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)
Syntaxpublic void MoveTo(
Point Destination
)
Parameters
- Destination
- Type: System.DrawingPoint
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.
Sprite NewSprite = MySpriteController.DuplicateSprite("Missile");
NewSprite.AutomaticallyMoves = true;
NewSprite.PutBaseImageLocation(new Point(startx, starty));
NewSprite.MoveTo(TargetSprite.BaseImageLocation);
NewSprite.MovementSpeed = speed;
See Also