Esempio n. 1
0
        public void TinhTien()
        {
            vachkeDuong1.A = Transformations.TinhTien(vachkeDuong1.A, speed, 0);
            vachkeDuong1.B = Transformations.TinhTien(vachkeDuong1.B, speed, 0);
            vachkeDuong2.A = Transformations.TinhTien(vachkeDuong2.A, speed, 0);
            vachkeDuong2.B = Transformations.TinhTien(vachkeDuong2.B, speed, 0);
            vachkeDuong3.A = Transformations.TinhTien(vachkeDuong3.A, speed, 0);
            vachkeDuong3.B = Transformations.TinhTien(vachkeDuong3.B, speed, 0);
            vachkeDuong4.A = Transformations.TinhTien(vachkeDuong4.A, speed, 0);
            vachkeDuong4.B = Transformations.TinhTien(vachkeDuong4.B, speed, 0);

            vachkeDuong5.A = Transformations.TinhTien(vachkeDuong5.A, speed, 0);
            vachkeDuong5.B = Transformations.TinhTien(vachkeDuong5.B, speed, 0);
            vachkeDuong6.A = Transformations.TinhTien(vachkeDuong6.A, speed, 0);
            vachkeDuong6.B = Transformations.TinhTien(vachkeDuong6.B, speed, 0);
            vachkeDuong7.A = Transformations.TinhTien(vachkeDuong7.A, speed, 0);
            vachkeDuong7.B = Transformations.TinhTien(vachkeDuong7.B, speed, 0);
            vachkeDuong8.A = Transformations.TinhTien(vachkeDuong8.A, speed, 0);
            vachkeDuong8.B = Transformations.TinhTien(vachkeDuong8.B, speed, 0);

            //if(checkNgay)
            sun = new Sun(Transformations.TinhTien(sun.hc.Point, -3, 3), 70);
        }
Esempio n. 2
0
        public Hinh1(Graphics g)
        {
            this.g  = g;
            c       = new Car2d(this.g);
            sun     = new Sun(new Point(280, 70), 70);
            moon    = new Moon(new Point(250, 70), 50);
            nenTroi = new HinhChuNhat(new Point(0, 0), new Point(1350, 600), Color.FromArgb(62, 155, 244));

            d            = new HinhChuNhat(new Point(0, 600), new Point(toadoXMax, 800), Color.Black);
            vachkeDuong1 = new Line(new Point(136, toadoY), new Point(340, toadoY), Color.Black);
            vachkeDuong2 = new Line(new Point(476, toadoY), new Point(680, toadoY), Color.Black);
            vachkeDuong3 = new Line(new Point(816, toadoY), new Point(1020, toadoY), Color.Black);
            vachkeDuong4 = new Line(new Point(1156, toadoY), new Point(1360, toadoY), Color.Black);

            vachkeDuong5 = new Line(Transformations.TinhTien(vachkeDuong1.A, -toadoXMax, 0), Transformations.TinhTien(vachkeDuong1.B, -toadoXMax, 0), Color.Black);
            vachkeDuong6 = new Line(Transformations.TinhTien(vachkeDuong2.A, -toadoXMax, 0), Transformations.TinhTien(vachkeDuong2.B, -toadoXMax, 0), Color.Black);
            vachkeDuong7 = new Line(Transformations.TinhTien(vachkeDuong3.A, -toadoXMax, 0), Transformations.TinhTien(vachkeDuong3.B, -toadoXMax, 0), Color.Black);
            vachkeDuong8 = new Line(Transformations.TinhTien(vachkeDuong4.A, -toadoXMax, 0), Transformations.TinhTien(vachkeDuong4.B, -toadoXMax, 0), Color.Black);

            house1 = new HinhChuNhat(new Point(350, 220), new Point(500, 600), Color.Black);
            house2 = new HinhChuNhat(new Point(270, 400), new Point(200, 600), Color.Black);
            house3 = new HinhChuNhat(new Point(340, 300), new Point(280, 600), Color.Black);

            windowns1 = new HinhChuNhat(new Point(370, 580), new Point(400, 600), Color.Black);
            windowns2 = new HinhChuNhat(new Point(370, 530), new Point(400, 550), Color.Black);
            windowns3 = new HinhChuNhat(new Point(370, 480), new Point(400, 500), Color.Black);
            windowns4 = new HinhChuNhat(new Point(370, 430), new Point(400, 450), Color.Black);
            windowns5 = new HinhChuNhat(new Point(370, 380), new Point(400, 400), Color.Black);
            windowns6 = new HinhChuNhat(new Point(370, 330), new Point(400, 350), Color.Black);
            windowns7 = new HinhChuNhat(new Point(370, 280), new Point(400, 300), Color.Black);
            windowns8 = new HinhChuNhat(new Point(370, 230), new Point(400, 250), Color.Black);

            windowns11 = new HinhChuNhat(new Point(450, 580), new Point(480, 600), Color.Black);
            windowns12 = new HinhChuNhat(new Point(450, 530), new Point(480, 550), Color.Black);
            windowns13 = new HinhChuNhat(new Point(450, 480), new Point(480, 500), Color.Black);
            windowns14 = new HinhChuNhat(new Point(450, 430), new Point(480, 450), Color.Black);
            windowns15 = new HinhChuNhat(new Point(450, 380), new Point(480, 400), Color.Black);
            windowns16 = new HinhChuNhat(new Point(450, 330), new Point(480, 350), Color.Black);
            windowns17 = new HinhChuNhat(new Point(450, 280), new Point(480, 300), Color.Black);
            windowns18 = new HinhChuNhat(new Point(450, 230), new Point(480, 250), Color.Black);


            windowns21 = new HinhChuNhat(new Point(330, 580), new Point(290, 600), Color.Black);
            windowns22 = new HinhChuNhat(new Point(330, 530), new Point(290, 550), Color.Black);
            windowns23 = new HinhChuNhat(new Point(330, 480), new Point(290, 500), Color.Black);
            windowns24 = new HinhChuNhat(new Point(330, 430), new Point(290, 450), Color.Black);
            windowns25 = new HinhChuNhat(new Point(330, 380), new Point(290, 400), Color.Black);
            windowns26 = new HinhChuNhat(new Point(330, 330), new Point(290, 350), Color.Black);


            windowns31 = new HinhChuNhat(new Point(250, 580), new Point(220, 600), Color.Black);
            windowns32 = new HinhChuNhat(new Point(250, 530), new Point(220, 550), Color.Black);
            windowns33 = new HinhChuNhat(new Point(250, 480), new Point(220, 500), Color.Black);
            windowns34 = new HinhChuNhat(new Point(250, 430), new Point(220, 450), Color.Black);

            //cai cay xanhxanh
            thanCay = new HinhChuNhat(new Point(820, 480), new Point(850, 600), Color.Black);
            laCay   = new HinhTamGiac(new Point(835, 300), new Point(750, 495), new Point(920, 495), Color.Black);
            //cot den
            trafficlights1 = new HinhChuNhat(new Point(1100, 400), new Point(1110, 600), Color.Black);
            trafficlights2 = new HinhChuNhat(new Point(1050, 390), new Point(1160, 400), Color.Black);
            //bong den
            lightbulbL = new HinhTron(15, new Point(1050, 405), Color.Black);
            lightbulbR = new HinhTron(15, new Point(1160, 405), Color.Black);
            //Cloud
            cloud1 = new HinhTron(35, new Point(900, 100), Color.Black);
            cloud2 = new HinhTron(35, new Point(950, 100), Color.Black);
            cloud3 = new HinhTron(35, new Point(1000, 100), Color.Black);
            cloud4 = new HinhTron(35, new Point(950, 125), Color.Black);
            cloud5 = new HinhTron(28, new Point(400, 80), Color.Black);
            cloud6 = new HinhTron(28, new Point(430, 80), Color.Black);
            cloud7 = new HinhTron(28, new Point(460, 80), Color.Black);
            cloud8 = new HinhTron(28, new Point(430, 100), Color.Black);
        }
