Software how to write simple but working code
proposed by Prof.Satoshi Nishimura image00 / Jichi Med Univ(JAPAN)

Specs: Essense of fpg games

E-mail: If interested (snishi-tky(a-mark)ninus.ocn.ne.jp ) image00

Back to top image00
Software DOWNLOAD (exe in ZIP)





		
			using OpenCvSharp;
using System;
using System.Diagnostics.PerformanceData;
using System.Drawing;
using System.Windows.Forms;

namespace WindowsFormsApp2
{
    public partial class Form1 : Form
    {
     //   VideoCapture VideoCapture1;
     //   Graphics Graphics1;
     //   Mat Mat1;
        int score=0;

        public int tamaNumber = 1250000;
        public int totalTime = 50000;
        public int[] xpos1=new int[1250000];
        public int[] tpos1 = new int[1250000];
        public int[] xpos2 = new int[1250000];
        public int[] tpos2 = new int[1250000];
        public int[] apos1 = new int[1250000];
        public int[] rpos1 = new int[1250000];

        public int[] ypos3 = new int[1250000];
        public int[] tpos3 = new int[1250000];
        public int[] ypos4 = new int[1250000];
        public int[] tpos4 = new int[1250000];


        public int[] tpos5 = new int[1250000];
        public int[] tpos6 = new int[1250000];
        public int[] xpos5 = new int[1250000];
        public int[] xpos6 = new int[1250000];

        public int[] tpos7 = new int[1250000];
        public int[] tpos8 = new int[1250000];
        public int[] xpos7 = new int[1250000];
        public int[] xpos8 = new int[1250000];


        public int[] tpos17 = new int[1250000];
        public int[] tpos18 = new int[1250000];
        public int[] xpos17 = new int[1250000];
        public int[] xpos18 = new int[1250000];

        public int[] tpos19 = new int[1250000];
        public int[] tpos20 = new int[1250000];
        public int[] xpos19 = new int[1250000];
        public int[] xpos20 = new int[1250000];

        public int[] tpos9 = new int[1250000];
        public int[] tpos10 = new int[1250000];
        public int[] xpos9 = new int[1250000];
        public int[] xpos10 = new int[1250000];
        public int[] ypos9 = new int[1250000];
        public int[] ypos10 = new int[1250000];



        public int[] tpos11 = new int[1250000];
        public int[] tpos12 = new int[1250000];
        public int[] xpos11 = new int[1250000];
        public int[] xpos12 = new int[1250000];
        public int[] ypos11 = new int[1250000];
        public int[] ypos12 = new int[1250000];


        public int[] tpos13 = new int[1250000];
        public int[] tpos14 = new int[1250000];
        public int[] xpos13 = new int[1250000];
        public int[] xpos14 = new int[1250000];
        public int[] ypos13 = new int[1250000];
        public int[] ypos14 = new int[1250000];


        public int[] tpos15 = new int[1250000];
        public int[] tpos16 = new int[1250000];
        public int[] xpos15 = new int[1250000];
        public int[] xpos16 = new int[1250000];
        public int[] ypos15 = new int[1250000];
        public int[] ypos16 = new int[1250000];


        public int[] tpos21 = new int[1250000];
        public int[] tpos22 = new int[1250000];
        public int[] xpos21 = new int[1250000];
        public int[] xpos22 = new int[1250000];
        public int[] tpos23 = new int[1250000];
        public int[] xpos23 = new int[1250000];


        public int[] tpos24 = new int[1250000];
        public int[] tpos25 = new int[1250000];
        public int[] xpos24 = new int[1250000];
        public int[] xpos25 = new int[1250000];
        public int[] tpos26 = new int[1250000];
        public int[] xpos26 = new int[1250000];

        public double ellT = 0;




        public Form1()
        {
            InitializeComponent();
          

        }
        private void pictureBox1_Click(object sender, EventArgs e)
        {

        }

