public EnemyShooter(SpriteSheet spriteSheet) : base(spriteSheet) { this.Health = Config.EnemyHealth; //this.ExplosionSpriteSheet = Config.SmallExplosionSpriteSheet; this.Speed = Config.EnemySpeed; this.FireAction = new FireAction(shooterProjectileBullet.enemyFireBullet); //this.Weapon = new WeaponSingle(this); //WeaponBurstWave burst = new WeaponBurstWave(this, 0, 8, 0.8f); //this.Weapon = new WeaponAutoBurst(this, Config.EnemyFireInterval, burst); //WeaponBurstWave burst = new WeaponBurstWave(this, 0, 8, 0.8f); //WeaponBurstWave burstWeapon = new WeaponBurstWave(this, 0, 2, 0.3f); this.Weapon = new WeaponBurstWave(this, 0, 2, 0.3f); //this.Weapon = new WeaponAutoBurst(this, 5, burstWeapon); this.Weapon.Direction = new Vector2(0, 1); //this.Weapon.Offset = new Vector2(0, this.Sprite.Origin.Y); this.fireTimer = new Timer(); this.fireTimer.Fire += new NotifyHandler(fireTimer_Fire); this.fireTimer.Start(5); this.baseTexture = new Sprite(Config.EnemyShooterSpriteSheetBase); this.baseTexture.Color = Color.DarkGoldenrod; moveTo = new Vector2(Config.Rand.Next(50, 1550), Config.Rand.Next(50, 910)); }
public WeaponAuto(Ship ship, double fireInterval) : base(ship) { this.FireInterval = fireInterval; this.timer = new Timer(); this.timer.Fire += new NotifyHandler(timer_Fire); }
public GameNode(SpriteSheet spriteSheet) : base(spriteSheet) { bounds = new Rectangle(0, 0, Config.WorldBoundsX, Config.WorldBoundsY); bounds.Inflate((int)(this.Sprite.Origin.X * 3), (int)(this.Sprite.Origin.Y * 3)); hitTimer = new Timer(); hitTimer.Fire += new NotifyHandler(hitTimer_Fire); }
//Sidearm sidearm1; //Sidearm sidearm2; //Sidearm sidearm3; //Sidearm sidearm4; public EnemyInterceptor(SpriteSheet spriteSheet) : base(spriteSheet) { this.Health = Config.EnemyHealth; this.Speed = Config.EnemySpeed; this.FireAction = new FireAction(enemyProjectileBullet.enemyFireBullet); this.Weapon = new WeaponSingle(this); this.Weapon.Direction = new Vector2(0, 1); this.fireTimer = new Timer(); this.fireTimer.Fire += new NotifyHandler(fireTimer_Fire); this.baseTexture = new Sprite(Config.EnemyInterceptorSpriteSheetBase); this.baseTexture.Color = Color.Turquoise; moveTo = new Vector2(Config.Rand.Next(50, 1550), Config.Rand.Next(50, 910)); //sidearm1 = new Sidearm(Config.EnemyChaserSpriteSheet, this, new Vector2(30, 0)); //sidearm1.Position = new Vector2(Config.WorldBoundsX / 2, Config.WorldBoundsY / 2 - this.Sprite.Origin.Y); //sidearm1.SetParent(this); //sidearm2 = new Sidearm(Config.EnemyChaserSpriteSheet, this, new Vector2(30, 0)); //sidearm2.Position = new Vector2(Config.WorldBoundsX / 2, Config.WorldBoundsY / 2 - this.Sprite.Origin.Y); //sidearm2.SetParent(this); //sidearm3 = new Sidearm(Config.EnemyChaserSpriteSheet, this, new Vector2(30, 0)); //sidearm3.Position = new Vector2(Config.WorldBoundsX / 2, Config.WorldBoundsY / 2 - this.Sprite.Origin.Y); //sidearm3.SetParent(this); //sidearm4 = new Sidearm(Config.EnemyChaserSpriteSheet, this, new Vector2(30, 0)); //sidearm4.Position = new Vector2(Config.WorldBoundsX / 2, Config.WorldBoundsY / 2 - this.Sprite.Origin.Y); //sidearm4.SetParent(this); }
public override void Remove() { if (this.fireTimer != null) this.fireTimer.Stop(); fireTimer = null; base.Remove(); }
void invulTimer_Fire() { this.Sprite.Color = new Color(255, 255, 255, 255); this.Invulnerable = false; this.CollisionList = PlayerShip.PlayerShips; this.CollisionList2 = EnemyPlayerShip.EnemyPlayerShips; invulTimer.Stop(); invulTimer = null; }
public override void Remove() { Powerups.Remove(this); if (this.timer != null) { this.timer.Stop(); this.timer = null; } base.Remove(); }
//Vector2 line; //public static List<GameNode> Powerups = new List<GameNode>(); public PowerupEnemy(SpriteSheet spriteSheet) : base(spriteSheet) { this.CollisionList = Enemy.Enemies; timer = new Timer(); interval = 5; timer.Fire += new NotifyHandler(timer_Fire); timer.Start(interval); //Powerups.Add(this); }
public Enemy(SpriteSheet spriteSheet, int invulDuration) : base(spriteSheet) { Enemies.Add(this); this.baseScore = 25; this.Invulnerable = true; this.invulTimer = new Timer(); this.invulTimer.Fire += new NotifyHandler(invulTimer_Fire); this.invulTimer.Start(invulDuration); this.Sprite.Color = new Color(100, 100, 100, 50); }
public Powerup(SpriteSheet spriteSheet) : base(spriteSheet) { this.CollisionList = PlayerShip.PlayerShips; this.CollisionList2 = EnemyPlayerShip.EnemyPlayerShips; timer = new Timer(); interval = 5; timer.Fire += new NotifyHandler(timer_Fire); timer.Start(interval); this.Speed = 10f; Powerups.Add(this); }
public PlayerShield(SpriteSheet spriteSheet, Ship parentShip) : base(spriteSheet) { this.Health = Config.ShieldHealth; this.CollisionList = Enemy.Enemies; //this.CollisionList2 = EnemyPlayerShip.EnemyPlayerShips; shieldVisibleTimer = new Timer(); shieldVisibleTimer.Fire += new NotifyHandler(shieldVisibleTimer_Fire); shieldRegenTick = new Timer(); shieldRegenTick.Fire += new NotifyHandler(shieldRegenTick_Fire); this.parentShip = parentShip; }
public BuddyMissile(SpriteSheet spriteSheet) : base(spriteSheet) { this.Health = Config.EnemyHealth; //this.ExplosionSpriteSheet = Config.SmallExplosionSpriteSheet; this.FireAction = new FireAction(this.FireBullet); this.Weapon = new WeaponBurst(this, Config.EnemyBurstFireInterval, Config.EnemyBurstFireTotal); this.Weapon.Direction = new Vector2(0, 1); //this.Weapon.Offset = new Vector2(0, this.Sprite.Origin.Y); this.fireTimer = new Timer(); this.fireTimer.Fire += new NotifyHandler(fireTimer_Fire); this.fireTimer.Start(Config.EnemyFireInterval); this.Speed = Config.BuddySpeed; this.CollisionList = null; }
public BugDagger3(SpriteSheet spriteSheet) : base(spriteSheet, 1) { this.Health = Config.EnemyHealth; //this.ExplosionSpriteSheet = Config.SmallExplosionSpriteSheet; this.Speed = Config.EnemySpeed - 1; this.FireAction = new FireAction(enemyProjectileBullet.enemyFireBullet); this.Weapon = new WeaponSingle(this); //WeaponBurstWave burst = new WeaponBurstWave(this, 0, 8, 0.8f); //this.Weapon = new WeaponAutoBurst(this, Config.EnemyFireInterval, burst); this.Weapon.Direction = new Vector2(0, 1); //this.Weapon.Offset = new Vector2(0, this.Sprite.Origin.Y); this.fireTimer = new Timer(); this.fireTimer.Fire += new NotifyHandler(fireTimer_Fire); //this.fireTimer.Start(Config.EnemyFireInterval); this.baseTexture = new Sprite(Config.BugDagger3SpriteSheetBase); moveTo = new Vector2(Config.Rand.Next(50, 1550), Config.Rand.Next(50, 910)); }
public boss1(SpriteSheet spriteSheet) : base(spriteSheet) { this.Health = Config.BossHealth; //this.ExplosionSpriteSheet = Config.SmallExplosionSpriteSheet; this.Speed = Config.BossSpeed; this.FireAction = new FireAction(bossProjectileBullet.enemyFireBullet); //this.Weapon = new WeaponSingle(this); //WeaponBurstWave burst = new WeaponBurstWave(this, 0, 8, 0.8f); //WeaponBurstWave burst = new WeaponBurstWave(this, 0, 6, 2.0f); this.Weapon = new WeaponBurstWave(this, 0, 6, 2.0f); //this.Weapon = new WeaponAutoBurst(this, Config.BossFireInterval, burst); this.Weapon.Direction = new Vector2(0, 1); //this.Weapon.Offset = new Vector2(0, this.Sprite.Origin.Y); this.fireTimer = new Timer(); this.fireTimer.Fire += new NotifyHandler(fireTimer_Fire); this.fireTimer.Start(Config.BossFireInterval); this.baseTexture = new Sprite(Config.BossSpriteSheetBase); }
////////////////////////////////////// void InvulnerableTimer_Fire() { isInvulnerable = false; this.Sprite.Color = new Color(255, 255, 255, 255); InvulnerableTimer.Stop(); InvulnerableTimer = null; }
public override void RemoveWeapon() { this.timer.Stop(); this.timer = null; base.RemoveWeapon(); }
public PlayerShip(SpriteSheet spriteSheet) : base(spriteSheet) { PlayerShips.Add(this); this.Speed = Config.ShipSpeed; this.Health = Config.ShipHealth; this.MaxHealth = Config.ShipHealth; this.FireInterval = Config.PlayerFireInterval; //this.ExplosionSpriteSheet = Config.SmallExplosionSpriteSheet; this.FireAction = new FireAction(ProjectileBulletGreenBeam.FireBullet); this.Weapon = new WeaponAuto(this, FireInterval); InvulnerableTimer = new Timer(); InvulnerableTimer.Fire += new NotifyHandler(InvulnerableTimer_Fire); this.InvulnerableTimer.Start(3); isInvulnerable = true; megaMagnetActive = false; laser = new Laser(); ////ShieldBar = new Bar(400, 2, Color.RoyalBlue); //ShieldBar = new Bar(400, 2, new Color(65, 105, 225, 0)); //ShieldBar.Position = new Vector2(200, 440); //ShieldBar.DrawCentered = true; ////HealthBar = new Bar(400, 2, Color.Red); //HealthBar = new Bar(400, 2, new Color(255, 0, 0, 0)); //HealthBar.Position = new Vector2(200, 460); //HealthBar.DrawCentered = true; //WeaponBurst burstWeapon = new WeaponBurstWave(this, 0, 1, 0.14f); //this.Weapon = new WeaponAutoBurst(this, Config.PlayerFireInterval, burstWeapon); //this.FireAction = new FireAction(ProjectileMissile.FireMissile); //this.Weapon = new WeaponBurstWave(this, Config.WaveFireInterval, Config.WaveFireTotal, Config.WaveFireSpread); //WeaponBurst burstWeapon = new WeaponBurstWave(this, Config.WaveFireInterval, Config.WaveFireTotal, Config.WaveFireSpread); //this.Weapon = new WeaponAutoBurst(this, Config.WaveFireInterval * Config.WaveFireTotal, burstWeapon); //spawn sidearms //sidearm1 = new Sidearm(Config.BuddySpriteSheet, this); //sidearm1.Position = this.Position; //sidearm1.SetParent(this); //sidearm1 = new Sidearm(Config.BulletSheetGreenLaser, this, new Vector2(30, 0)); //sidearm1.Position = new Vector2(Config.WorldBoundsX / 2, Config.WorldBoundsY / 2 - this.Sprite.Origin.Y); //sidearm1.SetParent(this); //sidearm2 = new Sidearm(Config.BulletSheetGreenLaser, this, new Vector2(-30, 0)); //sidearm2.Position = new Vector2(Config.WorldBoundsX / 2, Config.WorldBoundsY / 2 - this.Sprite.Origin.Y); //sidearm2.SetParent(this); this.Position = new Vector2(Config.WorldBoundsX / 2, Config.WorldBoundsY / 2 - this.Sprite.Origin.Y); this.baseTexture = new Sprite(Config.CurrentShipBase); this.baseTexture.Color = Config.CurrentShipColor; //GameStateManagementGame.Instance.soundManager.PlaySound("ShipSpawn", 0.5f); ProjectileSpeedTimer = new Timer(); ProjectileSpeedTimer.Fire += new NotifyHandler(ProjectileSpeedTimer_Fire); AddProjectileTimer = new Timer(); AddProjectileTimer.Fire += new NotifyHandler(AddProjectileTimer_Fire); HomingMissileTimer = new Timer(); HomingMissileTimer.Fire += new NotifyHandler(HomingMissileTimer_Fire); SlowAllTimer = new Timer(); SlowAllTimer.Fire += new NotifyHandler(SlowAllTimer_Fire); Shield = new PlayerShield(Config.ShipShield, this); //PlayerShips.Add(Shield); //////////AI if (Config.AIControlled) { //this.Speed = 8f; //moveTo = new Vector2(Config.Rand.Next(50, 1550), Config.Rand.Next(50, 910)); this.Weapon.StartFire(); ////this.fireTimer = new Timer(); ////this.fireTimer.Fire += new NotifyHandler(fireTimer_Fire); ////this.fireTimer.Start(FireInterval); } //////////// }
protected override void OnNavigatedTo(NavigationEventArgs e) { // Set the sharing mode of the graphics device to turn on XNA rendering SharedGraphicsDeviceManager.Current.GraphicsDevice.SetSharingMode(true); //MainPage.myGame.GameManager.SinglePlayerTools.StartPractice(null); // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(SharedGraphicsDeviceManager.Current.GraphicsDevice); Config.timeDropChance = 200; Config.shieldDropChance = 8 + (int)Math.Round(((float)8 / 100) * Config.PowerupDropChance); Config.projectileDropChance = 38 + (int)Math.Round(((float)38 / 100) * Config.PowerupDropChance); Config.missileDropChance = 68 + (int)Math.Round(((float)68 / 100) * Config.PowerupDropChance); Config.firerateDropChance = 128 + (int)Math.Round(((float)128 / 100) * Config.PowerupDropChance); Config.laserDropChance = 188 + (int)Math.Round(((float)158 / 100) * Config.PowerupDropChance); //Config.projectileDropChance = 68 + (int)Math.Round(((float)38 / 100) * Config.PowerupDropChance); //Config.missileDropChance = 98 + (int)Math.Round(((float)68 / 100) * Config.PowerupDropChance); //Config.firerateDropChance = 158 + (int)Math.Round(((float)128 / 100) * Config.PowerupDropChance); //Config.laserDropChance = 218 + (int)Math.Round(((float)158 / 100) * Config.PowerupDropChance); Config.CoinsCollected = 0; multiplierTracker = 2; Config.KillStreak = 0; Config.KillStreakBuildpoints = 0; Config.Score = 0; Config.Multi = 1; Config.AIScore = 0; Config.AIMulti = 1; Config.EmemiesKilled = 0; Config.CoinsCollected = 0; Config.EnemySpeed = 6; playerLives = Config.PlayerLives; playerAbilityUses = Config.PlayerSpecialAbilityUses; if (Config.boostPrepared > 0) { playerAbilityUses++; Config.boostPrepared--; } if (Config.boostShieldsUp > 0) { boostShieldsUpActive = true; } if (Config.boostLastStand > 0) { boostLastStandActive = true; } KillStreakBarBackground = new Bar(200, 20, new Color(0, 0, 0, 128)); KillStreakBarBackground.Position = new Vector2(300, 455); KillStreakBarBackground.Percent = 1f; KillStreakBar = new Bar(200, 20, new Color(0, 128, 0, 128)); KillStreakBar.Position = new Vector2(300, 455); laserCharges = "0"; thumbstick = contentManager.Load<Texture2D>("thumbstick2"); //thumbstick = content.Load<Texture2D>("thumbstick2"); //introExtermination = content.Load<Texture2D>(@"Gamescreens\AlterEgo"); phaserTexture = contentManager.Load<Texture2D>(@"phaser"); levelTimeColorInterval = new Timer(); levelTimeColorInterval.Fire += new NotifyHandler(levelTimeColorInterval_Fire); switch (Config.Level) { case LevelSelect.One: stars = contentManager.Load<Texture2D>(@"Background\Stars3"); backgroundClouds2 = contentManager.Load<Texture2D>(@"Background\BackgroundClouds2"); //musicLevel1 = contentManager.Load<Song>(@"Music\throughthestars"); //musicLevel1 = contentManager.Load<Song>(@"Music\throughthestars"); levelTime = 300; (Application.Current as App).TryPlayBackgroundMusic(1); break; case LevelSelect.Two: stars = contentManager.Load<Texture2D>(@"Background\Stars2"); //backgroundClouds2 = content.Load<Texture2D>(@"Background\cloudlayer2"); backgroundClouds2 = contentManager.Load<Texture2D>(@"Background\BackgroundClouds2"); //musicLevel1 = contentManager.Load<Song>(@"Music\galacticstruggle"); levelTime = 300; levelTimeColor = Color.Green; (Application.Current as App).TryPlayBackgroundMusic(2); break; case LevelSelect.Three: //stars = content.Load<Texture2D>(@"Background\stars"); //backgroundClouds2 = content.Load<Texture2D>(@"Background\nova2"); //backgroundClouds1 = content.Load<Texture2D>(@"Background\stars4"); stars = contentManager.Load<Texture2D>(@"Background\Stars8"); backgroundClouds2 = contentManager.Load<Texture2D>(@"Background\stars7"); backgroundClouds1 = contentManager.Load<Texture2D>(@"Background\cloudlayer2"); //musicLevel1 = contentManager.Load<Song>(@"Music\survival"); levelTime = 300; playerLives = 3; respawnTime = TimeSpan.FromSeconds(5); (Application.Current as App).TryPlayBackgroundMusic(3); break; case LevelSelect.Four: stars = contentManager.Load<Texture2D>(@"Background\stars"); backgroundClouds2 = contentManager.Load<Texture2D>(@"Background\stars10"); backgroundClouds1 = contentManager.Load<Texture2D>(@"Background\stars7"); //musicLevel1 = contentManager.Load<Song>(@"Music\holo"); levelTime = 300; playerLives = 3; respawnTime = TimeSpan.FromSeconds(5); (Application.Current as App).TryPlayBackgroundMusic(4); break; case LevelSelect.Five: //stars = content.Load<Texture2D>(@"Background\Stars5"); //backgroundClouds2 = content.Load<Texture2D>(@"Background\Stars4"); //backgroundClouds1 = content.Load<Texture2D>(@"Background\cloudlayer2"); stars = contentManager.Load<Texture2D>(@"Background\Stars5"); backgroundClouds2 = contentManager.Load<Texture2D>(@"Background\Stars4"); backgroundClouds1 = contentManager.Load<Texture2D>(@"Background\stars7"); //musicLevel1 = contentManager.Load<Song>(@"Music\giantrobotsfighting"); levelTime = 60; (Application.Current as App).TryPlayBackgroundMusic(5); break; case LevelSelect.Six: stars = contentManager.Load<Texture2D>(@"Background\stars"); backgroundClouds2 = contentManager.Load<Texture2D>(@"Background\nova2"); backgroundClouds1 = contentManager.Load<Texture2D>(@"Background\stars4"); //musicLevel1 = contentManager.Load<Song>(@"Music\AgainstTheOdds"); levelTime = 300; (Application.Current as App).TryPlayBackgroundMusic(6); break; case LevelSelect.Practise: //UIdescription = content.Load<Texture2D>(@"Gamescreens\UIdescription"); stars = contentManager.Load<Texture2D>(@"Background\Stars3"); backgroundClouds2 = contentManager.Load<Texture2D>(@"Background\BackgroundClouds2"); //musicLevel1 = contentManager.Load<Song>(@"Music\throughthestars"); levelTime = 300; (Application.Current as App).TryPlayBackgroundMusic(1); break; } font = contentManager.Load<SpriteFont>(@"Fonts\Tahoma14"); floatingScoreFont = contentManager.Load<SpriteFont>(@"Fonts\Andy22"); floatingPowerupFont = contentManager.Load<SpriteFont>(@"Fonts\Andy22"); floatingMultiplierMsgFont = contentManager.Load<SpriteFont>(@"Fonts\Andy48"); andy14 = contentManager.Load<SpriteFont>(@"Fonts\Andy14"); andy18 = contentManager.Load<SpriteFont>(@"Fonts\Andy18"); andy22 = contentManager.Load<SpriteFont>(@"Fonts\Andy22"); andy48 = contentManager.Load<SpriteFont>(@"Fonts\Andy48"); SpriteSheet.LoadContent(contentManager, SharedGraphicsDeviceManager.Current.GraphicsDevice); cam = new Camera2D(SharedGraphicsDeviceManager.Current.GraphicsDevice, worldBounds.Right, worldBounds.Bottom); //GameStateManagementGame.Instance.soundManager.LoadSound("Shot3", @"SoundEffects\Shot3"); //GameStateManagementGame.Instance.soundManager.LoadSound("coin", @"SoundEffects\coin"); //GameStateManagementGame.Instance.soundManager.LoadSound("ShipSpawn", @"SoundEffects\ShipSpawn"); //GameStateManagementGame.Instance.soundManager.LoadSound("ShipExplode", @"SoundEffects\ShipExplode"); Player.SpawnShip(); //Player = new Player(); switch (Config.Level) { case LevelSelect.One: level1 = new Level1(); break; case LevelSelect.Two: level2 = new Level2(); break; case LevelSelect.Three: level3 = new Level3(); Player.SpawnEnemyShip(); break; case LevelSelect.Four: level4 = new Level4(); Player.SpawnEnemyShip(); break; case LevelSelect.Five: level5 = new Level5(); break; case LevelSelect.Six: level6 = new Level6(); break; case LevelSelect.Practise: practise = new Practise(); break; } //bud = new BuddyMissile(Config.BuddySpriteSheet); //bud.Position = Player.Ship.Position; //if (Player.Ship == null) //{ // Player.SpawnShip(); //} //ParticleEngineEffect = new ParticleEffects(graphicsDeviceManager, cam, GraphicsDevice); ParticleEffects.Initialize(SharedGraphicsDeviceManager.Current, SharedGraphicsDeviceManager.Current.GraphicsDevice); //ParticleEngineEffect.LoadContent(content); ParticleEffects.LoadContent(contentManager); FloatingScoreList = new SpriteFontFloatScores(); //FloatingScore = new SpriteFontFloatScore(); //FloatingScore.Color = Color.Green; //FloatingScore.Score = "+"; //FloatingScore.SpriteFont = floatingScoreFont; //FloatingScore.LifeSpan = 1000f; //FloatingScore.SizeTime = 500f; //FloatingScore.ShadowEffect = false; //FloatingScore.EndPosition = new Vector2(20, -20); FloatingPowerupText = new SpriteFontFloatScore(); FloatingPowerupText.Color = Color.White; FloatingPowerupText.Score = "+"; FloatingPowerupText.SpriteFont = floatingPowerupFont; FloatingPowerupText.LifeSpan = 1000f; FloatingPowerupText.SizeTime = 500f; FloatingPowerupText.ShadowEffect = false; FloatingPowerupText.EndPosition = new Vector2(20, -20); FloatingPowerupText.LayerDepth = 0.7f; FloatingMultiplierText = new SpriteFontFloatScore(); FloatingMultiplierText.Color = Color.Green; FloatingMultiplierText.Score = "Multiplyer"; FloatingMultiplierText.SpriteFont = floatingMultiplierMsgFont; FloatingMultiplierText.LifeSpan = 1000f; FloatingMultiplierText.SizeTime = 500f; FloatingMultiplierText.ShadowEffect = true; FloatingMultiplierText.EndPosition = Vector2.Zero; FloatingPowerupText.LayerDepth = 1.0f; //if (queueBullet.queue.Count < 1) //{ // for (int i = 0; i < 100; i++) // { // queueBullet.queue.Enqueue(new queueBullet(Config.BulletSheetEnergyPurple)); // } //} //if (Config.MusicOn && MediaPlayer.GameHasControl) // GameStateManagementGame.Instance.musicManager.Play(musicLevel1); //GameStateManagementGame.Instance.musicManager.Stop(); Bar.Texture = contentManager.Load<Texture2D>("Textures/Fill22"); multiHud = new Sprite(Config.MultiHud); multiHud.Scale = 0.5f; multiHud.Color = Color.Green; multi = (Math.Round(Config.Multi, 2)).ToString() + "x"; healthHud = new Sprite(Config.MultiHud); healthHud.Scale = 0.3f; healthHud.Color = Color.Red; shieldHud = new Sprite(Config.MultiHud); shieldHud.Scale = 0.5f; shieldHud.Color = Color.RoyalBlue; AImultiHud = new Sprite(Config.MultiHud); AImultiHud.Scale = 0.5f; AImultiHud.Color = Color.Green; AImulti = (Math.Round(Config.AIMulti, 2)).ToString() + "x"; AIHealthHud = new Sprite(Config.MultiHud); AIHealthHud.Scale = 0.3f; AIHealthHud.Color = Color.Red; AIShieldHud = new Sprite(Config.MultiHud); AIShieldHud.Scale = 0.5f; AIShieldHud.Color = Color.RoyalBlue; GC.Collect(); // once the load has finished, we use ResetElapsedTime to tell the game's // timing mechanism that we have just finished a very long frame, and that // it should not try to catch up. //ScreenManager.Game.ResetElapsedTime(); // Start the timer timer.Start(); if (Config.ControlOption == 3) AccelerometerHelper.Instance.Active = true; PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled; base.OnNavigatedTo(e); }
/// <summary> /// Load graphics content for the game. /// </summary> public override void Activate(bool instancePreserved) { if (!instancePreserved) { if (content == null) content = new ContentManager(ScreenManager.Game.Services, "Content"); //Example message box for error display //List<string> MBOPTIONS = new List<string>(); //MBOPTIONS.Add("OK"); //string msg = "Text that was typed on the keyboard will be displayed here.\nClick OK to continue..."; //Guide.BeginShowMessageBox("Pause", msg, MBOPTIONS, 0, MessageBoxIcon.Alert, null, null); // if memory leak, try using a new content manager and unloading. //ContentManager levelContent = new ContentManager(services, "Content"); //extensions.initialise_texture(ScreenManager.SpriteBatch); Config.timeDropChance = 200; Config.shieldDropChance = 8 + (int)Math.Round(((float)8 / 100) * Config.PowerupDropChance); Config.projectileDropChance = 38 + (int)Math.Round(((float)38 / 100) * Config.PowerupDropChance); Config.missileDropChance = 68 + (int)Math.Round(((float)68 / 100) * Config.PowerupDropChance); Config.firerateDropChance = 128 + (int)Math.Round(((float)128 / 100) * Config.PowerupDropChance); Config.laserDropChance = 188 + (int)Math.Round(((float)158 / 100) * Config.PowerupDropChance); //Config.projectileDropChance = 68 + (int)Math.Round(((float)38 / 100) * Config.PowerupDropChance); //Config.missileDropChance = 98 + (int)Math.Round(((float)68 / 100) * Config.PowerupDropChance); //Config.firerateDropChance = 158 + (int)Math.Round(((float)128 / 100) * Config.PowerupDropChance); //Config.laserDropChance = 218 + (int)Math.Round(((float)158 / 100) * Config.PowerupDropChance); multiplierTracker = 2; Config.KillStreak = 0; Config.KillStreakBuildpoints = 0; Config.Score = 0; Config.Multi = 1; Config.AIScore = 0; Config.AIMulti = 1; Config.EmemiesKilled = 0; Config.CoinsCollected = 0; Config.EnemySpeed = 6; playerLives = Config.PlayerLives; playerAbilityUses = Config.PlayerSpecialAbilityUses; KillStreakBarBackground = new Bar(200, 20, new Color(0, 0, 0, 128)); KillStreakBarBackground.Position = new Vector2(300, 455); KillStreakBarBackground.Percent = 1f; KillStreakBar = new Bar(200, 20, new Color(0,128,0,128)); KillStreakBar.Position = new Vector2(300, 455); laserCharges = "0"; thumbstick = content.Load<Texture2D>("thumbstick2"); //introExtermination = content.Load<Texture2D>(@"Gamescreens\AlterEgo"); phaserTexture = content.Load<Texture2D>(@"phaser"); levelTimeColorInterval = new Timer(); levelTimeColorInterval.Fire += new NotifyHandler(levelTimeColorInterval_Fire); switch (Config.Level) { case LevelSelect.One: stars = content.Load<Texture2D>(@"Background\Stars3"); backgroundClouds2 = content.Load<Texture2D>(@"Background\BackgroundClouds2"); musicLevel1 = content.Load<Song>(@"Music\throughthestars"); musicLevel1 = content.Load<Song>(@"Music\throughthestars"); levelTime = 300; break; case LevelSelect.Two: stars = content.Load<Texture2D>(@"Background\Stars2"); //backgroundClouds2 = content.Load<Texture2D>(@"Background\cloudlayer2"); backgroundClouds2 = content.Load<Texture2D>(@"Background\BackgroundClouds2"); musicLevel1 = content.Load<Song>(@"Music\galacticstruggle"); levelTime = 300; levelTimeColor = Color.Green; break; case LevelSelect.Three: //stars = content.Load<Texture2D>(@"Background\stars"); //backgroundClouds2 = content.Load<Texture2D>(@"Background\nova2"); //backgroundClouds1 = content.Load<Texture2D>(@"Background\stars4"); stars = content.Load<Texture2D>(@"Background\Stars8"); backgroundClouds2 = content.Load<Texture2D>(@"Background\stars7"); backgroundClouds1 = content.Load<Texture2D>(@"Background\cloudlayer2"); musicLevel1 = content.Load<Song>(@"Music\survival"); levelTime = 300; playerLives = 3; respawnTime = TimeSpan.FromSeconds(5); break; case LevelSelect.Four: stars = content.Load<Texture2D>(@"Background\stars"); backgroundClouds2 = content.Load<Texture2D>(@"Background\stars10"); backgroundClouds1 = content.Load<Texture2D>(@"Background\stars7"); musicLevel1 = content.Load<Song>(@"Music\holo"); levelTime = 300; playerLives = 3; respawnTime = TimeSpan.FromSeconds(5); break; case LevelSelect.Five: //stars = content.Load<Texture2D>(@"Background\Stars5"); //backgroundClouds2 = content.Load<Texture2D>(@"Background\Stars4"); //backgroundClouds1 = content.Load<Texture2D>(@"Background\cloudlayer2"); stars = content.Load<Texture2D>(@"Background\Stars5"); backgroundClouds2 = content.Load<Texture2D>(@"Background\Stars4"); backgroundClouds1 = content.Load<Texture2D>(@"Background\stars7"); musicLevel1 = content.Load<Song>(@"Music\giantrobotsfighting"); levelTime = 60; break; case LevelSelect.Six: stars = content.Load<Texture2D>(@"Background\stars"); backgroundClouds2 = content.Load<Texture2D>(@"Background\nova2"); backgroundClouds1 = content.Load<Texture2D>(@"Background\stars4"); musicLevel1 = content.Load<Song>(@"Music\AgainstTheOdds"); levelTime = 300; break; case LevelSelect.Practise: //UIdescription = content.Load<Texture2D>(@"Gamescreens\UIdescription"); stars = content.Load<Texture2D>(@"Background\Stars3"); backgroundClouds2 = content.Load<Texture2D>(@"Background\BackgroundClouds2"); musicLevel1 = content.Load<Song>(@"Music\throughthestars"); levelTime = 300; break; } font = content.Load<SpriteFont>(@"Fonts\Tahoma14"); floatingScoreFont = content.Load<SpriteFont>(@"Fonts\Andy22"); floatingPowerupFont = content.Load<SpriteFont>(@"Fonts\Andy22"); floatingMultiplierMsgFont = content.Load<SpriteFont>(@"Fonts\Andy48"); andy14 = content.Load<SpriteFont>(@"Fonts\Andy14"); andy18 = content.Load<SpriteFont>(@"Fonts\Andy18"); andy22 = content.Load<SpriteFont>(@"Fonts\Andy22"); andy48 = content.Load<SpriteFont>(@"Fonts\Andy48"); SpriteSheet.LoadContent(content, ScreenManager.GraphicsDevice); cam = new Camera2D(ScreenManager.GraphicsDevice, worldBounds.Right, worldBounds.Bottom); //GameStateManagementGame.Instance.soundManager.LoadSound("Shot3", @"SoundEffects\Shot3"); //GameStateManagementGame.Instance.soundManager.LoadSound("coin", @"SoundEffects\coin"); //GameStateManagementGame.Instance.soundManager.LoadSound("ShipSpawn", @"SoundEffects\ShipSpawn"); //GameStateManagementGame.Instance.soundManager.LoadSound("ShipExplode", @"SoundEffects\ShipExplode"); Player.SpawnShip(); //Player = new Player(); switch (Config.Level) { case LevelSelect.One: level1 = new Level1(); break; case LevelSelect.Two: level2 = new Level2(); break; case LevelSelect.Three: level3 = new Level3(); Player.SpawnEnemyShip(); break; case LevelSelect.Four: level4 = new Level4(); Player.SpawnEnemyShip(); break; case LevelSelect.Five: level5 = new Level5(); break; case LevelSelect.Six: level6 = new Level6(); break; case LevelSelect.Practise: practise = new Practise(); break; } //bud = new BuddyMissile(Config.BuddySpriteSheet); //bud.Position = Player.Ship.Position; //if (Player.Ship == null) //{ // Player.SpawnShip(); //} //ParticleEngineEffect = new ParticleEffects(graphicsDeviceManager, cam, GraphicsDevice); ParticleEffects.Initialize(ScreenManager.GraphicsDeviceManager, ScreenManager.GraphicsDevice); //ParticleEngineEffect.LoadContent(content); ParticleEffects.LoadContent(content); FloatingScoreList = new SpriteFontFloatScores(); //FloatingScore = new SpriteFontFloatScore(); //FloatingScore.Color = Color.Green; //FloatingScore.Score = "+"; //FloatingScore.SpriteFont = floatingScoreFont; //FloatingScore.LifeSpan = 1000f; //FloatingScore.SizeTime = 500f; //FloatingScore.ShadowEffect = false; //FloatingScore.EndPosition = new Vector2(20, -20); FloatingPowerupText = new SpriteFontFloatScore(); FloatingPowerupText.Color = Color.White; FloatingPowerupText.Score = "+"; FloatingPowerupText.SpriteFont = floatingPowerupFont; FloatingPowerupText.LifeSpan = 1000f; FloatingPowerupText.SizeTime = 500f; FloatingPowerupText.ShadowEffect = false; FloatingPowerupText.EndPosition = new Vector2(20, -20); FloatingPowerupText.LayerDepth = 0.7f; FloatingMultiplierText = new SpriteFontFloatScore(); FloatingMultiplierText.Color = Color.White; FloatingMultiplierText.Score = "Multiplyer"; FloatingMultiplierText.SpriteFont = floatingMultiplierMsgFont; FloatingMultiplierText.LifeSpan = 1000f; FloatingMultiplierText.SizeTime = 500f; FloatingMultiplierText.ShadowEffect = true; FloatingMultiplierText.EndPosition = Vector2.Zero; FloatingPowerupText.LayerDepth = 1.0f; //if (queueBullet.queue.Count < 1) //{ // for (int i = 0; i < 100; i++) // { // queueBullet.queue.Enqueue(new queueBullet(Config.BulletSheetEnergyPurple)); // } //} if (Config.MusicOn && MediaPlayer.GameHasControl) GameStateManagementGame.Instance.musicManager.Play(musicLevel1); //GameStateManagementGame.Instance.musicManager.Stop(); Bar.Texture = content.Load<Texture2D>("Textures/Fill22"); multiHud = new Sprite(Config.MultiHud); multiHud.Scale = 0.5f; multiHud.Color = Color.Green; multi = (Math.Round(Config.Multi, 2)).ToString() + "x"; healthHud = new Sprite(Config.MultiHud); healthHud.Scale = 0.3f; healthHud.Color = Color.Red; shieldHud = new Sprite(Config.MultiHud); shieldHud.Scale = 0.5f; shieldHud.Color = Color.RoyalBlue; AImultiHud = new Sprite(Config.MultiHud); AImultiHud.Scale = 0.5f; AImultiHud.Color = Color.Green; AImulti = (Math.Round(Config.AIMulti, 2)).ToString() + "x"; AIHealthHud = new Sprite(Config.MultiHud); AIHealthHud.Scale = 0.3f; AIHealthHud.Color = Color.Red; AIShieldHud = new Sprite(Config.MultiHud); AIShieldHud.Scale = 0.5f; AIShieldHud.Color = Color.RoyalBlue; GC.Collect(); // once the load has finished, we use ResetElapsedTime to tell the game's // timing mechanism that we have just finished a very long frame, and that // it should not try to catch up. ScreenManager.Game.ResetElapsedTime(); } //#if WINDOWS_PHONE // if (Microsoft.Phone.Shell.PhoneApplicationService.Current.State.ContainsKey("PlayerPosition")) // { // playerPosition = (Vector2)Microsoft.Phone.Shell.PhoneApplicationService.Current.State["PlayerPosition"]; // enemyPosition = (Vector2)Microsoft.Phone.Shell.PhoneApplicationService.Current.State["EnemyPosition"]; // } //#endif }