Esempio n. 3
0
        public void Reset()
        {
            if (vachkeDuong1.A.X >= toadoXMax)
            {
                vachkeDuong1.A = Transformations.TinhTien(vachkeDuong5.A, -toadoXMax, 0);
                vachkeDuong1.B = Transformations.TinhTien(vachkeDuong5.B, -toadoXMax, 0);
            }

            if (vachkeDuong2.A.X >= toadoXMax)
            {
                vachkeDuong2.A = Transformations.TinhTien(vachkeDuong6.A, -toadoXMax, 0);
                vachkeDuong2.B = Transformations.TinhTien(vachkeDuong6.B, -toadoXMax, 0);
            }

            if (vachkeDuong3.A.X >= toadoXMax)
            {
                vachkeDuong3.A = Transformations.TinhTien(vachkeDuong7.A, -toadoXMax, 0);
                vachkeDuong3.B = Transformations.TinhTien(vachkeDuong7.B, -toadoXMax, 0);
            }

            if (vachkeDuong4.A.X >= toadoXMax)
            {
                vachkeDuong4.A = Transformations.TinhTien(vachkeDuong8.A, -toadoXMax, 0);
                vachkeDuong4.B = Transformations.TinhTien(vachkeDuong8.B, -toadoXMax, 0);
            }

            if (vachkeDuong5.A.X >= toadoXMax)
            {
                vachkeDuong5.A = Transformations.TinhTien(vachkeDuong1.A, -toadoXMax, 0);
                vachkeDuong5.B = Transformations.TinhTien(vachkeDuong1.B, -toadoXMax, 0);
            }

            if (vachkeDuong6.A.X >= toadoXMax)
            {
                vachkeDuong6.A = Transformations.TinhTien(vachkeDuong2.A, -toadoXMax, 0);
                vachkeDuong6.B = Transformations.TinhTien(vachkeDuong2.B, -toadoXMax, 0);
            }

            if (vachkeDuong7.A.X >= toadoXMax)
            {
                vachkeDuong7.A = Transformations.TinhTien(vachkeDuong3.A, -toadoXMax, 0);
                vachkeDuong7.B = Transformations.TinhTien(vachkeDuong3.B, -toadoXMax, 0);
            }

            if (vachkeDuong8.A.X >= toadoXMax)
            {
                vachkeDuong8.A = Transformations.TinhTien(vachkeDuong4.A, -toadoXMax, 0);
                vachkeDuong8.B = Transformations.TinhTien(vachkeDuong4.B, -toadoXMax, 0);
                if (sun.hc.Point.X <= -200)
                {
                    sun = new Sun(new Point(280, 20), 70);
                    DrawNgay();
                    checkNgay = true;
                }
            }


            if (this.sun.hc.Point.X + this.sun.hc.Radius < 0 && checkNgay)
            {
                DrawDem();
                checkNgay = false;
            }
        }