Esempio n. 1
0
        public ActionScene1(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.White);

            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.Yellow);
            this.Components.Add(lives);

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

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

            Texture2D boss1Tex = this.Game.Content.Load <Texture2D>("Images/boss1");

            this.boss1 = new EnemyBoss1(this.Game, spriteBatch, boss1Tex, new Vector2(Shared.stage.X + boss1Tex.Width / 2, Shared.stage.Y / 2), new Vector2(4, 2));
        }
Esempio n. 2
0
 public CollisionManager(Game game,
                         List <ShipBullet> bulletList,
                         Ship ship,
                         EnemyBullet enemyBullet,
                         List <EnemyBullet> enemyBulletList,
                         List <EnemyShip> enemyList,
                         EnemyBoss1 boss1,
                         List <EnemyBullet> boss1BulletList)
     : base(game)
 {
     // TODO: Construct any child components here
     this.bulletList      = bulletList;
     this.enemyBulletList = enemyBulletList;
     this.ship            = ship;
     this.enemyBullet     = enemyBullet;
     this.enemyList       = enemyList;
     this.boss1           = boss1;
     this.boss1BulletList = boss1BulletList;
 }