public void GetInput(GameTime gameTime) { // If we are ready to change if (PauseReady == 0) { if (gps.IsButtonDown(Buttons.A) || gps.IsButtonDown(Buttons.RightShoulder)) { Gun = level.Green; } else if (gps.IsButtonDown(Buttons.X) || gps.IsButtonDown(Buttons.LeftShoulder)) { Gun = level.Blue; } else if (gps.IsButtonDown(Buttons.Y) || gps.IsButtonDown(Buttons.LeftTrigger)) { Gun = level.Yellow; } else if (gps.IsButtonDown(Buttons.B) || gps.IsButtonDown(Buttons.RightTrigger)) { Gun = level.Red; } } else if (PauseReady > 100) { PauseReady = 0; } else { PauseReady += gameTime.ElapsedGameTime.Milliseconds; } }
// Resets all variables public void Reset() { RespawnTime = 0; ShootingTimer = 0; Gun = level.Green; Bullets = new List<Bullet>(); BulletPool = new Stack<Bullet>(); RemoveBullets = new List<Bullet>(); HitParticles = new List<Particle>(); TotalVelocity = Vector2.Zero; TimeSinceLastShot = 0; MaxAmmo = 1000; Ammo = MaxAmmo; Lives = 3; Energy = 100; Score = 0; RumbleTime = 0; RumbleAmount = 0; velocity = 8; leftRotation = 0; PauseReady = 0; // Powerups PowerupTime = 0; ShotSpeedModifier = 1.0f; directions = Math.PI / 2; IsRespawning = false; r = new Random(); }
// Loads all the content for the level public void LoadContent() { // Loads the background boxes backgroundBoxTexture = Content.Load<Texture2D>("Graphics/BackgroundBox"); topRight = topLeft = bottomRight = bottomLeft = Color.LightGreen; LinesHighscoresLevel = Content.Load<Texture2D>("Graphics/Menu/LinesHighscoresLevel"); // Loads each gun into existance // Red Gun RedBullet = new BulletType(Content.Load<Texture2D>("Graphics/Bullets/RedBullet"), 5.0f, 15, BulletType.BulletProperties.Fire, 6.0f, 25, 0.01f); Red = new Gun(Content.Load<Texture2D>("Graphics/Pods/RedShip"), 350.0f, RedBullet); Red.GunTexture = Content.Load<Texture2D>("Graphics/Pods/RedWeapon"); Red.Color = Color.Orange; // Yellow Gun YellowBullet = new BulletType(Content.Load<Texture2D>("Graphics/Bullets/YellowBullet"), 100.0f, 50, BulletType.BulletProperties.Bounce, 5.0f, 36, 0.02f); YellowBulletReplaced = new BulletType(Content.Load<Texture2D>("Graphics/Bullets/YellowBullet"), 100.0f, 50, BulletType.BulletProperties.Bounce, 5.0f, 40, 0); Yellow = new Gun(Content.Load<Texture2D>("Graphics/Pods/YellowShip"), 350.0f, YellowBullet); Yellow.GunTexture = Content.Load<Texture2D>("Graphics/Pods/YellowWeapon"); Yellow.Color = Color.LightYellow; // Green Gun GreenBullet = new BulletType(Content.Load<Texture2D>("Graphics/Bullets/GreenBullet"), 50.0f, 25, BulletType.BulletProperties.None, 10.0f, 38, 0); Green = new Gun(Content.Load<Texture2D>("Graphics/Pods/GreenShip"), 125.0f, GreenBullet); Green.GunTexture = Content.Load<Texture2D>("Graphics/Pods/GreenWeapon"); Green.Color = Color.LightGreen; // Blue Gun BlueBullet = new BulletType(Content.Load<Texture2D>("Graphics/Bullets/BlueBullet"), 20.0f, 12, BulletType.BulletProperties.Ice, 10.0f, 45, 0); Blue = new Gun(Content.Load<Texture2D>("Graphics/Pods/BlueShip"), 190.0f, BlueBullet); Blue.GunTexture = Content.Load<Texture2D>("Graphics/Pods/BlueWeapon"); Blue.Color = Color.LightBlue; // Loads the various enemies FollowEnemy = new EnemyType(Content.Load<Texture2D>("Graphics/Enemies/Follow"), 6.0f, 15, 50, EnemyType.EnemyBehavior.MoveTowardsPlayer); DashEnemy = new EnemyType(Content.Load<Texture2D>("Graphics/Enemies/Dash"), 9.0f, 20, 50, EnemyType.EnemyBehavior.DashTowardsPlayer); FloatEnemy = new EnemyType(Content.Load<Texture2D>("Graphics/Enemies/Random"), 4.0f, 10, 50, EnemyType.EnemyBehavior.Float); ClusterEnemy = new EnemyType(Content.Load<Texture2D>("Graphics/Enemies/Cluster"), 4.0f, 5, 16, EnemyType.EnemyBehavior.MoveTowardsPlayer); SnakeEnemy = new EnemyType(Content.Load<Texture2D>("Graphics/Enemies/Snake"), 3.0f, 15, 30, EnemyType.EnemyBehavior.Snake); EnemySpawnTexture = Content.Load<Texture2D>("Graphics/Enemies/Spawn"); EnemySpawnOrigin = new Vector2(100, EnemySpawnTexture.Height / 2); // ThinkFast BlueIcon = Content.Load<Texture2D>("Graphics/ThinkFast/BlueIcon"); BlueMode = Content.Load<Texture2D>("Graphics/ThinkFast/BlueMode"); DontMoveMode = Content.Load<Texture2D>("Graphics/ThinkFast/DontMoveMode"); DontShootMode = Content.Load<Texture2D>("Graphics/ThinkFast/DontShootMode"); GreenIcon = Content.Load<Texture2D>("Graphics/ThinkFast/GreenIcon"); GreenMode = Content.Load<Texture2D>("Graphics/ThinkFast/GreenMode"); RedIcon = Content.Load<Texture2D>("Graphics/ThinkFast/RedIcon"); RedMode = Content.Load<Texture2D>("Graphics/ThinkFast/RedMode"); StopMIcon = Content.Load<Texture2D>("Graphics/ThinkFast/StopSIcon"); StopSIcon = Content.Load<Texture2D>("Graphics/ThinkFast/StopMIcon"); YellowIcon = Content.Load<Texture2D>("Graphics/ThinkFast/YellowIcon"); YellowMode = Content.Load<Texture2D>("Graphics/ThinkFast/YellowMode"); ThinkFastOrigin = new Vector2(BlueMode.Width / 2, BlueMode.Height / 2); ThinkFastIconPoint = new Vector2(640, 85); ThinkFastIconOrigin = new Vector2(BlueIcon.Width / 2, BlueIcon.Height / 2); // The point dots PointDotTexture = Content.Load<Texture2D>("Graphics/Extras/PointDot"); // The travel points WhitePoint = Content.Load<Texture2D>("Graphics/Waypoints/MPTravel2"); WhitePointOutside = Content.Load<Texture2D>("Graphics/Waypoints/MPTravel1"); RedPoint = Content.Load<Texture2D>("Graphics/Waypoints/RedTravel2"); RedPointOutside = Content.Load<Texture2D>("Graphics/Waypoints/RedTravel1"); BluePoint = Content.Load<Texture2D>("Graphics/Waypoints/BlueTravel2"); BluePointOutside = Content.Load<Texture2D>("Graphics/Waypoints/BlueTravel1"); YellowPoint = Content.Load<Texture2D>("Graphics/Waypoints/YellowTravel2"); YellowPointOutside = Content.Load<Texture2D>("Graphics/Waypoints/YellowTravel1"); GreenPoint = Content.Load<Texture2D>("Graphics/Waypoints/GreenTravel2"); GreenPointOutside = Content.Load<Texture2D>("Graphics/Waypoints/GreenTravel1"); gameFont = Content.Load<SpriteFont>("Fonts/Quartz"); gameFontLarge = Content.Load<SpriteFont>("Fonts/QuartzLarge"); gameFontExtraLarge = Content.Load<SpriteFont>("Fonts/QuartzExtraLarge"); // HUDS RedHudTime = Content.Load<Texture2D>("Graphics/HUD/SPTHudRed"); RedHudNoTime = Content.Load<Texture2D>("Graphics/HUD/SPNTHudRed"); GreenHudTime = Content.Load<Texture2D>("Graphics/HUD/SPTHudGreen"); GreenHudNoTime = Content.Load<Texture2D>("Graphics/HUD/SPNTHudGreen"); BlueHudTime = Content.Load<Texture2D>("Graphics/HUD/SPTHudBlue"); BlueHudNoTime = Content.Load<Texture2D>("Graphics/HUD/SPNTHudBlue"); YellowHudTime = Content.Load<Texture2D>("Graphics/HUD/SPTHudYellow"); YellowHudNoTime = Content.Load<Texture2D>("Graphics/HUD/SPNTHudYellow"); TwoPlayerHudTime = Content.Load<Texture2D>("Graphics/HUD/MPTHud2"); TwoPlayerHudNoTime = Content.Load<Texture2D>("Graphics/HUD/MPNTHud2"); ThreePlayerHudTime = Content.Load<Texture2D>("Graphics/HUD/MPTHud3"); ThreePlayerHudNoTime = Content.Load<Texture2D>("Graphics/HUD/MPNTHud3"); FourPlayerHudTime = Content.Load<Texture2D>("Graphics/HUD/MPTHud4"); FourPlayerHudNoTime = Content.Load<Texture2D>("Graphics/HUD/MPNTHud4"); // Powerups FourWayShoot = Content.Load<Texture2D>("Graphics/Extras/FourWayPU2"); FourWayShootSpin = Content.Load<Texture2D>("Graphics/Extras/FourWayPU1"); FastShoot = Content.Load<Texture2D>("Graphics/Extras/SpeedPU2"); FastShootSpin = Content.Load<Texture2D>("Graphics/Extras/SpeedPU1"); OneUp = Content.Load<Texture2D>("Graphics/Extras/OneUpPU2"); OneUpSpin = Content.Load<Texture2D>("Graphics/Extras/OneUpPU1"); // The zone textures WhiteZoneLit = Content.Load<Texture2D>("Graphics/Zones/MPZoneA1"); WhiteZoneLitOutside = Content.Load<Texture2D>("Graphics/Zones/MPZoneA2"); WhiteZoneUnlit = Content.Load<Texture2D>("Graphics/Zones/MPZoneIA1"); WhiteZoneUnlitOutside = Content.Load<Texture2D>("Graphics/Zones/MPZoneIA2"); BlueZoneLit = Content.Load<Texture2D>("Graphics/Zones/BlueZoneA1"); BlueZoneLitOutside = Content.Load<Texture2D>("Graphics/Zones/BlueZoneA2"); BlueZoneUnlit = Content.Load<Texture2D>("Graphics/Zones/BlueZoneIA1"); BlueZoneUnlitOutside = Content.Load<Texture2D>("Graphics/Zones/BlueZoneIA2"); RedZoneLit = Content.Load<Texture2D>("Graphics/Zones/RedZoneA1"); RedZoneLitOutside = Content.Load<Texture2D>("Graphics/Zones/RedZoneA2"); RedZoneUnlit = Content.Load<Texture2D>("Graphics/Zones/RedZoneIA1"); RedZoneUnlitOutside = Content.Load<Texture2D>("Graphics/Zones/RedZoneIA2"); YellowZoneLit = Content.Load<Texture2D>("Graphics/Zones/YellowZoneA1"); YellowZoneLitOutside = Content.Load<Texture2D>("Graphics/Zones/YellowZoneA2"); YellowZoneUnlit = Content.Load<Texture2D>("Graphics/Zones/YellowZoneIA1"); YellowZoneUnlitOutside = Content.Load<Texture2D>("Graphics/Zones/YellowZoneIA2"); GreenZoneLit = Content.Load<Texture2D>("Graphics/Zones/GreenZoneA1"); GreenZoneLitOutside = Content.Load<Texture2D>("Graphics/Zones/GreenZoneA2"); GreenZoneUnlit = Content.Load<Texture2D>("Graphics/Zones/GreenZoneIA1"); GreenZoneUnlitOutside = Content.Load<Texture2D>("Graphics/Zones/GreenZoneIA2"); // Sound effects GreenLaserSound = Content.Load<SoundEffect>("Sound/GreenLaser"); ExplosionSound = Content.Load<SoundEffect>("Sound/Explosion"); RedSound = Content.Load<SoundEffect>("Sound/Red"); YellowSound = Content.Load<SoundEffect>("Sound/Yellow"); BlueSound = Content.Load<SoundEffect>("Sound/Blue"); PowerUpSound = Content.Load<SoundEffect>("Sound/PowerUpSound"); ThinkFastWarning = Content.Load<SoundEffect>("Sound/ThinkFastFinal"); DeathSound = Content.Load<SoundEffect>("Sound/DeathSoundEffect3"); // Particles RegularParticle = Content.Load<Texture2D>("Graphics/Particles/Particle"); BlueParticle = Content.Load<Texture2D>("Graphics/Particles/BParticle"); YellowParticle = Content.Load<Texture2D>("Graphics/Particles/YParticle"); RedParticle = Content.Load<Texture2D>("Graphics/Particles/RParticle"); GreenParticle = Content.Load<Texture2D>("Graphics/Particles/GParticle"); RedExplosionParticle = Content.Load<Texture2D>("Graphics/Particles/REParticle"); BlueExplosionParticle = Content.Load<Texture2D>("Graphics/Particles/BEParticle"); YellowExplosionParticle = Content.Load<Texture2D>("Graphics/Particles/YEParticle"); YellowGunExplosionParticle = Content.Load<Texture2D>("Graphics/Particles/YCParticle"); GreenExplosionParticle = Content.Load<Texture2D>("Graphics/Particles/GEParticle"); RedLight = Content.Load<Texture2D>("Graphics/Particles/RELight"); BlueLight = Content.Load<Texture2D>("Graphics/Particles/BELight"); YellowLight = Content.Load<Texture2D>("Graphics/Particles/YELight"); GreenLight = Content.Load<Texture2D>("Graphics/Particles/GELight"); PulseTexture = RegularParticle; BlankPixel = Content.Load<Texture2D>("Graphics/Extras/BlankDot"); }