        private void Form1_Load(object sender, EventArgs e)
        {

            timer1.Enabled = false;
            int counti;
            Random r1 = new System.Random();
            for (counti = 0; counti < tamaNumber; counti++)
            {
                xpos1[counti] = r1.Next(-800, 1600);
                xpos2[counti] = r1.Next(-800, 1600);
                tpos1[counti]= r1.Next(-5000, totalTime + 5000);
                tpos2[counti] = tpos1[counti]+(r1.Next(0, 2) * 2 - 1) * r1.Next(500, 1200);
                apos1[counti] =  (r1.Next(0, 2) * 2 - 1) * r1.Next(50, 200);
                rpos1[counti] = r1.Next(30, 50);


                ypos3[counti] = r1.Next(-600, 1200);
                ypos4[counti] = r1.Next(-600, 1200);
                tpos3[counti] = r1.Next(-5000, totalTime + 5000);
                tpos4[counti] = tpos3[counti] + (r1.Next(0, 2) * 2 - 1) * r1.Next(350, 860);

                xpos5[counti] = r1.Next(0, 120);
                xpos6[counti] = r1.Next(-600, 200);
                tpos5[counti] = r1.Next(-2000, totalTime);
                tpos6[counti] = r1.Next(50, 500);

                xpos7[counti] = r1.Next(0, 120);
                xpos8[counti] = r1.Next(-600, 200);
                tpos7[counti] = r1.Next(-2000, totalTime);
                tpos8[counti] = r1.Next(50, 500);

                xpos17[counti] = r1.Next(0, 120);
                xpos18[counti] = r1.Next(-600, 200);
                tpos17[counti] = r1.Next(-2000, totalTime);
                tpos18[counti] = r1.Next(50, 500);

                xpos19[counti] = r1.Next(0, 120);
                xpos20[counti] = r1.Next(-600, 200);
                tpos19[counti] = r1.Next(-2000, totalTime);
                tpos20[counti] = r1.Next(50, 500);


                xpos9[counti] = r1.Next(0, 120);
                xpos10[counti] = r1.Next(-600, 200);

                ypos9[counti] = r1.Next(0, 120);
                ypos10[counti] = r1.Next(-400, 100);
                tpos9[counti] = r1.Next(1000, 4000);
                tpos10[counti] = r1.Next(50, 400);


                xpos11[counti] = r1.Next(0, 120);
                xpos12[counti] = r1.Next(-600, 200);

                ypos11[counti] = r1.Next(0, 120);
                ypos12[counti] = r1.Next(-400, 100);
                tpos9[counti] = r1.Next(1000, 4000);
                tpos12[counti] = r1.Next(50, 400);


                xpos13[counti] = r1.Next(0, 120);
                xpos14[counti] = r1.Next(-600, 200);

                ypos13[counti] = r1.Next(0, 120);
                ypos14[counti] = r1.Next(-400, 100);
                tpos9[counti] = r1.Next(1000, 4000);
                tpos14[counti] = r1.Next(50, 400);



                xpos15[counti] = r1.Next(0, 120);
                xpos16[counti] = r1.Next(-600, 200);

                ypos15[counti] = r1.Next(0, 120);
                ypos16[counti] = r1.Next(-400, 100);
                tpos9[counti] = r1.Next(1000, 4000);
                tpos16[counti] = r1.Next(50, 400);


                xpos23[counti] = r1.Next(0, 50);
                xpos21[counti] = r1.Next(0, 320);
                xpos22[counti] = r1.Next(-600, 200);
                tpos21[counti] = r1.Next(2000, 6000);
                tpos22[counti] = r1.Next(50, 500);
                tpos23[counti] = r1.Next(0, 100);




                xpos26[counti] = r1.Next(0, 50);
                xpos24[counti] = r1.Next(0, 320);
                xpos25[counti] = r1.Next(-600, 200);
                tpos21[counti] = r1.Next(2000, 6000);
                tpos25[counti] = r1.Next(50, 500);
                tpos26[counti] = r1.Next(0, 100);

            }
         //   VideoCapture1 = new VideoCapture(0);
         //   if (!VideoCapture1.IsOpened())
         //   {
         //       MessageBox.Show("カメラ1がありません");
         //       Close();
         //   }
         //   else
         //   {
         //       Graphics1 = pictureBox1.CreateGraphics();
         //   }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            timer1.Enabled = true;
        }

        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
          //  VideoCapture1.Dispose();
         //   Graphics1.Dispose();
        }
        public void Read_Camera()
        {
         //   using (Mat1 = new Mat(0, 0, MatType.CV_8UC3))
          //  {
          //      VideoCapture1.Read(Mat1);
          //      using (Bitmap bitmap1 = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(Mat1))
          //      {
          //          Graphics1.DrawImage(bitmap1, 0, 0, Mat1.Cols/2, Mat1.Rows/2);
          //      }
          //  }

        }

