EDIT:
// Ghost is the name of the class that creates the ghost sprite
// as well as where captureMovement() is in.
Ghost ghost = new Ghost();
// This update is in a class named turtle
public void Update(float scalingFactor, int[,] map)
{
// current position of the turtle on the tiles
int mapX = (int)(turtlePosition.X / scalingFactor);
int mapY = (int)(turtlePosition.Y / scalingFactor);
//The rest of the code that contains the captureMovement method being called
//looks the same as the if statement with just different directions.
if (Program.form.direction == "left")
{
ghost.captureMovement();
switch (turtleDirection)
{
case turtleFacingUp:
angle = 1.6f;
turtleDirection = turtleFacingRight;
Program.form.direction = "";
break;
case turtleFacingRight:
angle = 3.15f;
turtleDirection = turtleFacingDown;
Program.form.direction = "";
break;
case turtleFacingDown:
angle = -1.6f;
turtleDirection = turtleFacingLeft;
Program.form.direction = "";
break;
case turtleFacingLeft:
angle = 0.0f;
turtleDirection = turtleFacingUp;
Program.form.direction = "";
break;
}
}
}
// This update is in the game1 class (main class)
protected override void Update(GameTime gameTime)
{
// Allows the game to exit
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
this.Exit();
turtle.Update(scalingFactor, map);
ghost.UpdateGhost(scalingFactor, map);
base.Update(gameTime);
}