How to start my shapes moving after my first shape has made it's move












0















So the problem is that after i completed the movement of my first shape i want to start moving my other shapes but when i compile my program they move at the same time . I tried to use 2 different timers to stop the first one and start the other but the result will be the same or one of the shapes will not move at all.
The goal is to make an illustration of Pythagora's theorem. Here is my program:



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp14
{
public partial class Form1 : Form
{
Bitmap myBitmap;
Graphics g;

int c = 147;

private int X1Green, X2Green, Y1Green, Y2Green;//These variables are the coordinates of the Green Triangle which will be used to move it
private int X1Blue, X2Blue;// These variables are the coordinates of the Blue Triangle which will be used to move it
private int Y1PaleGreen, Y2PaleGreen;//These variables are the coordinates of the Pale Green Triangle which will be used to move it
Timer timer1;
Timer timer2;


public Form1()
{
InitializeComponent();

X1Green = 450;
X2Green = 380;
Y1Green = 120;
Y2Green = 250;


X1Blue = 380;
X2Blue = 250;


Y1PaleGreen = 50;
Y2PaleGreen = 120;
}

private void Form1_Load(object sender, EventArgs e)
{

timer1 = new Timer();
timer1.Tick += new EventHandler(timer1_Tick);
timer1.Start();


timer2 = new Timer();
timer2.Tick += new EventHandler(timer2_Tick);
// timer2.Start();
}



private void timer1_Tick(object sender, EventArgs e)
{

// Moving the Green Triangle Diagonally to the Light Blue Triangle
if (Y1Green > 50) { Y1Green -= 3; }
if (X1Green > 320) { X1Green -= 5; }
if (X2Green > 250) { X2Green -= 5; }
if (Y2Green > 180) { Y2Green -= 3; }


Draw();

timer2.Start();


}

private void timer2_Tick(object sender, EventArgs e)
{

//Moving our Blue Triangle
if (X1Blue < 450) { X1Blue += 2; }
if (X2Blue < 320) { X2Blue += 2; }

//Moving our Pale Green Triangle
if (Y1PaleGreen < 180) { Y1PaleGreen += 4; }
if (Y2PaleGreen < 250) { Y2PaleGreen += 4; }

// Draw();

}

private void Draw()
{
int a = 70;
int b = 130;
//double c = Math.Sqrt(Math.Pow(a, 2) + Math.Pow(b, 2));
int c = 147;

myBitmap = new Bitmap(pictureBox1.Width, pictureBox1.Height);

Graphics g = Graphics.FromImage(myBitmap);
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

Pen mypen = new Pen(Color.Black, 2);// drawing the rectangle to illustrate inside of it the theorem of Pythagoras
g.DrawRectangle(mypen, 250, 50, 200, 200);

SolidBrush LightBlue = new SolidBrush(Color.LightBlue);
SolidBrush Blue = new SolidBrush(Color.Blue);
SolidBrush PaleGreen = new SolidBrush(Color.PaleGreen);
SolidBrush Green = new SolidBrush(Color.Green);







//Drawing the the Light Blue Triangle at the top left corner of the rectangle
g.FillPolygon(LightBlue, new Point{
new Point(250,50), new Point(250,180), new Point(320,50)
});




pictureBox1.BackgroundImage = myBitmap;

//Drawing the Pale Green Triangle at the top right corner of the rectangle
g.FillPolygon(PaleGreen, new Point {
new Point(320,Y1PaleGreen), new Point( 450,Y1PaleGreen ), new Point( 450, Y2PaleGreen)
});

//Drawing the Green Triangle at the bottom right corner of the rectangle
g.FillPolygon(Green, new Point
{
new Point( X1Green, Y1Green ), new Point( X1Green,Y2Green), new Point(X2Green,Y2Green)
});

//Drawing the Blue Triangle at the bottom left corner of the rectangle
g.FillPolygon(Blue, new Point
{
new Point(X1Blue,250), new Point(X2Blue,250), new Point(X2Blue,180)
});


}
}
}


By the way the variables a, b and c i only wrote them to remind myself how much is the length of the sides of each right triangle.










