/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // Load the player resources Animation playerAnimation = new Animation(); Texture2D playerTexture = Content.Load<Texture2D>("shipAnimation"); playerAnimation.Initialize(playerTexture, Vector2.Zero, 115, 69, 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); // TODO: use this.Content to load your game content here }
private void AddBackgroundEnemy() { // Create the animation object Animation enemyAnimation = new Animation(); // Initialize the animation with the correct animation information enemyAnimation.Initialize(enemyTexture, Vector2.Zero, 47, 61, 8, 30, Color.Gray, (float)(random.NextDouble() * 0.5 + 0.4), true); enemyAnimation.Fade = 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 BackgroundEnemy backgroundEnemy = new BackgroundEnemy(); // Initialize the enemy backgroundEnemy.Initialize(enemyAnimation, position); // Add the enemy to the active enemies list backgroundEnemies.Add(backgroundEnemy); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // Load the player resources Animation playerAnimation = new Animation(); Texture2D playerTexture = Content.Load <Texture2D>("shipAnimation"); playerAnimation.Initialize(playerTexture, Vector2.Zero, 115, 69, 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 parallaxing background bgLayer1.Initialize(Content, "bgLayer1", GraphicsDevice.Viewport.Width, -1); bgLayer2.Initialize(Content, "bgLayer2", GraphicsDevice.Viewport.Width, -2); enemyTexture = Content.Load <Texture2D>("mineAnimation"); projectileTexture = Content.Load <Texture2D>("laser"); explosionTexture = Content.Load <Texture2D>("explosion"); mainBackground = Content.Load <Texture2D>("mainbackground"); // Load the music //gameplayMusic = Content.Load<Song>("Sound/gameMusic"); // Load the laser and explosion sound effect laserSound = Content.Load <SoundEffect>("Sound/laserFire"); explosionSound = Content.Load <SoundEffect>("Sound/explosionsound"); // Start the music right away PlayMusic(gameplayMusic); // Load the score font font = Content.Load <SpriteFont>("gameFont"); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); Animation playerAnim = new Animation(); Texture2D playerTex = Content.Load <Texture2D>("shipAnimation"); playerAnim.Initialize(playerTex, Vector2.Zero, 115, 69, 8, 30, Color.White, 1f, true); Rectangle tsa = GraphicsDevice.Viewport.TitleSafeArea; Vector2 playerPosition = new Vector2(tsa.X, tsa.Y + tsa.Height / 2); player.Initialize(playerAnim, playerPosition); enemyTexture = Content.Load <Texture2D>("mineAnimation"); projectileTexture = Content.Load <Texture2D>("laser"); explosionTexture = Content.Load <Texture2D>("explosion"); font = Content.Load <SpriteFont>("gameFont"); Dictionary <string, int> movingBackgrounds = new Dictionary <string, int>() { { "bgLayer1", -1 }, { "bgLayer2", -2 } }; background.Initialize(Content, "mainbackground", movingBackgrounds, GraphicsDevice.Viewport.Width); gameplayMusic = Content.Load <Song>("sound/gameMusic"); laserSound = Content.Load <SoundEffect>("sound/laserFire"); explosionSound = Content.Load <SoundEffect>("sound/explosion"); PlayMusic(gameplayMusic); }
protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); LoadPlayer(); bgLayer1.Initialize(Content, "Graphics\\bgLayer1", GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 1); bgLayer2.Initialize(Content, "Graphics\\bgLayer2", GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 2); mainBackground = Content.Load <Texture2D>("Graphics\\Starbasesnow"); enemyTexture = Content.Load <Texture2D>("Graphics\\enemyAnimation"); shootingEnemy.LoadContent("Graphics\\shootingEnemy", Content); shootingEnemyAnimation = new Animation(); shootingEnemyAnimation.Initialize(shootingEnemy.Texture, Vector2.Zero, 300, 300, 1, 30, Color.White, 0.2f, true, 0, Vector2.Zero, SpriteEffects.None, 0); enemyCount = 0; laserTexture = Content.Load <Texture2D>("Graphics\\laser"); enemyLaserTexture = Content.Load <Texture2D>("Graphics\\enemyLaser"); healer.LoadContent("Graphics\\healer", Content); healerAnimation = new Animation(); healerAnimation.Initialize(healer.Texture, Vector2.Zero, 155, 114, 3, 30, Color.White, 0.37f, true, 0, Vector2.Zero, SpriteEffects.None, 0); bomb.LoadContent("Graphics\\galaxy", Content); bombAnimation = new Animation(); bombAnimation.Initialize(bomb.Texture, Vector2.Zero, 256, 256, 15, 30, Color.White, 0.42f, true, 0, Vector2.Zero, SpriteEffects.None, 0); for (int i = 0; i < asteroids.Length; i++) { asteroids[i] = new Asteroids(); asteroidsAnimation[i] = new Animation(); } asteroids[0].LoadContent("Graphics\\aestroid1", Content); asteroidsAnimation[0].Initialize(asteroids[0].Texture, Vector2.Zero, 447, 390, 1, 30, Color.White, 0.14f, true, 0, new Vector2(asteroids[0].Texture.Width / 2, asteroids[0].Texture.Height / 2), SpriteEffects.None, 0); asteroids[1].LoadContent("Graphics\\aestroid2", Content); asteroidsAnimation[1].Initialize(asteroids[1].Texture, Vector2.Zero, 424, 349, 1, 30, Color.White, 0.13f, true, 0, new Vector2(asteroids[1].Texture.Width / 2, asteroids[1].Texture.Height / 2), SpriteEffects.None, 0); asteroids[2].LoadContent("Graphics\\aestroid3", Content); asteroidsAnimation[2].Initialize(asteroids[2].Texture, Vector2.Zero, 394, 323, 1, 30, Color.White, 0.14f, true, 0, new Vector2(asteroids[2].Texture.Width / 2, asteroids[2].Texture.Height / 2), SpriteEffects.None, 0); enemyExplosionTexture = Content.Load <Texture2D>("Graphics\\explosion"); allyExplosionTexture = Content.Load <Texture2D>("Graphics\\blueExplosion"); brownAsteroidTexture = Content.Load <Texture2D>("Graphics\\brownExplosion"); greyAsteroidTexture = Content.Load <Texture2D>("Graphics\\greyExplosion"); playButton = new Button("Graphics\\playButton", new Vector2((GraphicsDevice.Viewport.TitleSafeArea.Width / 2), 250), Content, 0.9f, 1f); exitButton = new Button("Graphics\\exitButton", new Vector2((GraphicsDevice.Viewport.TitleSafeArea.Width / 2), 390), Content, 0.9f, 1f); healthBar = new HealthBar("Graphics\\healthBar2", Content, 262, 41, 0.8f, new Vector2(458, 5)); playButtonSound = new Sound(Content, "Sounds\\button", 0.3f, false); exitButtonSound = new Sound(Content, "Sounds\\button", 0.3f, false); playerLaserSound = new Sound(Content, "Sounds\\laser", 0.16f, false); enemyLaserSound = new Sound(Content, "Sounds\\enemyLaser", 0.17f, false); asteroidExplosionSound = new Sound(Content, "Sounds\\asteroidExplosion", 0.17f, false); shootingEnemyExplosionSound = new Sound(Content, "Sounds\\asteroidExplosion", 0.17f, false); bigBombSound = new Sound(Content, "Sounds\\bigBomb", 0.25f, false); healerCollisionSound = new Sound(Content, "Sounds\\health", 0.25f, false); playerExplosionSound = new Sound(Content, "Sounds\\playerExplosion", 0.3f, false); injuredPlayerSound = new Sound(Content, "Sounds\\injuredPlayer", 0.27f, false); gameMusic = new GameMusic(Content, "Sounds\\gameMusic", 0.35f, true); font = Content.Load <SpriteFont>("Text"); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // TODO: use this.Content to load your game content here Animation playerAnimation = new Animation(); Texture2D playerTexture = Content.Load<Texture2D>("Graphics/shipAnimation"); Vector2 playerPosition = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X, GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height / 2); playerAnimation.Initialize(playerTexture, Vector2.Zero, 115, 69, 8, 60, Color.White, 1.0f, true); player.Initialize(playerAnimation, playerPosition); // Lod the parallaxing background backgroundLayer1.Initialize(Content, "Graphics/bgLayer1", GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, -1); backgroundLayer2.Initialize(Content, "Graphics/bgLayer2", GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, -2); mainBackground = Content.Load<Texture2D>("Graphics/mainbackground"); enemyTexture = Content.Load<Texture2D>("Graphics/mineAnimation"); }
private void AddEnemy() { Animation enemyAnimation = new Animation(); enemyAnimation.Initialize(enemyTexture, Vector2.Zero, 47, 61, 8, 30, Color.White, 1f, true); Vector2 position = new Vector2(GraphicsDevice.Viewport.Width + enemyTexture.Width / 2, random.Next(100, GraphicsDevice.Viewport.Height - 100)); Enemy enemy = new Enemy(); enemy.Initialize(enemyAnimation, position); enemies.Add(enemy); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Load the player resources Animation playerAnimation = new Animation(); Animation player2Animation = new Animation(); Texture2D playerTexture = Content.Load<Texture2D>("shipAnimation"); Texture2D player2Texture = Content.Load<Texture2D>("shipAnimation2"); playerAnimation.Initialize(playerTexture, Vector2.Zero, 115, 69, 8, 30, Color.White, 1f, true); enemyTexture = Content.Load<Texture2D>("mineAnimation"); player2Animation.Initialize(player2Texture, Vector2.Zero, 115, 69, 8, 30, Color.White, 1f, true); Vector2 playerPosition = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X, GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height / 2); Vector2 player2Position = new Vector2(GraphicsDevice.Viewport.Width + (50), GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height / 2); player.Initialize(playerAnimation, playerPosition); player2.Initialize(player2Animation,player2Position); // Load the parallaxing background bgLayer1.Initialize(Content, "bgLayer1", GraphicsDevice.Viewport.Width, -1); bgLayer2.Initialize(Content, "bgLayer2", GraphicsDevice.Viewport.Width, -2); mainBackground = Content.Load<Texture2D>("mainbackground"); spriteBatch = new SpriteBatch(GraphicsDevice); projectileTexture = Content.Load<Texture2D>("laser"); explosionTexture = Content.Load<Texture2D>("explosion"); // Load the music gameplayMusic = Content.Load<Song>("sound/gameMusic"); // Load the laser and explosion sound effect laserSound = Content.Load<SoundEffect>("sound/laserFire"); explosionSound = Content.Load<SoundEffect>("sound/explosion"); font = Content.Load<SpriteFont>("gameFont"); // Start the music right away PlayMusic(gameplayMusic); // TODO: use this.Content to load your game content here }
private void AddEnemy() { // Create the animation object Animation enemyAnimation = new Animation(); // Initialize the animation with the correct animation information enemyAnimation.Initialize(enemyTexture, Vector2.Zero, 47, 61, 8, 30, Color.White, 1f, true); // Randomly generate the position of the enemy Vector2 position = new Vector2(ScreenManager.GraphicsDevice.Viewport.Width + enemyTexture.Width / 2, random.Next(100, ScreenManager.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); }
//============================================================================================================================== private void AddRapidFirePowerUp() { // Create the animation object Animation rapidFirePowerUpAnimation = new Animation(); // Initialize the animation with the correct animation information rapidFirePowerUpAnimation.Initialize(rapidFirePowerUpTexture, Vector2.Zero, rapidFirePowerUpTexture.Width, rapidFirePowerUpTexture.Height, 1, 30, Color.White, 1f, true); // Randomly generate the position of the rapid fire power up Vector2 position = new Vector2(GraphicsDevice.Viewport.Width + rapidFirePowerUpTexture.Width / 2, random.Next(100, GraphicsDevice.Viewport.Height - 100)); // Create a power up RapidFirePowerUp rapidFirePowerUp = new RapidFirePowerUp(); // Initialize the rapid fire power up rapidFirePowerUp.Initialize(rapidFirePowerUpAnimation, position, difficultyFactor); // Add the missile power up to the active power up list rapidFirePowerUps.Add(rapidFirePowerUp); }
//============================================================================================================================================= private void AddDiagonal() { // Create the animation object Animation DiagonalAnimation = new Animation(); // Initialize the animation with the correct animation information DiagonalAnimation.Initialize(diagonalTexture, Vector2.Zero, diagonalTexture.Width, diagonalTexture.Height, 1, 30, Color.White, 1f, true); // Randomly generate the position of the enemy Vector2 position = new Vector2(GraphicsDevice.Viewport.Width + diagonalTexture.Width / 2, random.Next(100, GraphicsDevice.Viewport.Height - 100)); // Create an enemy Diagonal diagonal = new Diagonal(); // Initialize the enemy diagonal.Initialize(DiagonalAnimation, position, difficultyFactor); // Add the digonal to the active enemies list diagonals.Add(diagonal); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); //Load Player Resources explosionTexture = Content.Load<Texture2D>("explosion"); Animation playerAnimation = new Animation(); Texture2D playerTexture = Content.Load<Texture2D>("shipAnimation"); playerAnimation.Initialize(playerTexture, Vector2.Zero, 115, 69, 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); //Enemy Resoursces enemyTexture = Content.Load<Texture2D>("mineAnimation"); //Set a constant player move speed playerMoveSpeed = 8.0f; //Projectiles projectileTexture = Content.Load<Texture2D>("laser"); //Set player movement keys movingDown = Keys.Down; movingUp = Keys.Up; movingRight = Keys.Right; movingLeft = Keys.Left; //Audio gameplayMusic = Content.Load<Song>("sound/gameMusic"); laserSound = Content.Load<SoundEffect>("sound/laserFire"); explosionSound = Content.Load<SoundEffect>("sound/explosion"); PlayMusic(gameplayMusic); //Load UI content ui.Initialize(player,Content,"gameFont"); //Enable freedrag gesture TouchPanel.EnabledGestures = GestureType.FreeDrag; // Load background textures bgLayer1.Initialize(Content, "bgLayer1", GraphicsDevice.Viewport.Width, -1); bgLayer2.Initialize(Content, "bgLayer2", GraphicsDevice.Viewport.Width, -2); mainBackground = Content.Load<Texture2D>("mainbackground"); // TODO: use this.Content to load your game content here }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); random = new Random(); pList = new List<PhysicsParticleObject>(); cam.Pos = new Vector2(500.0f, 200.0f); // World is the most important farseer object. It's where // all the objects should be registered and it handles the // entire simulation via the step function. // Here we instantiate it with earth like gravity world = new World(new Vector2(0, 9.8f)); floorTexture = Content.Load<Texture2D>("floor"); floor = new DrawablePhysicsObject(world, floorTexture, new Vector2(GraphicsDevice.Viewport.Width, floorTexture.Height), 1000); floor.Position = new Vector2(GraphicsDevice.Viewport.Width / 2.0f, GraphicsDevice.Viewport.Height - 50); floor.body.BodyType = BodyType.Static; wall = new DrawablePhysicsObject(world, floorTexture, new Vector2(floorTexture.Width, floorTexture.Height), 1000); wall.Position = new Vector2(GraphicsDevice.Viewport.Width / 2.0f, GraphicsDevice.Viewport.Height - 400); wall.body.FixedRotation = true; wall.body.Rotation = 15.5f; wall.body.BodyType = BodyType.Static; platform = new DrawablePhysicsObject(world, floorTexture, new Vector2(GraphicsDevice.Viewport.Width/2, floorTexture.Height), 1000); platform.Position = new Vector2(GraphicsDevice.Viewport.Width / 2.0f, GraphicsDevice.Viewport.Height / 2); platform.body.BodyType = BodyType.Static; player = new DrawablePhysicsObject(world,null, new Vector2(36.0f, 48.0f), 1000); // player = BodyFactory.CreateRectangle(world, 36*pixelToUnit, 48*pixelToUnit, 1f); player.Position = new Vector2(200.0f, 100.0f); // player.body.body.Rotation = 90; player.body.BodyType = BodyType.Dynamic; player.body.Friction = playerFriction; crateList = new List<DrawablePhysicsObject>(); prevKeyboardState = Keyboard.GetState(); Animation playerAnimation = new Animation(); Texture2D playerTexture = Content.Load<Texture2D>("shipAnimation"); Texture2D spriteTexture = Content.Load<Texture2D>("jasperrun"); playerAnimation.Initialize(spriteTexture, new Vector2(0, 0), 32, 48, 4, 100, Color.White, 1f, true); // playerAnimation.Initialize(playerTexture, new Vector2(0, 0), 115, 69, 8, 30, Color.White, 1f, true); playerObj.Initialize(playerAnimation, new Vector2(player.Position.X, player.Position.Y)); List<Texture2D> textures = new List<Texture2D>(); textures.Add(Content.Load<Texture2D>("white")); white = Content.Load<Texture2D>("white"); particleEngine = new ParticleEngine(textures, new Vector2(playerObj.Position.X, playerObj.Position.Y), world); // TODO: use this.Content to load your game content here }
// ��������� ������ private void AddEnemy() { // ��������� ��'���� ������� Animation enemyAnimation = new Animation(); // ����������� ������� ������ enemyAnimation.Initialize(enemyTexture, Vector2.Zero, 47, 61, 8, 30, Color.White, 1f, true); // ��������� ��������� ������� ������ Vector2 position = new Vector2(GraphicsDevice.Viewport.Width + enemyTexture.Width / 2, random.Next(100, GraphicsDevice.Viewport.Height - 100)); // ��������� ��'���� ����� Enemy enemy = new Enemy(); // ����������� ������ enemy.Initialize(enemyAnimation, position, enemyHealth, enemyMoveSpeed); // ��������� ������ �� ������ ��������, � ����� ������, ������ enemies.Add(enemy); }
// ���������� ������� ������������ ��������� protected override void LoadContent() { // ��������� ������ ��'���� SpriteBatch, ���� ������� �� ��������� ������� spriteBatch = new SpriteBatch(GraphicsDevice); // ������������ ������� ������ Animation playerAnimation = new Animation(); Texture2D playerTexture = Content.Load<Texture2D>("shipAnimation"); playerAnimation.Initialize(playerTexture, Vector2.Zero, 115, 69, 8, 30, Color.White, 1f, true); // �������� ������� ������ Vector2 playerPosition = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X + playerAnimation.FrameWidth / 2, GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height/2); player.Initialize(playerAnimation, playerPosition); // ������������ ������� ��������� bgLayer1.Initialize(Content, "bgLayer1", GraphicsDevice.Viewport.Width, -1); bgLayer2.Initialize(Content, "bgLayer2", GraphicsDevice.Viewport.Width, -2); // ��������� ��� mainBackground = Content.Load<Texture2D>("mainbackground"); // �������� ������ enemyTexture = Content.Load<Texture2D>("mineAnimation"); // �������� ������ projectileTexture = Content.Load<Texture2D>("laser"); // ������ explosionTexture = Content.Load<Texture2D>("explosion"); // ������������ ����� gameplayMusic = Content.Load<Song>("sound/gameMusic"); laserSound = Content.Load<SoundEffect>("sound/laserFire"); explosionSound = Content.Load<SoundEffect>("sound/explosion"); sufferGram = Content.Load<Song>("sound/suffer"); // ������������ ������ font = Content.Load<SpriteFont>("gameFont"); // ����� ������ gameOver = Content.Load<Texture2D>("endMenu"); options.Initialize(Content, GraphicsDevice); menu.Initialize(Content, GraphicsDevice, font); // ³��������� ������ � ��������� ���� PlayMusic(menu.MenuMusic); }
private void AddExplosion(Vector2 position) { Animation explosion = new Animation(); explosion.Initialize(explosionTexture, new Vector2(position.X - 35, position.Y - 35), 134, 134, 12, 45, Color.White, 1f, false); explosions.Add(explosion); // Play the explosion sound explosionSound.Play(); }
private void AddBackgroundEnemy() { // Create the animation object Animation enemyAnimation = new Animation(); // Initialize the animation with the correct animation information enemyAnimation.Initialize(enemyTexture, Vector2.Zero, 47, 61, 8, 30, Color.Gray, (float)(random.NextDouble()*0.5+0.4), true); enemyAnimation.Fade = 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 BackgroundEnemy backgroundEnemy = new BackgroundEnemy(); // Initialize the enemy backgroundEnemy.Initialize(enemyAnimation, position); // Add the enemy to the active enemies list backgroundEnemies.Add(backgroundEnemy); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // Load the player resources Animation playerAnimation = new Animation(); Texture2D playerTexture = Content.Load<Texture2D>("shipAnimation"); playerAnimation.Initialize(playerTexture, Vector2.Zero, 115, 69, 8, 45, 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 parallaxing background bgLayer1.Initialize(Content, "bgLayer1", GraphicsDevice.Viewport.Width, -1,230); bgLayer2.Initialize(Content, "bgLayer2", GraphicsDevice.Viewport.Width, -2,120); enemyTexture = Content.Load<Texture2D>("mineAnimation"); projectileTexture = Content.Load<Texture2D>("laser"); explosionTexture = Content.Load<Texture2D>("explosion"); mainBackground = Content.Load<Texture2D>("mainbackground"); // TODO: use this.Content to load your game content here // Load the music gameplayMusic = Content.Load<Song>("sound/gameMusic"); // Load the laser and explosion sound effect laserSound = Content.Load<SoundEffect>("sound/laserFire"); explosionSound = Content.Load<SoundEffect>("sound/explosion"); // Load the score font font = Content.Load<SpriteFont>("gameFont"); // Load the game start and end images startMenuImage = Content.Load<Texture2D>("mainMenu"); gameOverImage = Content.Load<Texture2D>("endMenu"); // Start the music right away PlayMusic(gameplayMusic); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); m_effect = Content.Load<Effect>("Effects/standard"); // Load the player resources Animation playerAnimation = new Animation(); Texture2D playerTexture = Content.Load<Texture2D>("shipAnimation"); playerAnimation.Initialize(playerTexture, Vector2.Zero, 115, 69, 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 parallaxing background bgLayer1.Initialize(Content, "bgLayer1", GraphicsDevice.Viewport.Width, -1); bgLayer2.Initialize(Content, "bgLayer2", GraphicsDevice.Viewport.Width, -2); mainBackground = Content.Load<Texture2D>("mainbackground"); enemyTexture = Content.Load<Texture2D>("mineAnimation"); //load the projectile graphic projectileTexture = Content.Load<Texture2D>("laser"); explosionTexture = Content.Load<Texture2D>("explosion"); //loud music gameplayMusic = Content.Load<Song>("sound/gameMusic"); //load the laser and explosion sound effect laserSound = Content.Load<SoundEffect>("sound/laserfire"); explosionSound = Content.Load<SoundEffect>("sound/explosion"); // start the music right away PlayMusic(gameplayMusic); //load the score font font = Content.Load<SpriteFont>("gameFont"); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // Load the player resources Vector2 playerPosition = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X, GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height / 2); // Load the player resources Animation playerAnimation = new Animation(); Texture2D playerTexture = Content.Load<Texture2D>("shipAnimation"); playerAnimation.Initialize(playerTexture, Vector2.Zero, 115, 69, 8, 30, Color.White, 1f, true); player.Initialize(playerAnimation, playerPosition); // Load the parallaxing background bgLayer1.Initialize(Content, "bgLayer1", GraphicsDevice.Viewport.Width, -1); bgLayer2.Initialize(Content, "bgLayer2", GraphicsDevice.Viewport.Width, -2); mainBackground = Content.Load<Texture2D>("mainbackground"); enemyTexture = Content.Load<Texture2D>("mineAnimation"); projectileTexture = Content.Load<Texture2D>("laser"); explosionTexture = Content.Load<Texture2D>("explosion"); // Load the music gameplayMusic = Content.Load<Song>("sound/gameMusic"); // Load the laser and explosion sound effect and initialize to a soundInstance, and then set volume try { soundInstanceExplosion = Content.Load<SoundEffect>("sound/explosion").CreateInstance(); soundInstanceExplosion.Volume = 0.15f; } catch { } try { soundInstanceLaser = Content.Load<SoundEffect>("sound/laserFire").CreateInstance(); soundInstanceLaser.Volume = 0.7f; } catch { } //PlayMusic(gameplayMusic); //Start the music right away font = Content.Load<SpriteFont>("gameFont"); //load game font combatFont = Content.Load<SpriteFont>("gameFont"); //load combat font }
//============================================================================================================================ protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // Load the player resources Animation playerAnimation = new Animation(); Texture2D playerTexture = Content.Load<Texture2D>("shipAnimation"); playerAnimation.Initialize(playerTexture, Vector2.Zero, 79, 58, 1, 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 parallaxing background bgLayer1.Initialize(Content, "bglayer1", GraphicsDevice.Viewport.Width, -1); bgLayer2.Initialize(Content, "bglayer2", GraphicsDevice.Viewport.Width, -2); enemyTexture = Content.Load<Texture2D>("ship4"); heavyEnemyTexture = Content.Load<Texture2D>("bigShip"); diagonalTexture = Content.Load<Texture2D>("diagonal"); playerCutsceneTexture = Content.Load<Texture2D>("player"); transportTexture = Content.Load<Texture2D>("Ship5"); healthPowerUpTexture = Content.Load<Texture2D>("HealthPowerUp"); missilePowerUpTexture = Content.Load<Texture2D>("MissilePowerUp"); rapidFirePowerUpTexture = Content.Load<Texture2D>("rapidFirePowerUp"); projectileTexture = Content.Load<Texture2D>("laser1"); missileTexture = Content.Load<Texture2D>("rocket"); explosionTexture = Content.Load<Texture2D>("explosion"); // Load the music gameplayMusic = Content.Load<Song>("sound/gameMusic"); cryingSound = Content.Load<Song>("sound/crying_loud_male"); // Load the laser and explosion sound effect laserSound = Content.Load<SoundEffect>("sound/laserFire"); explosionSound = Content.Load<SoundEffect>("sound/explosion"); explosionSound2 = Content.Load<SoundEffect>("sound/explosion-04"); // Start the music right away PlayMusic(gameplayMusic); // Load the score font font = Content.Load<SpriteFont>("gameFont"); mainBackground = Content.Load<Texture2D>("mainbackground"); mainMenu = Content.Load<Texture2D>("mainMenu"); endMenu = Content.Load<Texture2D>("endMenu"); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // Load the player resources Animation playerAnimation = new Animation(); Texture2D playerTexture = Content.Load<Texture2D>("shipAnimation"); playerAnimation.Initialize(playerTexture, Vector2.Zero, 115, 69, 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 parallaxing background bgLayer1.Initialize(Content, "bgLayer1", GraphicsDevice.Viewport.Width, -2.1f); bgLayer2.Initialize(Content, "bgLayer2", GraphicsDevice.Viewport.Width, -3.9f); mainBackground = Content.Load<Texture2D>("mainbackground"); enemyTexture = Content.Load<Texture2D>("mineAnimation"); }
//============================================================================================================================== private void AddHeavyEnemy() { // Create the animation object Animation heavyEnemyAnimation = new Animation(); // Initialize the animation with the correct animation information heavyEnemyAnimation.Initialize(heavyEnemyTexture, Vector2.Zero, heavyEnemyTexture.Width, heavyEnemyTexture.Height, 1, 30, Color.White, 1f, true); // Randomly generate the position of the enemy Vector2 position = new Vector2(GraphicsDevice.Viewport.Width + heavyEnemyTexture.Width / 2, random.Next(100, GraphicsDevice.Viewport.Height - 100)); // Create an enemy HeavyEnemy heavyEnemy = new HeavyEnemy(); // Initialize the enemy heavyEnemy.Initialize(heavyEnemyAnimation, position, difficultyFactor); // Add the heavyEnemy to the active enemies list heavyEnemies.Add(heavyEnemy); }
private void LoadAssets() { // Load the player resources Animation playerAnimation = new Animation(); Texture2D playerTexture = Content.Load<Texture2D>("shipAnimation"); playerAnimation.Initialize(playerTexture, Vector2.Zero, 115, 69, 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 parallaxing background bgLayer1.Initialize(Content, "bgLayer1", GraphicsDevice.Viewport.Width, -1); bgLayer2.Initialize(Content, "bgLayer2", GraphicsDevice.Viewport.Width, -2); enemyTexture = Content.Load<Texture2D>("mineAnimation"); projectileTexture = Content.Load<Texture2D>("laser"); explosionTexture = Content.Load<Texture2D>("explosion"); mainBackground = Content.Load<Texture2D>("mainbackground"); // Load the music gameplayMusic = Content.Load<Song>("Sounds\\gameMusic"); // Load the laser and explosion sound effect laserSound = Content.Load<SoundEffect>("Sounds\\laserFire"); explosionSound = Content.Load<SoundEffect>("Sounds\\explosion"); // Start the music right away PlayMusic(gameplayMusic); loading = false; }
public override void LoadContent() { //////******************* INIT player = new Player(); // Set a constant player move speed playerMoveSpeed = 8.0f; //Enable the FreeDrag gesture. TouchPanel.EnabledGestures = GestureType.FreeDrag; bgLayer1 = new ParallaxingBackground(); bgLayer2 = new ParallaxingBackground(); // Initialize the enemies list enemies = new List<Enemy>(); // Set the time keepers to zero previousSpawnTime = TimeSpan.Zero; // Used to determine how fast enemy respawns enemySpawnTime = TimeSpan.FromSeconds(1.0f); // Initialize our random number generator random = new Random(); projectiles = new List<Projectile>(); // Set the laser to fire every quarter second fireTime = TimeSpan.FromSeconds(.25f); explosions = new List<Animation>(); score = 0; //////////******************* LOAD if (Content == null) Content = new ContentManager(ScreenManager.Game.Services, "Content"); // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = ScreenManager.SpriteBatch; //player.Initialize(Content.Load<Texture2D>("player"), playerPosition); // Load the player resources Animation playerAnimation = new Animation(); Texture2D playerTexture = Content.Load<Texture2D>("shipAnimation"); playerAnimation.Initialize(playerTexture, Vector2.Zero, 115, 69, 8, 30, Color.White, 1f, true); Vector2 playerPosition = new Vector2(ScreenManager.GraphicsDevice.Viewport.TitleSafeArea.X, ScreenManager.GraphicsDevice.Viewport.TitleSafeArea.Y + ScreenManager.GraphicsDevice.Viewport.TitleSafeArea.Height / 2); player.Initialize(playerAnimation, playerPosition); // Load the parallaxing background bgLayer1.Initialize(Content, "bgLayer1", ScreenManager.GraphicsDevice.Viewport.Width, -1); bgLayer2.Initialize(Content, "bgLayer2", ScreenManager.GraphicsDevice.Viewport.Width, -2); mainBackground = Content.Load<Texture2D>("mainbackground"); enemyTexture = Content.Load<Texture2D>("mineAnimation"); projectileTexture = Content.Load<Texture2D>("laser"); explosionTexture = Content.Load<Texture2D>("explosion"); // Load the score font font = Content.Load<SpriteFont>("gameFont"); // Load the music gameplayMusic = Content.Load<Song>("sound/gameMusic"); // Load the laser and explosion sound effect laserSound = Content.Load<SoundEffect>("sound/laserFire"); explosionSound = Content.Load<SoundEffect>("sound/explosion"); SoundEffect.MasterVolume = (float)Game1.VolumeSound / 100; // Start the music right away PlayMusic(gameplayMusic); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // TODO: use this.Content to load your game content here // Load the player resources //Vector2 playerPosition = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X, GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height / 2); //player.Initialize(Content.Load<Texture2D>("player"), playerPosition); *** use only for displays regular texture startScreen = this.Content.Load<Texture2D>("mainMenu"); endScreen = this.Content.Load<Texture2D>("endMenu"); // Load the player resources Animation playerAnimation = new Animation(); Texture2D playerTexture = Content.Load<Texture2D>("shipAnimation"); playerAnimation.Initialize(playerTexture, Vector2.Zero, 115, 69, 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 parallaxing background bgLayer1.Initialize(Content, "spaceBackground1", GraphicsDevice.Viewport.Width, backgroundSpeed); // bgLayer2.Initialize(Content, "bgLayer2", GraphicsDevice.Viewport.Width, -2); enemyTexture = Content.Load<Texture2D>("mineAnimation"); projectileTexture = Content.Load<Texture2D>("laser"); upgradeObjectTexture = Content.Load<Texture2D>("healthPack"); explosionTexture = Content.Load<Texture2D>("explosion"); upgradeTexture = Content.Load<Texture2D>("healthOrb"); // make rectangle that fits entire screen screen = new Rectangle(0, 0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height); // Load the music if (startScreenIsOn == false && endScreenIsOn == false) gameplayMusic = Content.Load<Song>("sound/gameMusic"); else // *** fix conditions so that when I go from end screen to start screen the music doesn't reset gameplayMusic = Content.Load<Song>("sound/menuMusic"); // Load the laser and explosion sound effect laserSound = Content.Load<SoundEffect>("sound/laserFire"); explosionSound = Content.Load<SoundEffect>("sound/explosion"); upgradeSound = Content.Load<SoundEffect>("sound/upgrade"); // Load the score font font = Content.Load<SpriteFont>("gameFont"); // Start the music right away PlayMusic(gameplayMusic); //mainBackground = Content.Load<Texture2D>("spaceBackground3"); }
private void AddExplosion(Vector2 position) { Animation explosion = new Animation(); explosion.Initialize(explosionTexture, position, 134, 134, 12, 45, Color.White, 1f, false); explosions.Add(explosion); if (Game1.WithSound) { // Play the explosion sound explosionSound.Play(); } }
private void AddEnemy() { // Create the animation object Animation enemyAnimation = new Animation(); // Initialize the animation with the correct animation information enemyAnimation.Initialize(enemyTexture, Vector2.Zero, 47, 61, 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(50, GraphicsDevice.Viewport.Height -50)); // 50, and -50 represent the area in which they spawn (higher the number the smaller the area, closer to center) // Create an enemy Enemy enemy = new Enemy(); // Initialize the enemy enemy.Initialize(enemyAnimation, position); // Condition to see if the level changed then make my enemies harder /* if (level != prevLevel) { levelUp = true; } */ /* if (levelUp == true) { enemy.Damage = enemy.Damage + 20; enemy.Health = enemy.Health + 20; enemy.enemyMoveSpeed = enemy.enemyMoveSpeed + 2; enemy.Value = enemy.Value + 20; //UpdatePlayer(blah); // figure out parameter shit because I need to change player class attributes before leaving if statement :) AddProjectile(position); levelUp = false; } */ // Add the enemy to the active enemies list enemies.Add(enemy); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); Animation playerAnimation = new Animation(); Texture2D playerTexture = Content.Load<Texture2D>("shipAnimation"); playerAnimation.Initialize(playerTexture, Vector2.Zero, 115, 69, 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); bgLayer1.Initialize(Content, "bgLayer1", GraphicsDevice.Viewport.Width, -1); bgLayer2.Initialize(Content, "bgLayer2", GraphicsDevice.Viewport.Width, -2); enemyTexture = Content.Load<Texture2D>("mineAnimation"); projectileTexture = Content.Load<Texture2D>("laser"); explosionTexture = Content.Load<Texture2D>("explosion"); gameplayMusic = Content.Load<Song>("sound/gameMusic"); laserSound = Content.Load<SoundEffect>("sound/laserFire"); explosionSound = Content.Load<SoundEffect>("sound/explosion"); PlayMusic(gameplayMusic); font = Content.Load<SpriteFont>("gameFont"); mainBackground = Content.Load<Texture2D>("mainbackground"); // TODO: use this.Content to load your game content here }
private void AddUpgradeSprite(Vector2 position) { Animation upgrade = new Animation(); upgrade.Initialize(upgradeTexture, position, 80, 70, 12, 45, Color.White, 1f, false); upgrades.Add(upgrade); }
private void AddExplosion(Vector2 position) { Animation explosion = new Animation(); explosion.Initialize(explosionTexture, position, 134, 134, 12, 45, Color.White, 1f, false); explosions.Add(explosion); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); Animation playerAnim = new Animation(); Texture2D playerTex = Content.Load<Texture2D>("shipAnimation"); playerAnim.Initialize(playerTex, Vector2.Zero, 115, 69, 8, 30, Color.White, 1f, true); Rectangle tsa = GraphicsDevice.Viewport.TitleSafeArea; Vector2 playerPosition = new Vector2(tsa.X, tsa.Y + tsa.Height / 2); player.Initialize(playerAnim, playerPosition); enemyTexture = Content.Load<Texture2D>("mineAnimation"); projectileTexture = Content.Load<Texture2D>("laser"); explosionTexture = Content.Load<Texture2D>("explosion"); font = Content.Load<SpriteFont>("gameFont"); Dictionary<string, int> movingBackgrounds = new Dictionary<string,int>() { {"bgLayer1", -1}, {"bgLayer2", -2} }; background.Initialize(Content, "mainbackground", movingBackgrounds, GraphicsDevice.Viewport.Width); gameplayMusic = Content.Load<Song>("sound/gameMusic"); laserSound = Content.Load<SoundEffect>("sound/laserFire"); explosionSound = Content.Load<SoundEffect>("sound/explosion"); PlayMusic(gameplayMusic); }