Exemplo n.º 1
0
        public static bool Detect(EnemyPlane enemyPlane, PlayerPlane playerPlane)
        {
            // All 4 Players themes
            Point p1 = new Point(playerPlane.getX(), playerPlane.getY());
            Point p2 = new Point(playerPlane.getX() + playerPlane.getImage().Width, playerPlane.getY());
            Point p3 = new Point(playerPlane.getX() + playerPlane.getImage().Width, playerPlane.getY() + playerPlane.getImage().Height);
            Point p4 = new Point(playerPlane.getX(), playerPlane.getY() + playerPlane.getImage().Height);
            // All 4 Enemeys themes
            Point e1 = new Point(enemyPlane.getX(), enemyPlane.getY());
            Point e2 = new Point(enemyPlane.getX() + enemyPlane.getImg().Width, enemyPlane.getY());
            Point e3 = new Point(enemyPlane.getX() + enemyPlane.getImg().Width, enemyPlane.getY() + enemyPlane.getImg().Height);
            Point e4 = new Point(enemyPlane.getX(), enemyPlane.getY() + enemyPlane.getImg().Height);

            Rectangle r1 = new Rectangle(playerPlane.getX(), playerPlane.getY(), playerPlane.getImage().Width, playerPlane.getImage().Height);

            return(false);
            //Now to check if there is a interfiring
            //    bool OutSideBottom =
            //      playerPlane.getImg().GetBounds.Bottom < enemyPlane.getImg().GetBounds().Top;

/*
 *          GraphicsUnit o1Bounds = GraphicsUnit.Point;
 *          RectangleF Rect1 = o1.GetBounds(ref o1Bounds);
 *          GraphicsUnit o2Bounds = GraphicsUnit.Point;
 *          RectangleF Rect2 = o2.GetBounds(ref o2Bounds);
 *
 *
 *        bool OutsideBottom = Rect1.Bottom < Rect2.Top;
 *        bool OutsideTop = Rect1.Top > Rect2.Bottom;
 *        bool OutsideLeft = Rect1.Left > Rect2.Right;
 *        bool OutsideRight = Rect1.Right < Rect2.Left;
 *
 *          return !(OutsideBottom || OutsideTop || OutsideLeft || OutsideRight);
 */
/*          Rectangle r1 = new Rectangle(object1.getX(), object1.getY(), object1.getImg().Width, object1.getImg().Height);
 *        Rectangle r2 = new Rectangle(object2.getX(), object2.getY(), object2.getImage().Width, object2.getImage().Height);
 *
 *        bool OutsideBottom = r1.Bottom < r2.Top;
 *        bool OutsideTop = r1.Top > r2.Bottom;
 *        bool OutsideLeft = r1.Left > r2.Right;
 *        bool OutsideRight = r1.Right < r2.Left;
 *
 *      //return r1.IntersectsWith(r2);
 *        return !(OutsideBottom || OutsideTop || OutsideLeft || OutsideRight);
 */
        }
Exemplo n.º 2
0
        public static bool Detect(EnemyPlane enemyPlane, PlayerPlane playerPlane)
        {
            // All 4 Players themes
            Point p1 = new Point(playerPlane.getX(), playerPlane.getY());
            Point p2 = new Point(playerPlane.getX() + playerPlane.getImage().Width, playerPlane.getY());
            Point p3 = new Point(playerPlane.getX() + playerPlane.getImage().Width,playerPlane.getY() + playerPlane.getImage().Height);
            Point p4 = new Point(playerPlane.getX(),  playerPlane.getY() + playerPlane.getImage().Height);
            // All 4 Enemeys themes
            Point e1 = new Point(enemyPlane.getX(), enemyPlane.getY());
            Point e2 = new Point(enemyPlane.getX() + enemyPlane.getImg().Width, enemyPlane.getY());
            Point e3 = new Point(enemyPlane.getX() + enemyPlane.getImg().Width, enemyPlane.getY() + enemyPlane.getImg().Height);
            Point e4 = new Point(enemyPlane.getX(), enemyPlane.getY() + enemyPlane.getImg().Height);

             Rectangle r1 = new Rectangle(playerPlane.getX(),playerPlane.getY(),playerPlane.getImage().Width,playerPlane.getImage().Height);
             return false;
            //Now to check if there is a interfiring
            //    bool OutSideBottom =
              //      playerPlane.getImg().GetBounds.Bottom < enemyPlane.getImg().GetBounds().Top;

            /*
            GraphicsUnit o1Bounds = GraphicsUnit.Point;
            RectangleF Rect1 = o1.GetBounds(ref o1Bounds);
            GraphicsUnit o2Bounds = GraphicsUnit.Point;
            RectangleF Rect2 = o2.GetBounds(ref o2Bounds);

              bool OutsideBottom = Rect1.Bottom < Rect2.Top;
              bool OutsideTop = Rect1.Top > Rect2.Bottom;
              bool OutsideLeft = Rect1.Left > Rect2.Right;
              bool OutsideRight = Rect1.Right < Rect2.Left;

            return !(OutsideBottom || OutsideTop || OutsideLeft || OutsideRight);
            */
              /*          Rectangle r1 = new Rectangle(object1.getX(), object1.getY(), object1.getImg().Width, object1.getImg().Height);
            Rectangle r2 = new Rectangle(object2.getX(), object2.getY(), object2.getImage().Width, object2.getImage().Height);

            bool OutsideBottom = r1.Bottom < r2.Top;
            bool OutsideTop = r1.Top > r2.Bottom;
            bool OutsideLeft = r1.Left > r2.Right;
            bool OutsideRight = r1.Right < r2.Left;

              //return r1.IntersectsWith(r2);
            return !(OutsideBottom || OutsideTop || OutsideLeft || OutsideRight);
               */
        }