share|improve this question



























    0















    So the problem is that after i completed the movement of my first shape i want to start moving my other shapes but when i compile my program they move at the same time . I tried to use 2 different timers to stop the first one and start the other but the result will be the same or one of the shapes will not move at all.
    The goal is to make an illustration of Pythagora's theorem. Here is my program:



    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;

    namespace WindowsFormsApp14
    {
    public partial class Form1 : Form
    {
    Bitmap myBitmap;
    Graphics g;

    int c = 147;

    private int X1Green, X2Green, Y1Green, Y2Green;//These variables are the coordinates of the Green Triangle which will be used to move it
    private int X1Blue, X2Blue;// These variables are the coordinates of the Blue Triangle which will be used to move it
    private int Y1PaleGreen, Y2PaleGreen;//These variables are the coordinates of the Pale Green Triangle which will be used to move it
    Timer timer1;
    Timer timer2;


    public Form1()
    {
    InitializeComponent();

    X1Green = 450;
    X2Green = 380;
    Y1Green = 120;
    Y2Green = 250;


    X1Blue = 380;
    X2Blue = 250;


    Y1PaleGreen = 50;
    Y2PaleGreen = 120;
    }

    private void Form1_Load(object sender, EventArgs e)
    {

    timer1 = new Timer();
    timer1.Tick += new EventHandler(timer1_Tick);
    timer1.Start();


    timer2 = new Timer();
    timer2.Tick += new EventHandler(timer2_Tick);
    // timer2.Start();
    }



    private void timer1_Tick(object sender, EventArgs e)
    {

    // Moving the Green Triangle Diagonally to the Light Blue Triangle
    if (Y1Green > 50) { Y1Green -= 3; }
    if (X1Green > 320) { X1Green -= 5; }
    if (X2Green > 250) { X2Green -= 5; }
    if (Y2Green > 180) { Y2Green -= 3; }


    Draw();

    timer2.Start();


    }

    private void timer2_Tick(object sender, EventArgs e)
    {

    //Moving our Blue Triangle
    if (X1Blue < 450) { X1Blue += 2; }
    if (X2Blue < 320) { X2Blue += 2; }

    //Moving our Pale Green Triangle
    if (Y1PaleGreen < 180) { Y1PaleGreen += 4; }
    if (Y2PaleGreen < 250) { Y2PaleGreen += 4; }

    // Draw();

    }

    private void Draw()
    {
    int a = 70;
    int b = 130;
    //double c = Math.Sqrt(Math.Pow(a, 2) + Math.Pow(b, 2));
    int c = 147;

    myBitmap = new Bitmap(pictureBox1.Width, pictureBox1.Height);

    Graphics g = Graphics.FromImage(myBitmap);
    g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

    Pen mypen = new Pen(Color.Black, 2);// drawing the rectangle to illustrate inside of it the theorem of Pythagoras
    g.DrawRectangle(mypen, 250, 50, 200, 200);

    SolidBrush LightBlue = new SolidBrush(Color.LightBlue);
    SolidBrush Blue = new SolidBrush(Color.Blue);
    SolidBrush PaleGreen = new SolidBrush(Color.PaleGreen);
    SolidBrush Green = new SolidBrush(Color.Green);







    //Drawing the the Light Blue Triangle at the top left corner of the rectangle
    g.FillPolygon(LightBlue, new Point{
    new Point(250,50), new Point(250,180), new Point(320,50)
    });




    pictureBox1.BackgroundImage = myBitmap;

    //Drawing the Pale Green Triangle at the top right corner of the rectangle
    g.FillPolygon(PaleGreen, new Point {
    new Point(320,Y1PaleGreen), new Point( 450,Y1PaleGreen ), new Point( 450, Y2PaleGreen)
    });

    //Drawing the Green Triangle at the bottom right corner of the rectangle
    g.FillPolygon(Green, new Point
    {
    new Point( X1Green, Y1Green ), new Point( X1Green,Y2Green), new Point(X2Green,Y2Green)
    });

    //Drawing the Blue Triangle at the bottom left corner of the rectangle
    g.FillPolygon(Blue, new Point
    {
    new Point(X1Blue,250), new Point(X2Blue,250), new Point(X2Blue,180)
    });


    }
    }
    }


    By the way the variables a, b and c i only wrote them to remind myself how much is the length of the sides of each right triangle.










    share|improve this question

























      0












      0








      0








      So the problem is that after i completed the movement of my first shape i want to start moving my other shapes but when i compile my program they move at the same time . I tried to use 2 different timers to stop the first one and start the other but the result will be the same or one of the shapes will not move at all.
      The goal is to make an illustration of Pythagora's theorem. Here is my program:



      using System;
      using System.Collections.Generic;
      using System.ComponentModel;
      using System.Data;
      using System.Drawing;
      using System.Linq;
      using System.Text;
      using System.Threading.Tasks;
      using System.Windows.Forms;

      namespace WindowsFormsApp14
      {
      public partial class Form1 : Form
      {
      Bitmap myBitmap;
      Graphics g;

      int c = 147;

      private int X1Green, X2Green, Y1Green, Y2Green;//These variables are the coordinates of the Green Triangle which will be used to move it
      private int X1Blue, X2Blue;// These variables are the coordinates of the Blue Triangle which will be used to move it
      private int Y1PaleGreen, Y2PaleGreen;//These variables are the coordinates of the Pale Green Triangle which will be used to move it
      Timer timer1;
      Timer timer2;


      public Form1()
      {
      InitializeComponent();

      X1Green = 450;
      X2Green = 380;
      Y1Green = 120;
      Y2Green = 250;


      X1Blue = 380;
      X2Blue = 250;


      Y1PaleGreen = 50;
      Y2PaleGreen = 120;
      }

      private void Form1_Load(object sender, EventArgs e)
      {

      timer1 = new Timer();
      timer1.Tick += new EventHandler(timer1_Tick);
      timer1.Start();


      timer2 = new Timer();
      timer2.Tick += new EventHandler(timer2_Tick);
      // timer2.Start();
      }



      private void timer1_Tick(object sender, EventArgs e)
      {

      // Moving the Green Triangle Diagonally to the Light Blue Triangle
      if (Y1Green > 50) { Y1Green -= 3; }
      if (X1Green > 320) { X1Green -= 5; }
      if (X2Green > 250) { X2Green -= 5; }
      if (Y2Green > 180) { Y2Green -= 3; }


      Draw();

      timer2.Start();


      }

      private void timer2_Tick(object sender, EventArgs e)
      {

      //Moving our Blue Triangle
      if (X1Blue < 450) { X1Blue += 2; }
      if (X2Blue < 320) { X2Blue += 2; }

      //Moving our Pale Green Triangle
      if (Y1PaleGreen < 180) { Y1PaleGreen += 4; }
      if (Y2PaleGreen < 250) { Y2PaleGreen += 4; }

      // Draw();

      }

      private void Draw()
      {
      int a = 70;
      int b = 130;
      //double c = Math.Sqrt(Math.Pow(a, 2) + Math.Pow(b, 2));
      int c = 147;

      myBitmap = new Bitmap(pictureBox1.Width, pictureBox1.Height);

      Graphics g = Graphics.FromImage(myBitmap);
      g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

      Pen mypen = new Pen(Color.Black, 2);// drawing the rectangle to illustrate inside of it the theorem of Pythagoras
      g.DrawRectangle(mypen, 250, 50, 200, 200);

      SolidBrush LightBlue = new SolidBrush(Color.LightBlue);
      SolidBrush Blue = new SolidBrush(Color.Blue);
      SolidBrush PaleGreen = new SolidBrush(Color.PaleGreen);
      SolidBrush Green = new SolidBrush(Color.Green);







      //Drawing the the Light Blue Triangle at the top left corner of the rectangle
      g.FillPolygon(LightBlue, new Point{
      new Point(250,50), new Point(250,180), new Point(320,50)
      });




      pictureBox1.BackgroundImage = myBitmap;

      //Drawing the Pale Green Triangle at the top right corner of the rectangle
      g.FillPolygon(PaleGreen, new Point {
      new Point(320,Y1PaleGreen), new Point( 450,Y1PaleGreen ), new Point( 450, Y2PaleGreen)
      });

      //Drawing the Green Triangle at the bottom right corner of the rectangle
      g.FillPolygon(Green, new Point
      {
      new Point( X1Green, Y1Green ), new Point( X1Green,Y2Green), new Point(X2Green,Y2Green)
      });

      //Drawing the Blue Triangle at the bottom left corner of the rectangle
      g.FillPolygon(Blue, new Point
      {
      new Point(X1Blue,250), new Point(X2Blue,250), new Point(X2Blue,180)
      });


      }
      }
      }


      By the way the variables a, b and c i only wrote them to remind myself how much is the length of the sides of each right triangle.










      share|improve this question














      So the problem is that after i completed the movement of my first shape i want to start moving my other shapes but when i compile my program they move at the same time . I tried to use 2 different timers to stop the first one and start the other but the result will be the same or one of the shapes will not move at all.
      The goal is to make an illustration of Pythagora's theorem. Here is my program:



      using System;
      using System.Collections.Generic;
      using System.ComponentModel;
      using System.Data;
      using System.Drawing;
      using System.Linq;
      using System.Text;
      using System.Threading.Tasks;
      using System.Windows.Forms;

      namespace WindowsFormsApp14
      {
      public partial class Form1 : Form
      {
      Bitmap myBitmap;
      Graphics g;

      int c = 147;

      private int X1Green, X2Green, Y1Green, Y2Green;//These variables are the coordinates of the Green Triangle which will be used to move it
      private int X1Blue, X2Blue;// These variables are the coordinates of the Blue Triangle which will be used to move it
      private int Y1PaleGreen, Y2PaleGreen;//These variables are the coordinates of the Pale Green Triangle which will be used to move it
      Timer timer1;
      Timer timer2;


      public Form1()
      {
      InitializeComponent();

      X1Green = 450;
      X2Green = 380;
      Y1Green = 120;
      Y2Green = 250;


      X1Blue = 380;
      X2Blue = 250;


      Y1PaleGreen = 50;
      Y2PaleGreen = 120;
      }

      private void Form1_Load(object sender, EventArgs e)
      {

      timer1 = new Timer();
      timer1.Tick += new EventHandler(timer1_Tick);
      timer1.Start();


      timer2 = new Timer();
      timer2.Tick += new EventHandler(timer2_Tick);
      // timer2.Start();
      }



      private void timer1_Tick(object sender, EventArgs e)
      {

      // Moving the Green Triangle Diagonally to the Light Blue Triangle
      if (Y1Green > 50) { Y1Green -= 3; }
      if (X1Green > 320) { X1Green -= 5; }
      if (X2Green > 250) { X2Green -= 5; }
      if (Y2Green > 180) { Y2Green -= 3; }


      Draw();

      timer2.Start();


      }

      private void timer2_Tick(object sender, EventArgs e)
      {

      //Moving our Blue Triangle
      if (X1Blue < 450) { X1Blue += 2; }
      if (X2Blue < 320) { X2Blue += 2; }

      //Moving our Pale Green Triangle
      if (Y1PaleGreen < 180) { Y1PaleGreen += 4; }
      if (Y2PaleGreen < 250) { Y2PaleGreen += 4; }

      // Draw();

      }

      private void Draw()
      {
      int a = 70;
      int b = 130;
      //double c = Math.Sqrt(Math.Pow(a, 2) + Math.Pow(b, 2));
      int c = 147;

      myBitmap = new Bitmap(pictureBox1.Width, pictureBox1.Height);

      Graphics g = Graphics.FromImage(myBitmap);
      g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

      Pen mypen = new Pen(Color.Black, 2);// drawing the rectangle to illustrate inside of it the theorem of Pythagoras
      g.DrawRectangle(mypen, 250, 50, 200, 200);

      SolidBrush LightBlue = new SolidBrush(Color.LightBlue);
      SolidBrush Blue = new SolidBrush(Color.Blue);
      SolidBrush PaleGreen = new SolidBrush(Color.PaleGreen);
      SolidBrush Green = new SolidBrush(Color.Green);







      //Drawing the the Light Blue Triangle at the top left corner of the rectangle
      g.FillPolygon(LightBlue, new Point{
      new Point(250,50), new Point(250,180), new Point(320,50)
      });




      pictureBox1.BackgroundImage = myBitmap;

      //Drawing the Pale Green Triangle at the top right corner of the rectangle
      g.FillPolygon(PaleGreen, new Point {
      new Point(320,Y1PaleGreen), new Point( 450,Y1PaleGreen ), new Point( 450, Y2PaleGreen)
      });

      //Drawing the Green Triangle at the bottom right corner of the rectangle
      g.FillPolygon(Green, new Point
      {
      new Point( X1Green, Y1Green ), new Point( X1Green,Y2Green), new Point(X2Green,Y2Green)
      });

      //Drawing the Blue Triangle at the bottom left corner of the rectangle
      g.FillPolygon(Blue, new Point
      {
      new Point(X1Blue,250), new Point(X2Blue,250), new Point(X2Blue,180)
      });


      }
      }
      }


      By the way the variables a, b and c i only wrote them to remind myself how much is the length of the sides of each right triangle.







      c# 2d






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 22 '18 at 4:46









      NOS grafNOS graf

      144




      144
























          1 Answer
          1






          active

          oldest

          votes


















          0














          You can fix it this way:



                  private void timer1_Tick(object sender, EventArgs e)
          {
          if (!(Y1Green > 50 || X1Green > 320 || X2Green > 250 || Y2Green > 180))
          {
          timer1.Stop();
          timer2.Start();
          return;
          }

          // Moving the Green Triangle Diagonally to the Light Blue Triangle
          if (Y1Green > 50) { Y1Green -= 3; }
          if (X1Green > 320) { X1Green -= 5; }
          if (X2Green > 250) { X2Green -= 5; }
          if (Y2Green > 180) { Y2Green -= 3; }
          Draw();
          }

          private void timer2_Tick(object sender, EventArgs e)
          {
          if (!(X1Blue < 450 || X2Blue < 320 || Y1PaleGreen < 180 || Y2PaleGreen < 250))
          {
          timer2.Stop();
          return;
          }
          //Moving our Blue Triangle
          if (X1Blue < 450) { X1Blue += 2; }
          if (X2Blue < 320) { X2Blue += 2; }

          //Moving our Pale Green Triangle
          if (Y1PaleGreen < 180) { Y1PaleGreen += 4; }
          if (Y2PaleGreen < 250) { Y2PaleGreen += 4; }

          Draw();
          }





          share|improve this answer
























          • oh my god it was that simple . Thank you for the help i was completely stuck since my timer stop wasn't working so i thought maybe there is another command that can help .

            – NOS graf
            Nov 22 '18 at 10:31











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53424037%2fhow-to-start-my-shapes-moving-after-my-first-shape-has-made-its-move%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          You can fix it this way:



                  private void timer1_Tick(object sender, EventArgs e)
          {
          if (!(Y1Green > 50 || X1Green > 320 || X2Green > 250 || Y2Green > 180))
          {
          timer1.Stop();
          timer2.Start();
          return;
          }

          // Moving the Green Triangle Diagonally to the Light Blue Triangle
          if (Y1Green > 50) { Y1Green -= 3; }
          if (X1Green > 320) { X1Green -= 5; }
          if (X2Green > 250) { X2Green -= 5; }
          if (Y2Green > 180) { Y2Green -= 3; }
          Draw();
          }

          private void timer2_Tick(object sender, EventArgs e)
          {
          if (!(X1Blue < 450 || X2Blue < 320 || Y1PaleGreen < 180 || Y2PaleGreen < 250))
          {
          timer2.Stop();
          return;
          }
          //Moving our Blue Triangle
          if (X1Blue < 450) { X1Blue += 2; }
          if (X2Blue < 320) { X2Blue += 2; }

          //Moving our Pale Green Triangle
          if (Y1PaleGreen < 180) { Y1PaleGreen += 4; }
          if (Y2PaleGreen < 250) { Y2PaleGreen += 4; }

          Draw();
          }





          share|improve this answer
























          • oh my god it was that simple . Thank you for the help i was completely stuck since my timer stop wasn't working so i thought maybe there is another command that can help .

            – NOS graf
            Nov 22 '18 at 10:31
















          0














          You can fix it this way:



                  private void timer1_Tick(object sender, EventArgs e)
          {
          if (!(Y1Green > 50 || X1Green > 320 || X2Green > 250 || Y2Green > 180))
          {
          timer1.Stop();
          timer2.Start();
          return;
          }

          // Moving the Green Triangle Diagonally to the Light Blue Triangle
          if (Y1Green > 50) { Y1Green -= 3; }
          if (X1Green > 320) { X1Green -= 5; }
          if (X2Green > 250) { X2Green -= 5; }
          if (Y2Green > 180) { Y2Green -= 3; }
          Draw();
          }

          private void timer2_Tick(object sender, EventArgs e)
          {
          if (!(X1Blue < 450 || X2Blue < 320 || Y1PaleGreen < 180 || Y2PaleGreen < 250))
          {
          timer2.Stop();
          return;
          }
          //Moving our Blue Triangle
          if (X1Blue < 450) { X1Blue += 2; }
          if (X2Blue < 320) { X2Blue += 2; }

          //Moving our Pale Green Triangle
          if (Y1PaleGreen < 180) { Y1PaleGreen += 4; }
          if (Y2PaleGreen < 250) { Y2PaleGreen += 4; }

          Draw();
          }





          share|improve this answer
























          • oh my god it was that simple . Thank you for the help i was completely stuck since my timer stop wasn't working so i thought maybe there is another command that can help .

            – NOS graf
            Nov 22 '18 at 10:31














          0












          0








          0







          You can fix it this way:



                  private void timer1_Tick(object sender, EventArgs e)
          {
          if (!(Y1Green > 50 || X1Green > 320 || X2Green > 250 || Y2Green > 180))
          {
          timer1.Stop();
          timer2.Start();
          return;
          }

          // Moving the Green Triangle Diagonally to the Light Blue Triangle
          if (Y1Green > 50) { Y1Green -= 3; }
          if (X1Green > 320) { X1Green -= 5; }
          if (X2Green > 250) { X2Green -= 5; }
          if (Y2Green > 180) { Y2Green -= 3; }
          Draw();
          }

          private void timer2_Tick(object sender, EventArgs e)
          {
          if (!(X1Blue < 450 || X2Blue < 320 || Y1PaleGreen < 180 || Y2PaleGreen < 250))
          {
          timer2.Stop();
          return;
          }
          //Moving our Blue Triangle
          if (X1Blue < 450) { X1Blue += 2; }
          if (X2Blue < 320) { X2Blue += 2; }

          //Moving our Pale Green Triangle
          if (Y1PaleGreen < 180) { Y1PaleGreen += 4; }
          if (Y2PaleGreen < 250) { Y2PaleGreen += 4; }

          Draw();
          }





          share|improve this answer













          You can fix it this way:



                  private void timer1_Tick(object sender, EventArgs e)
          {
          if (!(Y1Green > 50 || X1Green > 320 || X2Green > 250 || Y2Green > 180))
          {
          timer1.Stop();
          timer2.Start();
          return;
          }

          // Moving the Green Triangle Diagonally to the Light Blue Triangle
          if (Y1Green > 50) { Y1Green -= 3; }
          if (X1Green > 320) { X1Green -= 5; }
          if (X2Green > 250) { X2Green -= 5; }
          if (Y2Green > 180) { Y2Green -= 3; }
          Draw();
          }

          private void timer2_Tick(object sender, EventArgs e)
          {
          if (!(X1Blue < 450 || X2Blue < 320 || Y1PaleGreen < 180 || Y2PaleGreen < 250))
          {
          timer2.Stop();
          return;
          }
          //Moving our Blue Triangle
          if (X1Blue < 450) { X1Blue += 2; }
          if (X2Blue < 320) { X2Blue += 2; }

          //Moving our Pale Green Triangle
          if (Y1PaleGreen < 180) { Y1PaleGreen += 4; }
          if (Y2PaleGreen < 250) { Y2PaleGreen += 4; }

          Draw();
          }






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 22 '18 at 4:59









          Access DeniedAccess Denied

          5,14121643




          5,14121643













          • oh my god it was that simple . Thank you for the help i was completely stuck since my timer stop wasn't working so i thought maybe there is another command that can help .

            – NOS graf
            Nov 22 '18 at 10:31



















          • oh my god it was that simple . Thank you for the help i was completely stuck since my timer stop wasn't working so i thought maybe there is another command that can help .

            – NOS graf
            Nov 22 '18 at 10:31

















          oh my god it was that simple . Thank you for the help i was completely stuck since my timer stop wasn't working so i thought maybe there is another command that can help .

          – NOS graf
          Nov 22 '18 at 10:31





          oh my god it was that simple . Thank you for the help i was completely stuck since my timer stop wasn't working so i thought maybe there is another command that can help .

          – NOS graf
          Nov 22 '18 at 10:31




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53424037%2fhow-to-start-my-shapes-moving-after-my-first-shape-has-made-its-move%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          MongoDB - Not Authorized To Execute Command

          How to fix TextFormField cause rebuild widget in Flutter

          in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith