Ejemplo n.º 1
0
        public void rot(int amount)
        {
            addnewrow();
            translatebackrow();
            rotatecounter = 0;


            rowmovement           += amount;
            rowmovementcheckspike += amount;
            bow.Play();
            Movingcube.cam = cam;
            Movingcube.LoadFromFile("Cube2.txt");
            Transformation_API.Scale(ref Movingcube.L_3D_Pts, 0.2f, 0.2f, 0.2f);
            _3D_Model tempground2 = (_3D_Model)Ground[rowmovement];

            for (int i = 0; i < Movingcube.L_3D_Pts.Count; i++)
            {
                CPoint3D_Node temp        = (CPoint3D_Node)Movingcube.L_3D_Pts[i];
                CPoint3D_Node tempground3 = (CPoint3D_Node)tempground2.L_3D_Pts[i];
                temp.X = tempground3.X;
                temp.Z = tempground3.Z;
            }
            Transformation_API.TranslateY(ref Movingcube.L_3D_Pts, -70);

            Movingcube.clr = Color.Blue;
            whichground    = false;
        }
Ejemplo n.º 2
0
        public void addnewrow()
        {
            if (whichtoadd == false)
            {
                int           startfgroundx = -75;
                float         startgroundz;
                _3D_Model     tempgr1 = (_3D_Model)Ground[Ground.Count - 3];
                CPoint3D_Node tempgr2 = (CPoint3D_Node)tempgr1.L_3D_Pts[1];
                startgroundz  = tempgr2.Z;
                startgroundz += 45;

                _3D_Model cube3 = new _3D_Model();
                cube3.cam = cam;
                cube3.LoadFromFile("Cubewall.txt");
                cube3.typeofcube = 3;
                cube3.upordown   = false;
                Transformation_API.Scale(ref cube3.L_3D_Pts, 0.2f, 0.2f, 0.2f);
                Transformation_API.TranslateZ(ref cube3.L_3D_Pts, (startgroundz - 10) - 50);
                Transformation_API.TranslateY(ref cube3.L_3D_Pts, -108);
                Transformation_API.TranslateX(ref cube3.L_3D_Pts, -163);
                cube3.Rotat_Aroun_Edge(3, 0, 90);
                cube3.Rotat_Aroun_Edge(8, 1, 146);
                cube3.Rotat_Aroun_Edge(7, 0, 12);

                cube3.clr = Color.DarkRed;
                Ground.Add(cube3);


                Random rnd1 = new Random();
                chanceornot = rnd1.Next(3);
                Random rnd2 = new Random();
                hole = rnd2.Next(4);


                for (int i = 0; i < 4; i++)
                {
                    _3D_Model cube2 = new _3D_Model();
                    cube2.cam = cam;
                    cube2.LoadFromFile("Cube2.txt");
                    cube2.upordown = false;
                    Transformation_API.Scale(ref cube2.L_3D_Pts, 0.2f, 0.005f, 0.2f);
                    Transformation_API.TranslateZ(ref cube2.L_3D_Pts, startgroundz);
                    Transformation_API.TranslateY(ref cube2.L_3D_Pts, -100);
                    Transformation_API.TranslateX(ref cube2.L_3D_Pts, startfgroundx);
                    cube2.Rotat_Aroun_Edge(1, 0, 45);
                    bool whichcolor = false;

                    if (chanceornot == 0)
                    {
                        cube2.typeofcube = 0;
                    }
                    else if (chanceornot == 1)
                    {
                        if (hole == i)
                        {
                            cube2.typeofcube = 1;
                        }
                    }
                    else if (chanceornot == 2)
                    {
                        if (hole == i)
                        {
                            cube2.typeofcube = 2;
                            whichcolor       = true;
                            CPoint3D_Node forspikess = (CPoint3D_Node)cube2.L_3D_Pts[0];
                            addspikes(forspikess);
                        }
                    }

                    if (whichcolor == false)
                    {
                        cube2.clr = Color.DarkGray;
                    }
                    else if (whichcolor == true)
                    {
                        cube2.clr = Color.Purple;
                    }
                    startfgroundx += 50;
                    Ground.Add(cube2);
                }

                cube3     = new _3D_Model();
                cube3.cam = cam;
                cube3.LoadFromFile("Cubewall.txt");
                cube3.typeofcube = 3;
                cube3.upordown   = false;
                Transformation_API.Scale(ref cube3.L_3D_Pts, 0.2f, 0.2f, 0.2f);
                Transformation_API.TranslateZ(ref cube3.L_3D_Pts, startgroundz - 10);
                Transformation_API.TranslateY(ref cube3.L_3D_Pts, -108);
                Transformation_API.TranslateX(ref cube3.L_3D_Pts, 102);
                cube3.Rotat_Aroun_Edge(3, 0, 90);
                cube3.Rotat_Aroun_Edge(8, 0, 45);

                cube3.clr = Color.DarkRed;
                Ground.Add(cube3);
                whichtoadd = true;
            }
            else if (whichtoadd == true)
            {
                int           startfgroundx = -100;
                float         startgroundz;
                _3D_Model     tempgr1 = (_3D_Model)Ground[Ground.Count - 2];
                CPoint3D_Node tempgr2 = (CPoint3D_Node)tempgr1.L_3D_Pts[1];
                startgroundz  = tempgr2.Z;
                startgroundz += 50;

                Random rnd1 = new Random();
                chanceornot = rnd1.Next(3);
                Random rnd2 = new Random();
                hole = rnd2.Next(5);

                for (int i = 0; i < 5; i++)
                {
                    _3D_Model cube2 = new _3D_Model();
                    cube2.cam      = cam;
                    cube2.upordown = false;
                    cube2.LoadFromFile("Cube2.txt");
                    Transformation_API.Scale(ref cube2.L_3D_Pts, 0.2f, 0.005f, 0.2f);
                    Transformation_API.TranslateZ(ref cube2.L_3D_Pts, startgroundz);
                    Transformation_API.TranslateY(ref cube2.L_3D_Pts, -100);
                    Transformation_API.TranslateX(ref cube2.L_3D_Pts, startfgroundx);
                    cube2.Rotat_Aroun_Edge(1, 0, 45);
                    bool whichcolor = false;

                    if (chanceornot == 0)
                    {
                        cube2.typeofcube = 0;
                    }
                    else if (chanceornot == 1)
                    {
                        if (hole == i)
                        {
                            cube2.typeofcube = 1;
                        }
                    }
                    else if (chanceornot == 2)
                    {
                        if (hole == i)
                        {
                            cube2.typeofcube = 2;
                            whichcolor       = true;
                            CPoint3D_Node forspikess = (CPoint3D_Node)cube2.L_3D_Pts[0];
                            addspikes(forspikess);
                        }
                    }

                    if (whichcolor == false)
                    {
                        cube2.clr = Color.DarkRed;
                    }
                    else if (whichcolor == true)
                    {
                        cube2.clr = Color.Purple;
                    }
                    startfgroundx += 50;
                    Ground.Add(cube2);
                }

                whichtoadd = false;
            }
        }
Ejemplo n.º 3
0
        public void buildandreset()
        {
            XB = 100;
            YB = 50;
            cx = 0;
            cy = 0;
            Ground.Clear();
            Spikes.Clear();
            Movingcube            = new _3D_Model();
            cam                   = new Camera();
            Cube                  = new _3D_Model();
            x.X                   = 0;
            x.Y                   = 0;
            y.X                   = 0;
            y.Y                   = 0;
            chanceornot           = 0;
            hole                  = 0;
            firstclick            = false;
            whichground           = false;
            whichtoadd            = false;
            dropground            = 0;
            rowmovement           = 41;
            rowmovementcheckspike = 41;
            clickedrotate         = false;
            rotsided              = false;
            rotsidea              = false;
            falling               = false;
            crushed               = false;
            checkdeath            = false;
            rotatecounter         = 0;
            fallingcubecounter    = 0;
            fallsound             = false;
            spikemove             = 0;

            cx = (this.Width - 185);
            cy = (this.Height - 150);

            cam.ceneterX = XB + (cx / 2);
            cam.ceneterY = YB + (cy / 2);
            cam.cxScreen = cx;
            cam.cyScreen = cy;
            cam.cop.Y   += 715;
            cam.cop.Z   -= 360;

            Cube.cam = cam;

            Cube.LoadFromFile("Cube.txt");
            Cube.clr = Color.White;
            Transformation_API.Scale(ref Cube.L_3D_Pts, 1.31f, 1f, 4f);

            float startgroundz = -350;

            for (int j = 0; j < 30; j++)
            {
                float startfgroundx = -75;

                _3D_Model cube3 = new _3D_Model();
                cube3.cam = cam;
                cube3.LoadFromFile("Cubewall.txt");
                cube3.upordown = false;
                Transformation_API.Scale(ref cube3.L_3D_Pts, 0.2f, 0.2f, 0.2f);
                cube3.typeofcube = 3;
                Transformation_API.TranslateZ(ref cube3.L_3D_Pts, startgroundz - (10 + 50));
                Transformation_API.TranslateY(ref cube3.L_3D_Pts, -108);
                Transformation_API.TranslateX(ref cube3.L_3D_Pts, -163);
                cube3.Rotat_Aroun_Edge(3, 0, 90);
                cube3.Rotat_Aroun_Edge(8, 1, 146);
                cube3.Rotat_Aroun_Edge(7, 0, 12);

                cube3.clr = Color.DarkRed;
                Ground.Add(cube3);

                if (j > 10)
                {
                    Random rnd1 = new Random();
                    chanceornot = rnd1.Next(3);
                    Random rnd2 = new Random();
                    hole = rnd2.Next(4);
                }

                for (int i = 0; i < 4; i++)
                {
                    _3D_Model cube2 = new _3D_Model();
                    cube2.cam      = cam;
                    cube2.upordown = false;
                    cube2.LoadFromFile("Cube2.txt");
                    Transformation_API.Scale(ref cube2.L_3D_Pts, 0.2f, 0.005f, 0.2f);
                    Transformation_API.TranslateZ(ref cube2.L_3D_Pts, startgroundz);
                    Transformation_API.TranslateY(ref cube2.L_3D_Pts, -100);
                    Transformation_API.TranslateX(ref cube2.L_3D_Pts, startfgroundx);
                    cube2.Rotat_Aroun_Edge(1, 0, 45);
                    bool changecolor = false;

                    if (j <= 10)
                    {
                        cube2.typeofcube = 0;
                    }
                    else if (j > 10 && chanceornot == 0)
                    {
                        cube2.typeofcube = 0;
                    }
                    else if (j > 10 && hole == i && chanceornot == 1)
                    {
                        cube2.typeofcube = 1;
                    }
                    else if (j > 10 && hole == i && chanceornot == 2)
                    {
                        cube2.typeofcube = 2;
                        changecolor      = true;
                        CPoint3D_Node forspikess = (CPoint3D_Node)cube2.L_3D_Pts[0];
                        addspikes(forspikess);
                    }

                    if (changecolor == false)
                    {
                        cube2.clr = Color.DarkGray;
                    }
                    else
                    {
                        cube2.clr = Color.Purple;
                    }

                    startfgroundx += 50;
                    Ground.Add(cube2);
                }

                cube3     = new _3D_Model();
                cube3.cam = cam;
                cube3.LoadFromFile("Cubewall.txt");
                Transformation_API.Scale(ref cube3.L_3D_Pts, 0.2f, 0.2f, 0.2f);
                cube3.upordown   = false;
                cube3.typeofcube = 3;
                Transformation_API.TranslateZ(ref cube3.L_3D_Pts, startgroundz - 10);
                Transformation_API.TranslateY(ref cube3.L_3D_Pts, -108);
                Transformation_API.TranslateX(ref cube3.L_3D_Pts, 102);
                cube3.Rotat_Aroun_Edge(3, 0, 90);
                cube3.Rotat_Aroun_Edge(8, 0, 45);

                cube3.clr = Color.DarkRed;
                Ground.Add(cube3);

                startgroundz += 27;
                startfgroundx = -100;

                if (j > 10)
                {
                    Random rnd1 = new Random();
                    chanceornot = rnd1.Next(3);
                    Random rnd2 = new Random();
                    hole = rnd2.Next(5);
                }

                for (int i = 0; i < 5; i++)
                {
                    _3D_Model cube2 = new _3D_Model();
                    cube2.cam = cam;
                    cube2.LoadFromFile("Cube2.txt");
                    cube2.upordown = false;
                    Transformation_API.Scale(ref cube2.L_3D_Pts, 0.2f, 0.005f, 0.2f);
                    Transformation_API.TranslateZ(ref cube2.L_3D_Pts, startgroundz);
                    Transformation_API.TranslateY(ref cube2.L_3D_Pts, -100);
                    Transformation_API.TranslateX(ref cube2.L_3D_Pts, startfgroundx);
                    cube2.Rotat_Aroun_Edge(1, 0, 45);

                    bool changecolor = false;

                    if (j <= 10)
                    {
                        cube2.typeofcube = 0;
                    }
                    else if (j > 10 && chanceornot == 0)
                    {
                        cube2.typeofcube = 0;
                    }
                    else if (j > 10 && hole == i && chanceornot == 1)
                    {
                        cube2.typeofcube = 1;
                    }
                    else if (j > 10 && hole == i && chanceornot == 2)
                    {
                        cube2.typeofcube = 2;
                        changecolor      = true;
                        CPoint3D_Node forspikess = (CPoint3D_Node)cube2.L_3D_Pts[0];
                        addspikes(forspikess);
                    }

                    if (changecolor == false)
                    {
                        cube2.clr = cube2.clr = Color.DarkRed;
                    }
                    else
                    {
                        cube2.clr = Color.Purple;
                    }

                    startfgroundx += 50;
                    Ground.Add(cube2);
                }

                startgroundz += 30;
            }

            Movingcube.cam = cam;
            Movingcube.LoadFromFile("Cube2.txt");
            Movingcube.upordown = false;
            Transformation_API.Scale(ref Movingcube.L_3D_Pts, 0.2f, 0.2f, 0.2f);
            _3D_Model tempground = (_3D_Model)Ground[41];

            for (int i = 0; i < Movingcube.L_3D_Pts.Count; i++)
            {
                CPoint3D_Node temp        = (CPoint3D_Node)Movingcube.L_3D_Pts[i];
                CPoint3D_Node tempground2 = (CPoint3D_Node)tempground.L_3D_Pts[i];
                temp.X = tempground2.X;
                temp.Z = tempground2.Z;
            }
            Transformation_API.TranslateY(ref Movingcube.L_3D_Pts, -70);

            Movingcube.clr = Color.Blue;

            cam.BuildNewSystem();

            off = new Bitmap(this.ClientSize.Width, this.ClientSize.Height);
        }