Пример #1
0
 public CollisionManager2(Game game,
                          List <ShipBullet> bulletList,
                          Ship ship,
                          List <EnemyShip2> enemyList,
                          EnemyBoss2 boss2,
                          List <EnemyBullet> boss2BulletList)
     : base(game)
 {
     // TODO: Construct any child components here
     this.bulletList      = bulletList;
     this.ship            = ship;
     this.enemyList       = enemyList;
     this.boss2           = boss2;
     this.boss2BulletList = boss2BulletList;
 }
Пример #2
0
        public ActionScene2(Game game,
                            SpriteBatch spriteBatch)
            : base(game)
        {
            // TODO: Construct any child components here
            //Paralax Scroll
            this.spriteBatch = spriteBatch;
            Texture2D           tex     = game.Content.Load <Texture2D>("Images/backgroundImageGame");
            Rectangle           srcRect = new Rectangle(0, 0, tex.Width, tex.Height);
            Vector2             pos1    = new Vector2(0, 0);
            ScrollingBackground sb1     = new ScrollingBackground(game, spriteBatch, tex, srcRect, pos1, new Vector2(6, 0), Color.OrangeRed);

            this.Components.Add(sb1);



            //ship
            Texture2D shipTex = game.Content.Load <Texture2D>("Images/Ship1");
            Vector2   pos     = new Vector2(shipTex.Width / 2, Shared.stage.Y / 2);
            Vector2   speed   = new Vector2(7, 7);

            ship = new Ship(game, spriteBatch, shipTex, pos, speed);
            this.Components.Add(ship);



            font = game.Content.Load <SpriteFont>("Fonts/regularFont");
            string  message   = "Life:" + ship.Lives;
            Vector2 dimension = font.MeasureString(message);
            Vector2 fontPos   = new Vector2(Shared.stage.X - dimension.X, Shared.stage.Y - dimension.Y);

            lives = new SimpleString(game, spriteBatch, font, message, fontPos, Color.White);
            this.Components.Add(lives);

            string  scoreMessage   = "Score:" + score2;
            Vector2 scoreDimension = font.MeasureString(scoreMessage);
            Vector2 scorePos       = new Vector2(0, Shared.stage.Y - scoreDimension.Y);

            scoreString = new SimpleString(game, spriteBatch, font, scoreMessage, scorePos, Color.White);
            this.Components.Add(scoreString);

            Texture2D boss2tex = game.Content.Load <Texture2D>("Images/boss2");
            Vector2   position = new Vector2(1450, 200);

            this.boss2 = new EnemyBoss2(game, spriteBatch, boss2tex, position);
        }