예제 #1
0
        public Boolean Collision(Boxes b)
        {
            Rectangle boxRec  = new Rectangle(b.x, b.y, b.sizeW, b.sizeH);
            Rectangle heroRec = new Rectangle(x, y, 10, 10);

            return(boxRec.IntersectsWith(heroRec));
        }
예제 #2
0
        private void SetParameters()
        {
            gameTimer.Enabled = true;
            this.Refresh();
            yesButton.Visible    = false;
            noButton.Visible     = false;
            replayLabel.Visible  = false;
            resultsLabel.Visible = false;
            TimeLabel.Visible    = true;
            this.Focus();



            boxes.Clear();
            hero.Clear();
            fallboxes.Clear();
            platforms.Clear();
            zig.Clear();
            win.Clear();
            Time = 0;

            hero1 = new Hero(15, 40, 10);
            hero.Add(hero1);

            #region  Platforms
            Platforms platform1 = new Platforms(175, 55, 40, 10, 1);
            platforms.Add(platform1);
            Platforms platform2 = new Platforms(175, 95, 40, 10, 1);
            platforms.Add(platform2);
            Platforms platform3 = new Platforms(150, 135, 40, 10, 1);
            platforms.Add(platform3);
            Platforms platform4 = new Platforms(150, 175, 40, 10, 1);
            platforms.Add(platform4);
            #endregion

            #region FallBoxes
            FallBox fall1 = new FallBox(45, -15, 15, 15, 1);
            fallboxes.Add(fall1);
            FallBox fall2 = new FallBox(60, -15, 15, 15, 2);
            fallboxes.Add(fall2);
            FallBox fall3 = new FallBox(75, -15, 15, 15, 3);
            fallboxes.Add(fall3);
            FallBox fall4 = new FallBox(90, -15, 15, 15, 4);
            fallboxes.Add(fall4);
            #endregion

            #region WallBoxes
            Boxes boxRW = new Boxes(400, 0, 15, 240, 0);
            boxes.Add(boxRW);
            Boxes boxBW = new Boxes(0, 235, 400, 15, 0);
            boxes.Add(boxBW);
            Boxes boxLW = new Boxes(-15, 0, 15, 240, 0);
            boxes.Add(boxLW);
            Boxes boxTW = new Boxes(0, -15, 385, 15, 0);
            boxes.Add(boxTW);
            Boxes box1 = new Boxes(40, 0, 10, 175, 2);
            boxes.Add(box1);
            Boxes box2 = new Boxes(40, 175, 50, 10, 0);
            boxes.Add(box2);
            Boxes box3 = new Boxes(90, 175, 10, 10, 1);
            boxes.Add(box3);
            Boxes box4 = new Boxes(150, 50, 10, this.Height, 0);
            boxes.Add(box4);
            Boxes box5 = new Boxes(275, 0, 10, 200, 1);
            boxes.Add(box5);
            #endregion

            #region Zig Boxes
            ZigZag zig1 = new ZigZag(280, 50, 10, 10, 2, 2);
            zig.Add(zig1);
            ZigZag zig2 = new ZigZag(320, 70, 20, 20, -1, 1);
            zig.Add(zig2);
            ZigZag zig3 = new ZigZag(380, 100, 5, 5, -3, 3);
            zig.Add(zig3);
            ZigZag zig4 = new ZigZag(350, 0, 7, 7, 3, -3);
            zig.Add(zig4);
            ZigZag zig5 = new ZigZag(350, 0, 7, 7, -3, 3);
            zig.Add(zig5);
            ZigZag zig6 = new ZigZag(365, 0, 10, 10, 3, 3);
            zig.Add(zig6);

            #endregion

            #region WinBox
            winBox winBox = new winBox(280, 0, 140, 45);
            win.Add(winBox);
            #endregion
        }