Esempio n. 1
0
        void New_game()
        {
            Begin_time   = DateTime.Now;
            additionTime = TimeSpan.Zero;
            records      = false;
            I            = 0;
            Score        = Jump_value = Cnt_walls = Disco_value = 0;

            COUNT_RECORDS = Cur_line = 1;

            Speed = Dif;    //3 5 7
            Field = new Cell[Cnt_block_height, Cnt_block_width];

            losted[0] = losted[1] = losted[2]
                                        = Points_add[0] = Points_add[1] = Points_add[2] = Points_add[3]
                                                                                              = Is_fly = Is_wall = Jump_dest
                                                                                                                       = Is_disco = Is_cleared = /*The_wall[0].Free_way = The_wall[1].Free_way = The_wall[2].Free_way =*/ false;
            The_wall[0].Free_way = The_wall[1].Free_way = The_wall[2].Free_way = true;

            for (int i = 0; i < Cnt_block_height; i++)
            {
                for (int j = 0; j < Cnt_block_width; j++)
                {
                    Field[i, j] = new Cell(false, 600 - (j * Size_cell_width) - (i * Shift), 120 + (i * Size_cell_height), Clr_road);
                }
            }

            Create_ball(out Ball_Truly, 100, 140, 50, 50, Color.Gray, Color.Black);
            Create_ball(out Ball_Falsed, Ball_Truly.x + (Ball_Truly.rad_x / 2) - 5, Ball_Truly.y + (Ball_Truly.rad_y / 2) - 5, 10, 10, Color.Black, Color.Black);
            Create_ball(out Ball_Shadow, 80, 160, 65, 35, Color.Black, Color.Black);

            At[0] = new RPtable();
            LoadFromBinaryFile("Records.dat");
        }
Esempio n. 2
0
 void Timer_Tick(object sender, EventArgs e)
 {
     I += Math.PI * 2 / ((8 - Speed) * 20);//50 100 150
     for (int i = 1; i <= 4; i++)
     {
         if (I >= Math.PI * (0.5 * i) && !Points_add[i - 1])
         {
             Score++;
             Points_add[i - 1] = true;
         }
     }
     if (I >= Math.PI * 2)
     {
         I = 0;
         for (int i = 0; i < 4; i++)
         {
             Points_add[i] = false;
         }
     }
     if (!Do_shift())
     {
         timer.Stop();
         At[0] = new RPtable(Score, tempT);//////////////////////////////
         SaveBinaryFormat("Records.dat");
         String str;
         str = "Вы набрали " + Score.ToString() + " очков за " + string.Format("{0:00}:{1:00}:{2:00}",
                                                                               tempT.Minutes + additionTime.Minutes, tempT.Seconds + additionTime.Seconds, tempT.Milliseconds + additionTime.Milliseconds);
         MessageBox.Show(str, "Конец игры", MessageBoxButtons.OK);
         New_game();
     }
     DrawField();
 }
Esempio n. 3
0
 void LoadFromBinaryFile(string fileName)
 {
     using (BinaryReader reader = new BinaryReader(File.Open(fileName, FileMode.Open)))
     {
         J              = reader.ReadInt32();
         COUNT_RECORDS += (J == 20) ? --J : J;
         for (int j = 0; j < J; j++)
         {
             tempP     = reader.ReadInt32();
             tempT     = TimeSpan.Parse(reader.ReadString());
             At[j + 1] = new RPtable(tempP, tempT);
         }
     }
 }