        private void timer6_Tick(object sender, EventArgs e)
        {

        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            int counti;
            int hyoujitamaN = 0;
            int hitflag = 0;
            double xpos, ypos;
            Bitmap gamen = new Bitmap(800,600);
            Graphics g_gamen = Graphics.FromImage(gamen);
            Pen penp = new Pen(Color.Black, 1);
            Pen penR = new Pen(Color.Red, 1);


            System.Drawing.Point sp = System.Windows.Forms.Cursor.Position;
            System.Drawing.Point cp = this.PointToClient(sp);
            int x = cp.X;
            int y = cp.Y;

            if (x < 130) { x = 130; }
            if (y < 130) { y = 130; }
            if (x > 920) { x = 920; }
            if (y > 720) { y = 720; }



            if (ellT< 1000)
            {
                label7.Text = "Dimension X:1, Y:1";
                label7.Refresh();

                label2.Text = "最初は一次関数";
                label2.Refresh();


                for (counti = 0; counti < tamaNumber / 150; counti++)
                {
                    ypos = -600 + (ellT - tpos1[counti]) / (tpos2[counti] - tpos1[counti]) * 1200;
                    xpos = xpos1[counti] + (ellT - tpos1[counti]) / (tpos2[counti] - tpos1[counti]) * (xpos2[counti] - xpos1[counti]);
                    if (xpos > 0 && xpos < 800)
                    {
                        if (ypos > 0 && ypos < 600)
                        {
                            hyoujitamaN++;

                            g_gamen.DrawRectangle(penp, (int)xpos, (int)ypos, 10, 10);
                            if (((xpos +125- x) * (xpos + 125 - x)+ (ypos + 125 - y) * (ypos + 125 - y)) < 905)
                            {
                                
                                    hitflag++;
                                    score++;

                            }

                        }
                    }

                   
                


                    xpos = -800 + (ellT - tpos3[counti]) / (tpos4[counti] - tpos3[counti]) * 1600;
                    ypos = ypos3[counti] + (ellT - tpos3[counti]) / (tpos4[counti] - tpos3[counti]) * (ypos4[counti] - ypos3[counti]);
                    if (xpos > 0 && xpos < 800)
                    {
                        if (ypos > 0 && ypos < 600)
                        {
                            hyoujitamaN++;

                            g_gamen.DrawRectangle(penR, (int)xpos, (int)ypos, 10, 10);
                            if (((xpos + 125 - x) * (xpos + 125 - x) + (ypos + 125 - y) * (ypos + 125 - y)) < 905)
                            {

                                hitflag++;
                                score++;

                            }

                        }
                    }
                    

                }

            }

            if (ellT > 1000 && ellT <2000)
            {
                label7.Text = "Dimension X:2, Y:1";
                label7.Refresh();

                label2.Text = "つぎは二次関数";
                label2.Refresh();



                for (counti = 0; counti < tamaNumber/4; counti++)
                {

                    if ((counti - tpos5[counti]) < 2000 && (counti - tpos5[counti]) > -2000)
                    {
                        xpos = 400 - (ellT - tpos5[counti]) * (ellT - tpos5[counti]) / tpos6[counti] / tpos6[counti] * xpos5[counti] * 5 + xpos6[counti];
                        ypos = (ellT - tpos5[counti])  + 300;

                        if (xpos > 0 && xpos < 800)
                        {
                            if (ypos > 0 && ypos < 600)
                            {
                                hyoujitamaN++;

                                g_gamen.DrawRectangle(penp, (int)xpos, (int)ypos, 10, 10);
                                if (((xpos + 125 - x) * (xpos + 125 - x) + (ypos + 125 - y) * (ypos + 125 - y)) < 905)
                                {

                                    hitflag++;
                                    score++;

                                }
                            }
                        }


                    }

                    if ((counti - tpos7[counti]) < 2000 && (counti - tpos7[counti]) > -2000)
                    {
                        xpos = 400 - (ellT - tpos7[counti]) * (ellT - tpos7[counti]) / tpos8[counti] / tpos8[counti] * xpos7[counti] * 5 + xpos8[counti];
                        ypos = 600 - (ellT - tpos7[counti]) ;

                        if (xpos > 0 && xpos < 800)
                        {
                            if (ypos > 0 && ypos < 600)
                            {
                                hyoujitamaN++;

                                g_gamen.DrawRectangle(penR, (int)xpos, (int)ypos, 10, 10);
                                if (((xpos + 125 - x) * (xpos + 125 - x) + (ypos + 125 - y) * (ypos + 125 - y)) < 905)
                                {

                                    hitflag++;
                                    score++;

                                }
                            }
                        }
                    }

                    if ((counti - tpos19[counti]) < 2000 && (counti - tpos19[counti]) > -2000)
                    {
                        xpos = 400 - (ellT - tpos19[counti]) * (ellT - tpos19[counti]) / tpos20[counti] / tpos20[counti] * xpos19[counti] * 5 + xpos20[counti];
                        xpos = 800 - xpos;
                        ypos = (ellT - tpos19[counti]) + 300;

                        if (xpos > 0 && xpos < 800)
                        {
                            if (ypos > 0 && ypos < 600)
                            {
                                hyoujitamaN++;

                                g_gamen.DrawRectangle(penp, (int)xpos, (int)ypos, 10, 10);
                                if (((xpos + 125 - x) * (xpos + 125 - x) + (ypos + 125 - y) * (ypos + 125 - y)) < 905)
                                {

                                    hitflag++;
                                    score++;

                                }
                            }
                        }


                    }

                    if ((counti - tpos17[counti]) < 2000 && (counti - tpos17[counti]) > -2000)
                    {
                        xpos = 400 - (ellT - tpos17[counti]) * (ellT - tpos17[counti]) / tpos18[counti] / tpos18[counti] * xpos17[counti] * 5 + xpos18[counti];
                        ypos = 600 - (ellT - tpos17[counti]);

                        if (xpos > 0 && xpos < 800)
                        {
                            if (ypos > 0 && ypos < 600)
                            {
                                hyoujitamaN++;

                                g_gamen.DrawRectangle(penR, (int)xpos, (int)ypos, 10, 10);
                                if (((xpos + 125 - x) * (xpos + 125 - x) + (ypos + 125 - y) * (ypos + 125 - y)) < 905)
                                {

                                    hitflag++;
                                    score++;

                                }
                            }
                        }
                    }
                }



            }

            if (ellT > 2000 && ellT<3000)
            {

                label7.Text = "Dimension X:2, Y:2";
                label7.Refresh();

                label2.Text = "たてよこ二次関数";
                label2.Refresh();


                for (counti = 0; counti < tamaNumber/8; counti++)
                {

                    if ((counti - tpos9[counti]) < 1000 && (counti - tpos9[counti]) > -1000)
                    {
                        xpos = 400 - (ellT - tpos9[counti]) * (ellT - tpos9[counti]) / tpos10[counti] / tpos10[counti] * xpos9[counti] * 5 + xpos10[counti];
                        ypos = 300 - (ellT - tpos9[counti]) * (ellT - tpos9[counti]) / tpos10[counti] / tpos10[counti] * ypos9[counti] * 5 + ypos10[counti];
                        xpos = xpos * 1.8;
                        ypos = ypos * 1.8;

                        if (xpos > 0 && xpos < 800)
                        {
                            if (ypos > 0 && ypos < 600)
                            {
                                hyoujitamaN++;

                                g_gamen.DrawRectangle(penp, (int)xpos, (int)ypos, 10, 10);
                                if (((xpos + 125 - x) * (xpos + 125 - x) + (ypos + 125 - y) * (ypos + 125 - y)) < 905)
                                {

                                    hitflag++;
                                    score++;

                                }
                            }
                        }


                    }


                    if ((counti - tpos15[counti]) < 1000 && (counti - tpos15[counti]) > -1000)
                    {
                        xpos = 400 - (ellT - tpos15[counti]) * (ellT - tpos15[counti]) / tpos16[counti] / tpos16[counti] * xpos15[counti] * 5 + xpos16[counti];
                        ypos = 300 - (ellT - tpos15[counti]) * (ellT - tpos15[counti]) / tpos16[counti] / tpos16[counti] * ypos15[counti] * 5 + ypos16[counti];
                        
                        xpos = xpos * 1.8;
                        ypos = ypos * 1.8;
                        xpos = (1000 - xpos);
                        if (xpos > 0 && xpos < 800)
                        {
                            if (ypos > 0 && ypos < 600)
                            {
                                hyoujitamaN++;

                                g_gamen.DrawRectangle(penp, (int)xpos, (int)ypos, 10, 10);
                                if (((xpos + 125 - x) * (xpos + 125 - x) + (ypos + 125 - y) * (ypos + 125 - y)) < 905)
                                {

                                    hitflag++;
                                    score++;

                                }
                            }
                        }


                    }


                    if ((counti - tpos11[counti]) < 1000 && (counti - tpos11[counti]) > -1000)
                    {
                        xpos = 400 - (ellT - tpos11[counti]) * (ellT - tpos11[counti]) / tpos12[counti] / tpos12[counti] * xpos11[counti] * 5 + xpos12[counti];
                        ypos = 300 - (ellT - tpos11[counti]) * (ellT - tpos11[counti]) / tpos12[counti] / tpos12[counti] * ypos11[counti] * 5 + ypos12[counti];

                        xpos = xpos * 1.8;
                        ypos = ypos * 1.8;
                        xpos = (1000 - xpos);
                        ypos = (800 - ypos);
                        if (xpos > 0 && xpos < 800)
                        {
                            if (ypos > 0 && ypos < 600)
                            {
                                hyoujitamaN++;

                                g_gamen.DrawRectangle(penR, (int)xpos, (int)ypos, 10, 10);
                                if (((xpos + 125 - x) * (xpos + 125 - x) + (ypos + 125 - y) * (ypos + 125 - y)) < 905)
                                {

                                    hitflag++;
                                    score++;

                                }
                            }
                        }


                    }


                    if ((counti - tpos13[counti]) < 1000 && (counti - tpos13[counti]) > -1000)
                    {
                        xpos = 400 - (ellT - tpos13[counti]) * (ellT - tpos13[counti]) / tpos14[counti] / tpos14[counti] * xpos13[counti] * 5 + xpos14[counti];
                        ypos = 300 - (ellT - tpos13[counti]) * (ellT - tpos13[counti]) / tpos14[counti] / tpos14[counti] * ypos13[counti] * 5 + ypos14[counti];

                        xpos = xpos * 1.8;
                        ypos = ypos * 1.8;

                        ypos = (800 - ypos);
                        if (xpos > 0 && xpos < 800)
                        {
                            if (ypos > 0 && ypos < 600)
                            {
                                hyoujitamaN++;

                                g_gamen.DrawRectangle(penR, (int)xpos, (int)ypos, 10, 10);
                                if (((xpos + 125 - x) * (xpos + 125 - x) + (ypos + 125 - y) * (ypos + 125 - y)) < 905)
                                {

                                    hitflag++;
                                    score++;

                                }
                            }
                        }


                    }
                    
                }

            }


            if (ellT >3000 && ellT<4000)
            {

                label7.Text = "Dimension X:3, Y:1";
                label7.Refresh();

                label2.Text = "三次関数";
                label2.Refresh();


                for (counti = 0; counti < tamaNumber; counti++)
                {

                    if ((counti - tpos21[counti]) < 300 && (counti - tpos21[counti]) > -300)
                    {
                        xpos = 400 - (ellT - tpos21[counti]) * (ellT - tpos21[counti]) * (ellT - tpos21[counti]) / tpos22[counti] / tpos22[counti] / tpos22[counti] * xpos21[counti] / 5 + xpos22[counti];
                        xpos = xpos + (ellT - tpos21[counti]) / tpos23[counti] * (ellT - tpos21[counti]) / tpos23[counti] * xpos23[counti];

                        ypos = 0 + (ellT - tpos21[counti]) / (tpos22[counti] - tpos21[counti]) * 2400;



                        if (xpos > 1 && xpos < 800)
                        {
                            if (ypos > 1 && ypos < 600)
                            {
                                hyoujitamaN++;

                                g_gamen.DrawRectangle(penp, (int)xpos, (int)ypos, 10, 10);
                                if (((xpos + 125 - x) * (xpos + 125 - x) + (ypos + 125 - y) * (ypos + 125 - y)) < 905)
                                {

                                    hitflag++;
                                    score++;

                                }
                            }
                        }


                    }

                    if ((counti - tpos21[counti]) < 300 && (counti - tpos21[counti]) > -300)
                    {
                        xpos = 400 - (ellT - tpos21[counti]) * (ellT - tpos21[counti]) * (ellT - tpos21[counti]) / tpos22[counti] / tpos22[counti] / tpos22[counti] * xpos21[counti] / 5 + xpos22[counti];
                        xpos = xpos + (ellT - tpos21[counti]) / tpos23[counti] * (ellT - tpos21[counti]) / tpos23[counti] * xpos23[counti];

                        ypos = 0 + (ellT - tpos21[counti]) / (tpos22[counti] - tpos21[counti]) * 2400+200;

                        xpos = 1100 - xpos;

                        if (xpos > 1 && xpos < 800)
                        {
                            if (ypos > 1 && ypos < 600)
                            {
                                hyoujitamaN++;

                                g_gamen.DrawRectangle(penp, (int)xpos, (int)ypos, 10, 10);
                                if (((xpos + 125 - x) * (xpos + 125 - x) + (ypos + 125 - y) * (ypos + 125 - y)) < 905)
                                {

                                    hitflag++;
                                    score++;

                                }
                            }
                        }


                    }
                    if ((counti - tpos24[counti]) < 300 && (counti - tpos24[counti]) > -300)
                    {
                        xpos = 400 - (ellT - tpos24[counti]) * (ellT - tpos24[counti]) * (ellT - tpos24[counti]) / tpos25[counti] / tpos25[counti] / tpos25[counti] * xpos24[counti] / 5 + xpos25[counti];
                        xpos = xpos + (ellT - tpos24[counti]) / tpos26[counti] * (ellT - tpos24[counti]) / tpos26[counti] * xpos26[counti];

                        ypos = 0 + (ellT - tpos24[counti]) / (tpos25[counti] - tpos24[counti]) * 2400;
                        ypos = 800 - ypos + 400;
                        xpos = 1000 - xpos;


                        if (xpos > 1 && xpos < 800)
                        {
                            if (ypos > 1 && ypos < 600)
                            {
                                hyoujitamaN++;

                                g_gamen.DrawRectangle(penp, (int)xpos, (int)ypos, 10, 10);
                                if (((xpos + 125 - x) * (xpos + 125 - x) + (ypos + 125 - y) * (ypos + 125 - y)) < 905)
                                {

                                    hitflag++;
                                    score++;

                                }
                            }
                        }

                        if ((counti - tpos24[counti]) < 300 && (counti - tpos24[counti]) > -300)
                        {
                            xpos = 400 - (ellT - tpos24[counti]) * (ellT - tpos24[counti]) * (ellT - tpos24[counti]) / tpos25[counti] / tpos25[counti] / tpos25[counti] * xpos24[counti] / 5 + xpos25[counti];
                            xpos = xpos + (ellT - tpos24[counti]) / tpos26[counti] * (ellT - tpos24[counti]) / tpos26[counti] * xpos26[counti];

                            ypos = 0 + (ellT - tpos24[counti]) / (tpos25[counti] - tpos24[counti]) * 2400;
                            ypos = 800 - ypos + 500;


                            if (xpos > 1 && xpos < 800)
                            {
                                if (ypos > 1 && ypos < 600)
                                {
                                    hyoujitamaN++;

                                    g_gamen.DrawRectangle(penp, (int)xpos, (int)ypos, 10, 10);
                                    if (((xpos + 125 - x) * (xpos + 125 - x) + (ypos + 125 - y) * (ypos + 125 - y)) < 905)
                                    {

                                        hitflag++;
                                        score++;

                                    }
                                }
                            }
                        }
                    }
                }

            }


            if (ellT > 4000 && ellT < 5000)
            {
                label7.Text = "Dimension X:1, Y:1 & SinwaveX";
                label7.Refresh();
                label2.Text = "三角関数";
                label2.Refresh();


                for (counti = 0; counti < tamaNumber / 120; counti++)
                {
                    ypos = -600 + (ellT - tpos1[counti]) / (tpos2[counti] - tpos1[counti]) * 1200;
                    xpos = xpos1[counti] + (ellT - tpos1[counti]) / (tpos2[counti] - tpos1[counti]) * (xpos2[counti] - xpos1[counti]);

                    xpos = xpos + Math.Sin(ellT/rpos1[counti]) * apos1[counti];

                    if (xpos > 0 && xpos < 800)
                    {
                        if (ypos > 0 && ypos < 600)
                        {
                            hyoujitamaN++;

                            g_gamen.DrawRectangle(penp, (int)xpos, (int)ypos, 10, 10);
                            if (((xpos + 125 - x) * (xpos + 125 - x) + (ypos + 125 - y) * (ypos + 125 - y)) < 905)
                            {

                                hitflag++;
                                score++;

                            }

                        }
                    }
                    xpos = -800 + (ellT - tpos3[counti]) / (tpos4[counti] - tpos3[counti]) * 1600;
                    ypos = ypos3[counti] + (ellT - tpos3[counti]) / (tpos4[counti] - tpos3[counti]) * (ypos4[counti] - ypos3[counti]);
                    if (xpos > 0 && xpos < 800)
                    {
                        if (ypos > 0 && ypos < 600)
                        {
                            hyoujitamaN++;

                            g_gamen.DrawRectangle(penR, (int)xpos, (int)ypos, 10, 10);
                            if (((xpos + 125 - x) * (xpos + 125 - x) + (ypos + 125 - y) * (ypos + 125 - y)) < 905)
                            {

                                hitflag++;
                                score++;

                            }
                        }
                    }

                }

            }

            if (hitflag > 0)
            {
                Pen penB = new Pen(Color.Blue, 8);
                g_gamen.DrawRectangle(penB, x - 138, y - 138, 28, 28);
            }
            else
            {
                Pen penB = new Pen(Color.Blue, 2);
                g_gamen.DrawRectangle(penB, x - 140, y - 140, 30, 30);
            }


            if (ellT > 900 & ellT<1400)
            {
                label3.Text = "青いやつをまもって!";

            }
            if (ellT > 1400 && ellT < 1900)
            {
                label3.Text = "ぶつけないでよ!";

            }
            if (ellT > 1900 && ellT < 2400)
            {
                label3.Text = "こういのって性格でるよね";

            }

            if (ellT > 2500 && ellT<5900)
            {
                label3.Text = "あなたのダメージは.." + score.ToString();
            }


            if (ellT > 4900 && ellT < 5500)
            {
                label2.Text = "そんなあなたへの評価は";
            }
            if (ellT > 5500 && score>1800)
            {
                label2.Text = "ぜんぜんだめ!";
            }

            if (ellT > 5500 && score < 1800)
            {
                label2.Text = "まあまあかなーん";
            }

            if (ellT > 6000 && score <500)
            {
                label2.Text = "なかなかやるじゃん";
            }

            if (ellT > 7000 && score < 200)
            {
                label2.Text = "うん、ほめてあげるんだから!";
            }


            if (ellT > 8000 && score < 200)
            {
                label3.Text = "えらいえらい!、これでいい?";
            }

            label3.Refresh();
            pictureBox2.Image = gamen;
            penp.Dispose();
            g_gamen.Dispose();
            pictureBox2.Refresh();
            label1.Text = hyoujitamaN.ToString();
            label1.Refresh();
            ellT++;
        }

        private void pictureBox2_Click(object sender, EventArgs e)
        {

        }
    }
}