E
Elgrym
Guest
How can i use the original value of x1 in the second while loop? Any way to reset the variable to it´s original state?
Game.ShowSceneAndAddTurtle();
double x1 = Game.SceneBounds.Left;
double x2 = Game.SceneBounds.Right;
double y1 = Game.SceneBounds.Top;
double y2 = Game.SceneBounds.Bottom;
Turtle.Say("Horizontal saw");
Turtle.MoveTo(x1,0);
Turtle.TurnOnPen();
Turtle.SetPenColor(RGBAColors.Red);
while (x1 < x2)
{
Turtle.MoveBy(50, 50);
Turtle.MoveDown(50);
x1 = x1 + 50;
}
Turtle.Say($"{x1}");
Turtle.TurnOffPen();
Turtle.MoveToCenter();
Turtle.Sleep(5000);
Game.ClearScene();
Turtle.MoveTo(0, y1);
Turtle.TurnOnPen();
while (y1 > y2)
{
Turtle.MoveBy(50, -50);
Turtle.MoveLeft(50);
y1 = y1 - 50;
}
y1 = y1 * -1;
Turtle.TurnOffPen();
Turtle.MoveToCenter();
Turtle.Sleep(5000);
Game.ClearScene();
Continue reading...
Game.ShowSceneAndAddTurtle();
double x1 = Game.SceneBounds.Left;
double x2 = Game.SceneBounds.Right;
double y1 = Game.SceneBounds.Top;
double y2 = Game.SceneBounds.Bottom;
Turtle.Say("Horizontal saw");
Turtle.MoveTo(x1,0);
Turtle.TurnOnPen();
Turtle.SetPenColor(RGBAColors.Red);
while (x1 < x2)
{
Turtle.MoveBy(50, 50);
Turtle.MoveDown(50);
x1 = x1 + 50;
}
Turtle.Say($"{x1}");
Turtle.TurnOffPen();
Turtle.MoveToCenter();
Turtle.Sleep(5000);
Game.ClearScene();
Turtle.MoveTo(0, y1);
Turtle.TurnOnPen();
while (y1 > y2)
{
Turtle.MoveBy(50, -50);
Turtle.MoveLeft(50);
y1 = y1 - 50;
}
y1 = y1 * -1;
Turtle.TurnOffPen();
Turtle.MoveToCenter();
Turtle.Sleep(5000);
Game.ClearScene();
Continue reading...