Esempio n. 1
0
        public void Level_Design()
        {
            int temp, temp2, y, i;

            mygame.Load_Graphic();
            mygame.node_x       = 4;
            mygame.node_y       = 4;
            mygame.snake_length = 7;

            //LEVEL-2 DESIGN
            if (mygame.game_level == 2)
            {
                temp  = mygame.game_width / mygame.node_length - 1;
                temp2 = mygame.game_height / mygame.node_length - 1;
                mygame.Add_Wall_Node(0, 0, temp, 0);
                mygame.Add_Wall_Node(temp, 0, temp, temp2);
                mygame.Add_Wall_Node(0, temp2, temp, temp2);
                mygame.Add_Wall_Node(0, 0, 0, temp2);
            }
            //LEVEL-3 DESIGN
            else if (mygame.game_level == 3)
            {
                int temp_x = (mygame.game_width / mygame.node_length) / 4;
                int temp_y = (mygame.game_height / mygame.node_length) / 4;

                mygame.Add_Wall_Node(temp_x, temp_y, temp_x + temp_x / 2, temp_y);
                mygame.Add_Wall_Node(temp_x, temp_y, temp_x, temp_y + temp_y / 2);

                mygame.Add_Wall_Node(temp_x, 2 * temp_y + temp_y / 2 + 1, temp_x, 3 * temp_y);
                mygame.Add_Wall_Node(temp_x, 3 * temp_y, temp_x + temp_x / 2, 3 * temp_y);

                mygame.Add_Wall_Node(2 * temp_x + temp_x / 2 + 1, 3 * temp_y, 3 * temp_x, 3 * temp_y);
                mygame.Add_Wall_Node(3 * temp_x, 3 * temp_y - temp_y / 2, 3 * temp_x, 3 * temp_y);

                mygame.Add_Wall_Node(2 * temp_x + temp_x / 2 + 1, temp_y, 3 * temp_x, temp_y);
                mygame.Add_Wall_Node(3 * temp_x, temp_y, 3 * temp_x, temp_y + temp_y / 2);
            }
            //LEVEL-4 DESIGN
            else if (mygame.game_level == 4)
            {
                temp = mygame.game_width / mygame.node_length - 1;
                y    = 2;
                i    = 5;

                while (i > 0)
                {
                    mygame.Add_Wall_Node(3, y, temp - 3, y);
                    y = y + 10;
                    i--;
                }
            }
            //LEVEL-5 DESIGN
            else if (mygame.game_level == 5)
            {
                temp = mygame.game_width / mygame.node_length - 1;
                y    = 6;
                i    = 3;

                while (i > 0)
                {
                    mygame.Add_Wall_Node(6, y, temp - 6, y);
                    y = y + 10;
                    i--;
                }
                y = 6;

                mygame.Add_Wall_Node(6, y, 6, y + 10);
                mygame.Add_Wall_Node(temp - 6, y + 10, temp - 6, y + 20);
            }
            //LEVEL-6 DESIGN
            else if (mygame.game_level == 6)
            {
                temp = mygame.game_width / mygame.node_length - 1;
                y    = 6;
                i    = 3;

                while (i > 0)
                {
                    mygame.Add_Wall_Node(6, y, temp - 6, y);
                    y = y + 10;
                    i--;
                }
                y = 6;

                mygame.Add_Wall_Node(6, y, 6, y + 10);
                mygame.Add_Wall_Node(temp - 6, y + 10, temp - 6, y + 20);


                temp  = mygame.game_width / mygame.node_length - 1;
                temp2 = mygame.game_height / mygame.node_length - 1;
                mygame.Add_Wall_Node(0, 0, temp, 0);
                mygame.Add_Wall_Node(temp, 0, temp, temp2);
                mygame.Add_Wall_Node(0, temp2, temp, temp2);
                mygame.Add_Wall_Node(0, 0, 0, temp2);
            }
        }