public Game1() { Graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; Explosion = new ExplosionParticleSystem(this, 1, "sprites/explosion"); Components.Add(Explosion); Smoke = new ExplosionSmokeParticleSystem(this, 2, "sprites/smoke"); Components.Add(Smoke); }
public void Initialize() { _projectilePool = new Projectile[WorldSettings.MAXPROJECTILES]; _activeProjectiles = new bool[WorldSettings.MAXPROJECTILES]; _availableProjectiles = new Queue <int>(WorldSettings.MAXPROJECTILES); _projectileVertexList = new List <VertexPositionColor>(WorldSettings.MAXPROJECTILES * 6); //_vertexDeclaration = new VertexDeclaration(_game.GraphicsDevice, VertexPositionColor.VertexElements); _bazookaSmokeParticleSystem = new BazookaSmokeParticleSystem(_game, _game.Content); _bazookaSmokeParticleSystem.Initialize(); _explosionParticleSystem = new ExplosionParticleSystem(_game, _game.Content); _explosionParticleSystem.Initialize(); _explosionSmokeParticleSystem = new ExplosionSmokeParticleSystem(_game, _game.Content); _explosionSmokeParticleSystem.Initialize(); Clear(); }
public AlienShooterGame() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; TargetElapsedTime = TimeSpan.FromTicks(333333); // you can choose whether you want a landscape or portrait // game by using one of the two helper functions defined below InitializePortraitGraphics(); // InitializeLandscapeGraphics(); // Create the screen manager component. screenManager = new ScreenManager(this); Components.Add(screenManager); //Add Explosions and Smoke Game Components to AlienShooter explosionSmokeParticleSystem = new ExplosionSmokeParticleSystem(this, 2); Components.Add(explosionSmokeParticleSystem); explosionParticleSystem = new ExplosionParticleSystem(this, 1); Components.Add(explosionParticleSystem); smokePlumeParticleSystem = new SmokePlumeParticleSystem(this, 8); Components.Add(smokePlumeParticleSystem); // attempt to deserialize the screen manager from disk. if that // fails, we add our default screens. if (!screenManager.DeserializeState()) { // Activate the first screens. screenManager.AddScreen(new BackgroundScreen(), null); screenManager.AddScreen(new MainMenuScreen(), null); } //Imeplement tombstoning support globally if managing //multiple state objects across game gamescreens PhoneApplicationService.Current.Activated += AlienGame_Activated; PhoneApplicationService.Current.Deactivated += AlienGame_Deactivated; }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> public override void LoadContent() { if (content == null) { content = new ContentManager(ScreenManager.Game.Services, "Content"); } if (components == null) { components = ScreenManager.Game.Components; } if (graphics == null) { graphics = ScreenManager.GraphicsDevice; } // create the particle systems and add them to the components list. // we should never see more than one explosion at once explosion = new ExplosionParticleSystem(this, 1); components.Add(explosion); // but the smoke from the explosion lingers a while. smoke = new ExplosionSmokeParticleSystem(this, 2); components.Add(smoke); bloodSprayUp = new RetroBloodSprayWide(this, 100); bloodSprayRight = new RetroBloodSprayParticleSystem(this, 10); bloodSprayLeft = new RetroBloodSprayParticleSystem(this, 10); bloodSprayLeft.Dir = -1.0f; components.Add(bloodSprayUp); components.Add(bloodSprayRight); components.Add(bloodSprayLeft); // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(ScreenManager.Game.GraphicsDevice); // Load fonts hudFont = content.Load <SpriteFont>("Fonts/Hud"); // Load overlay textures winOverlay = content.Load <Texture2D>("Overlays/you_win"); loseOverlay = content.Load <Texture2D>("Overlays/you_lose"); diedOverlay = content.Load <Texture2D>("Overlays/you_died"); arrow = content.Load <Texture2D>("Sprites/arrow"); // Load sounds firstBloodSound = content.Load <SoundEffect>("Sounds/UT/firstblood"); dominatingSound = content.Load <SoundEffect>("Sounds/UT/dominating"); doublekillSound = content.Load <SoundEffect>("Sounds/UT/doublekill"); godlikeSound = content.Load <SoundEffect>("Sounds/UT/godlike"); holyshitSound = content.Load <SoundEffect>("Sounds/UT/holyshit"); killingspreeSound = content.Load <SoundEffect>("Sounds/UT/killingspree"); megakillSound = content.Load <SoundEffect>("Sounds/UT/megakill"); monsterKillSound = content.Load <SoundEffect>("Sounds/UT/monsterkill"); multikillSound = content.Load <SoundEffect>("Sounds/UT/multikill"); ultrakillSound = content.Load <SoundEffect>("Sounds/UT/ultrakill"); unstoppableSound = content.Load <SoundEffect>("Sounds/UT/unstoppable"); wickedsickSound = content.Load <SoundEffect>("Sounds/UT/wickedsick"); failSound = content.Load <SoundEffect>("Sounds/smb_gameover"); //Known issue that you get exceptions if you use Media PLayer while connected to your PC //See http://social.msdn.microsoft.com/Forums/en/windowsphone7series/thread/c8a243d2-d360-46b1-96bd-62b1ef268c66 //Which means its impossible to test this from VS. //So we have to catch the exception and throw it away try { MediaPlayer.IsRepeating = true; MediaPlayer.Play(content.Load <Song>("Sounds/Music/bgmusic1")); } catch { } //Create the players //Player 1 players.Add(new Player(this, Vector2.Zero, 0)); players.Add(new Player(this, Vector2.Zero, 1)); // Set player 2's colors players[1].LoadContent("Sprites/Player/cop_yellow_idle", "Sprites/Player/cop_yellow_running", "Sprites/Player/cop_yellow_jump", "Sprites/Player/cop_yellow_die", "Sprites/Player/cop_yellow_roll", "Sprites/Player/cop_yellow_grenade"); players[1].Flip = SpriteEffects.FlipHorizontally; LoadNextLevel(); }