MoveToAccurate
Introduction
Code Example
using FlatRedBall;
using FlatRedBall.Input;
using FlatRedBall.Instructions; // to show the cursor
IsMouseVisible = true; void CustomActivity()
{
// The number of seconds to take to move to where the user
// clicks.
float secondsToTake = 2;
// A button release is a "click".
// Don't create new movement instructions if there are
// already other movement instructions - things can get wacky.
if (InputManager.Mouse.ButtonReleased(
FlatRedBall.Input.Mouse.MouseButtons.LeftButton) &&
SpriteInstance.Instructions.Count == 0)
{
// We could create the Instructions ourselves, but the
// InstructionManager makes things easy.
InstructionManager.MoveToAccurate(SpriteInstance,
InputManager.Mouse.WorldXAt(SpriteInstance.Z),
InputManager.Mouse.WorldYAt(SpriteInstance.Z),
SpriteInstance.Z,
secondsToTake);
}
}Last updated
Was this helpful?