Exemplo n.º 1
0
        //Texture2D texture
        public void Initialize(Animation animation, Vector2 position)
        {
            bossPosition = position;

            bossAnimation = animation;

            bossActive = true;

            bossDamage = 10;

            bossHealth = 10;
        }
Exemplo n.º 2
0
        // Initialize the player
        public void Initialize(Animation animation, Vector2 position)
        {
            PlayerAnimation = animation;

            // Set the starting position of the player around the middle of the screen and to the back
            Position = position;

            // Set the player to be active
            Active = true;

            // Set the player health
            Health = 100;
        }
Exemplo n.º 3
0
        public void Initialize(Animation animation, Vector2 position)
        {
            // Load the enemy ship texture
            EnemyAnimation = animation;

            // Set the position of the enemy
            Position = position;

            // We initialize the enemy to be active so it will be update in the game
            Active = true;

            // Set the health of the enemy
            Health = 15;

            // Set the amount of damage the enemy can do
            Damage = 10;

            // Set how fast the enemy moves
            enemyMoveSpeed = 6f;

            // Set the score value of the enemy
            Value = 100;
        }
Exemplo n.º 4
0
 private void AddExplosion(Vector2 position)
 {
     Animation explosion = new Animation();
     explosion.Initialize(explosionTexture, position, 134, 134, 12, 45, Color.White, 1f, false);
     explosions.Add(explosion);
 }
Exemplo n.º 5
0
        private void AddEnemy()
        {
            // Create the animation object
            Animation enemyAnimation = new Animation();

            // Initialize the animation with the correct animation information
            enemyAnimation.Initialize(enemyTexture, Vector2.Zero, 110, 45, 8, 30, Color.White, 1f, true);

            // Randomly generate the position of the enemy
            Vector2 position = new Vector2(GraphicsDevice.Viewport.Width + enemyTexture.Width / 2, random.Next(100, GraphicsDevice.Viewport.Height - 100));

            // Create an enemy
            Enemy enemy = new Enemy();

            // Initialize the enemy
            enemy.Initialize(enemyAnimation, position);

            // Add the enemy to the active enemies list
            enemies.Add(enemy);
        }