Exemplo n.º 3
0
//Function to re-load the scene if we want to play again.
        public void Run()
        {
            // Get max Width and max height of the Form
            maxWidth  = this.ClientSize.Width;
            maxHeight = this.ClientSize.Height;
            // Make the players
            playerPlane = new PlayerPlane(maxWidth, maxHeight);
            //Make enemy planes and fill the list
            Planes = new List <EnemyPlane>();
            fillList();
            //Make the Boss and his Rocket
            boss        = new Boss(300, 20, this.ClientSize.Width);
            bossRockets = new List <Rocket>();
            //Check if there is a boss on the screen
            BosFight = false;
            // Set the Backgounds [2 Backgrounds repeteng them selfs]
            BG  = new BackGround(-764);
            BG1 = new BackGround(0);
            //Make Clouds on the screen
            clouds = new List <cloud>();
            fillClouds();
            // Set the buffer
            this.DoubleBuffered = true;
            // Set the Blast Image, Scores, Remaining lifes, Time left, and Boss HP bar
            Blast               = false;
            Images              = new BlastImages();
            scoore              = new HighScore();
            ScoreLabel.Text     = string.Format("High Score: {0}", scoore.getScore());
            RemainingLifes.Text = string.Format("Player Lifes: {0}", playerPlane.getPlayerLife());
            TimeLeft            = 180;
            BosLife.Visible     = false;
            BosLife.Value       = boss.getLife();
            //Set the sounds
            sounds = new Sounds();
            sounds.playMainMusic();
            //Get the timers Ready
            GameTimer.Enabled  = true;
            PlayerTime.Enabled = true;
        }
Exemplo n.º 4
0
 //Function to re-load the scene if we want to play again.
 public void Run()
 {
     // Get max Width and max height of the Form
             maxWidth = this.ClientSize.Width;
             maxHeight = this.ClientSize.Height;
     // Make the players
             playerPlane = new PlayerPlane(maxWidth, maxHeight);
     //Make enemy planes and fill the list
             Planes = new List<EnemyPlane>();
             fillList();
     //Make the Boss and his Rocket
             boss = new Boss(300, 20, this.ClientSize.Width);
             bossRockets = new List<Rocket>();
     //Check if there is a boss on the screen
             BosFight = false;
     // Set the Backgounds [2 Backgrounds repeteng them selfs]
             BG = new BackGround(-764);
             BG1 = new BackGround(0);
     //Make Clouds on the screen
             clouds = new List<cloud>();
             fillClouds();
     // Set the buffer
             this.DoubleBuffered = true;
     // Set the Blast Image, Scores, Remaining lifes, Time left, and Boss HP bar
             Blast = false;
             Images = new BlastImages();
             scoore = new HighScore();
             ScoreLabel.Text =string.Format("High Score: {0}",scoore.getScore());
             RemainingLifes.Text =string.Format("Player Lifes: {0}",playerPlane.getPlayerLife());
             TimeLeft = 180;
             BosLife.Visible = false;
             BosLife.Value = boss.getLife();
     //Set the sounds
             sounds = new Sounds();
             sounds.playMainMusic();
     //Get the timers Ready
             GameTimer.Enabled = true;
             PlayerTime.Enabled = true;
 }