SpriteMoveTo Method (Sprite) |
Move to where the destination sprite currently is at. This is a dumb move. It does not take into
consideration the movement direction of the destination sprite. So the moving sprite does need to be
moving a bit faster than the sprite you are trying to hit for it to do so.
Namespace:
SpriteLibrary
Assembly:
SpriteLibrary (in SpriteLibrary.dll) Version: 1.0.0.6 (1.0.0.6)
Syntaxpublic void MoveTo(
Sprite Destination
)
Parameters
- Destination
- Type: SpriteLibrarySprite
The sprite we are trying to hit
Examples
In this example we are creating a "heat seaking" missile that will find the target sprite, regardless
of where it moves. The missile will move in a straight line from where it is to where the target sprite is,
regardless of where the target sprite moves to. It readjusts the movement direction quite often, so it
is very difficult to dodge. Use this only when you really want the thing to hit.
Sprite NewSprite = MySpriteController.DuplicateSprite("Missile");
NewSprite.AutomaticallyMoves = true;
NewSprite.PutBaseImageLocation(new Point(startx, starty));
NewSprite.MoveTo(TargetSprite);
NewSprite.MovementSpeed = speed;
See Also