Exemplo n.º 6
0
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

                    IsMouseVisible = true;
                    btnPlay = new cButton(Content.Load<Texture2D>("playJet"), graphics.GraphicsDevice);
                    btnPlay.setPosition(new Vector2(350,300));
                    btnHelp = new cButton(Content.Load<Texture2D>("help"), graphics.GraphicsDevice);
                    btnHelp.setPosition(new Vector2(350,350));
                    btnExit = new cButton(Content.Load<Texture2D>("exitJet"), graphics.GraphicsDevice);
                    btnExit.setPosition(new Vector2(350,400));

                    btnBack = new cButton(Content.Load<Texture2D>("backOption"), graphics.GraphicsDevice);
                    btnBack.setPosition(new Vector2(490,220));

                    //mission brief
                    missionBriefLvl1 = Content.Load<Texture2D>("missionBriefPng");
                    missionBriefLvl1Rect = new Rectangle(630, -20, missionBriefLvl1.Width, missionBriefLvl1.Height);

                    //pause
                    pausedTexture = Content.Load<Texture2D>("Paused");
                    pausedRectangle = new Rectangle(0, 0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);
                    btnResume = new cButton(Content.Load<Texture2D>("resume"), graphics.GraphicsDevice);
                    btnResume.setPosition(new Vector2(350, 225));
                    btnQuit = new cButton(Content.Load<Texture2D>("ExitJet"), graphics.GraphicsDevice);
                    btnQuit.setPosition(new Vector2(350, 275));

                    //mission Complete
                    missionCompleteTexture = Content.Load<Texture2D>("missionComplete");
                    missionCompleteRectangle = new Rectangle(0,0, missionCompleteTexture.Width, missionCompleteTexture.Height);
                    btnProceed = new cButton(Content.Load<Texture2D>("proceed"), graphics.GraphicsDevice);
                    btnProceed.setPosition(new Vector2(350, 225));

                    //Game Over
                    gameOverTexture = Content.Load<Texture2D>("gameOverArt");
                    gameOverRectangle = new Rectangle(0, 0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);
                    btnMainMenu = new cButton(Content.Load<Texture2D>("mainMenu"), graphics.GraphicsDevice);
                    btnMainMenu.setPosition(new Vector2(300, 225));
                    btnRetry = new cButton(Content.Load<Texture2D>("retry"), graphics.GraphicsDevice);
                    btnRetry.setPosition(new Vector2(450, 225));

                    //victory -game finish
                    victoryTexture = Content.Load<Texture2D>("victoryArt");
                    victoryRectangle = new Rectangle(0,0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);
                    btnMainMenuVictory = new cButton(Content.Load<Texture2D>("mainMenu2"), graphics.GraphicsDevice);
                    btnMainMenuVictory.setPosition(new Vector2(350, 320));

            //load HealthBar
            HpTexture = Content.Load<Texture2D>("HpBar");
            HpPosition = new Vector2(10, 400);
            HpRectangle = new Rectangle(0, 0, HpTexture.Width, HpTexture.Height);

            HpFrameTexture = Content.Load<Texture2D>("HpFrame");
            HpFramePosition = new Vector2(10, 400);

            //level music
            levelOneMusic = Content.Load<Song>("Sounds/level1Sound");
            //PlayMusic(levelOneMusic);
            levelTwoMusic = Content.Load<Song>("Sounds/level2Sound");

            // Load the player resources
            Animation playerAnimation = new Animation();
            Texture2D playerTexture = Content.Load<Texture2D>("planeFlying");
            playerAnimation.Initialize(playerTexture, Vector2.Zero, 120, 40, 8, 30, Color.White, 1f, true);
            Vector2 playerPosition = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X, GraphicsDevice.Viewport.TitleSafeArea.Y
            + GraphicsDevice.Viewport.TitleSafeArea.Height / 2);
            player.Initialize(playerAnimation, playerPosition);

            //load the boss resources
            Animation bossAnimation = new Animation();
            Texture2D bossTexture = Content.Load<Texture2D>("bossAnimation");
            bossAnimation.Initialize(bossTexture, Vector2.Zero, 77, 60, 8, 60, Color.White, 1f, true);
            Vector2 bossPosition = new Vector2(700, 200);
            bossFinal.Initialize(bossAnimation, bossPosition);

            //projectiles
            projectileTexture = Content.Load<Texture2D>("orangeLaser");
            projectileTextureEnemy = Content.Load<Texture2D>("redLaser");
            projectileTextureBoss = Content.Load<Texture2D>("fireBall");

            //enemy content
            enemyTexture = Content.Load<Texture2D>("enemySpriteUpdated");

            // Load the parallaxing background

            bgLayer1.Initialize(Content, "mainBgUpdated", GraphicsDevice.Viewport.Width, -1);
            bgLayer2.Initialize(Content, "cloud1", GraphicsDevice.Viewport.Width, -2);
            bgLayer3.Initialize(Content, "cloud2", GraphicsDevice.Viewport.Width, -3);

            mainBackground = Content.Load<Texture2D>("moon");

            //level 2 parallaxing background
            bgLayer1Lvl2.Initialize(Content, "level2/level2MainBgFinal", GraphicsDevice.Viewport.Width, -1);
            bgLayer2Lvl2.Initialize(Content, "cloud1", GraphicsDevice.Viewport.Width, -2);
            bgLayer3Lvl2.Initialize(Content, "cloud2", GraphicsDevice.Viewport.Width, -3);

            //explosion
            explosionTexture = Content.Load<Texture2D>("explosion");

            //load the jet gun sound
            gunSound = Content.Load<SoundEffect>("Sounds/gunSound");

            //explode
            explodeSound = Content.Load<SoundEffect>("Sounds/Explode");

            //menu takingOff SOund
            takingOffJet = Content.Load<SoundEffect>("Sounds/takingOff");

            //player hit sound
            playerHitSound = Content.Load<SoundEffect>("Sounds/ricochet/ricochet1");

            rain = new ParticleGenerator(Content.Load<Texture2D>("rain"), graphics.GraphicsDevice.Viewport.Width, 50);
        }