Example #1
0
 public void ClampToViewPort(Background bg)
 {
     if (position.X < sprite.Width / 2)
     {
         position.X = sprite.Width / 2;
     }
     if (position.X > bg.Width - sprite.Width / 2)
     {
         position.X = bg.Width - sprite.Width / 2;
     }
     if (position.Y < sprite.Height / 2)
     {
         position.Y = sprite.Height / 2;
     }
     if (position.Y > bg.Height - sprite.Height / 2)
     {
         position.Y = bg.Height - sprite.Height / 2;
     }
 }
Example #2
0
        public bool OutOfViewPort(Background bg)
        {
            if (position.X < sprite.Width)
                return true;
            if (position.X > bg.Width - sprite.Width)
                return true;
            if (position.Y < sprite.Height)
                return true;
            if (position.Y > bg.Height - sprite.Height)
                return true;

            return false;
        }
Example #3
0
        public void LoadContent(ContentManager content)
        {
            // Load particles
            particleManager.addEffect("SMALL_EXPLOSION", content.Load<ParticleEffect>("Particle Effects/Explosion-Red"));
            particleManager.addEffect("SMALL_EXPLOSION2", content.Load<ParticleEffect>("Particle Effects/Explosion-Orange"));
            particleManager.addEffect("MEDIUM_EXPLOSION_PINK", content.Load<ParticleEffect>("Particle Effects/Explosion-Medium-Pink"));
            particleManager.addEffect("LARGE_EXPLOSION_BLUE", content.Load<ParticleEffect>("Particle Effects/Large-Explosion-Blue-Remake"));
            particleManager.addEffect("Ship-Trail-Blue", content.Load<ParticleEffect>("Particle Effects/Ship-Trail-Blue"));
            particleManager.addEffect("MissleTrail-Orange", content.Load<ParticleEffect>("Particle Effects/MissleTrail-Orange"));
            particleManager.addEffect("Ricoshet", content.Load<ParticleEffect>("Particle Effects/Ricochet-Yellow"));
            particleManager.addEffect("WarpIn", content.Load<ParticleEffect>("Particle Effects/WarpIn2"));
            particleManager.LoadContent(content);

            score = content.Load<SpriteFont>("Fonts/scoreFont");
            livesIcon = content.Load<Texture2D>("lives_icon");
            background = new Background(content.Load<Texture2D>("grid_background"));

            player = new Player(content.Load<Texture2D>("PlayerShip"));
            crosshair = content.Load<Texture2D>("crosshair");

            // Load enemy textures
            enemyManager = new EnemyManager(player);
            enemyManager.enemyTextures.Add("SMALL_ASTEROID_RED", content.Load<Texture2D>("SMALL_ASTEROID_RED"));
            enemyManager.enemyTextures.Add("SMALL_ASTEROID_BLUE", content.Load<Texture2D>("SMALL_ASTEROID_BLUE"));
            enemyManager.enemyTextures.Add("SMALL_ASTEROID_GREEN", content.Load<Texture2D>("SMALL_ASTEROID_GREEN"));
            enemyManager.enemyTextures.Add("SMALL_ASTEROID_PINK", content.Load<Texture2D>("SMALL_ASTEROID_PINK"));
            enemyManager.enemyTextures.Add("SMALL_ASTEROID_PURPLE", content.Load<Texture2D>("SMALL_ASTEROID_PURPLE"));

            enemyManager.enemyTextures.Add("MEDIUM_ASTEROID_RED", content.Load<Texture2D>("MEDIUM_ASTEROID_RED"));
            enemyManager.enemyTextures.Add("MEDIUM_ASTEROID_BLUE", content.Load<Texture2D>("MEDIUM_ASTEROID_BLUE"));
            enemyManager.enemyTextures.Add("MEDIUM_ASTEROID_GREEN", content.Load<Texture2D>("MEDIUM_ASTEROID_GREEN"));
            enemyManager.enemyTextures.Add("MEDIUM_ASTEROID_PINK", content.Load<Texture2D>("MEDIUM_ASTEROID_PINK"));
            enemyManager.enemyTextures.Add("MEDIUM_ASTEROID_PURPLE", content.Load<Texture2D>("MEDIUM_ASTEROID_PURPLE"));

            enemyManager.enemyTextures.Add("LARGE_ASTEROID_RED", content.Load<Texture2D>("LARGE_ASTEROID_RED"));
            enemyManager.enemyTextures.Add("LARGE_ASTEROID_BLUE", content.Load<Texture2D>("LARGE_ASTEROID_BLUE"));
            enemyManager.enemyTextures.Add("LARGE_ASTEROID_GREEN", content.Load<Texture2D>("LARGE_ASTEROID_GREEN"));
            enemyManager.enemyTextures.Add("LARGE_ASTEROID_PINK", content.Load<Texture2D>("LARGE_ASTEROID_PINK"));
            enemyManager.enemyTextures.Add("LARGE_ASTEROID_PURPLE", content.Load<Texture2D>("LARGE_ASTEROID_PURPLE"));

            enemyManager.enemyTextures.Add("LARGE_SPINNER_BLUE", content.Load<Texture2D>("LARGE_SPINNER_BLUE"));
            enemyManager.enemyTextures.Add("SMALL_SPINNER_PINK", content.Load<Texture2D>("SMALL_SPINNER_Pink"));

            enemyManager.enemyTextures.Add("ALIEN", content.Load<Texture2D>("ALIEN"));
            enemyManager.enemyTextures.Add("ARMORED", content.Load<Texture2D>("ArmoredEnemy"));

            // Load projectile textures
            player.projectileTextures.Add("NORMAL_BULLET", content.Load<Texture2D>("Projectile2"));
            player.projectileTextures.Add("NORMAL_MISSLE", content.Load<Texture2D>("NORMAL_MISSLE"));

            PowerUpManager.PowerUpTextures.Add("LIFE_UP", content.Load<Texture2D>("powerup_lifeup"));
            PowerUpManager.PowerUpTextures.Add("WEAPON_UPGRADE", content.Load<Texture2D>("powerup_weaponPower"));

            // Load sounds
            SoundManager.soundEffects.Add("player_weapon", content.Load<SoundEffect>("Sounds/fire_laser1"));
            SoundManager.soundEffects.Add("explosion", content.Load<SoundEffect>("Sounds/sound_explosion"));
            SoundManager.soundEffects.Add("powerup", content.Load<SoundEffect>("Sounds/sound_powerup"));

            backgroundLoop = content.Load<Song>("Sounds/particleillusionloop");
            MediaPlayer.Play(backgroundLoop);
            MediaPlayer.IsRepeating = true;
            PauseOverlay = content.Load<Texture2D>("pause_overlay");

            cam = new Camera();
            bloom.Settings = BloomSettings.PresetSettings[6];
            bloom.Visible = true;
        }