public override void LoadContent(ContentManager content) { List<SpriteHelper> bombAnimationFrames = new List<SpriteHelper>(); Texture2D bombTexture = content.Load<Texture2D>("blocks"); Rectangle bombRectangle1 = new Rectangle(3, 65, 64 - 3, 126 - 65); SpriteHelper bombAnimation1 = new SpriteHelper(bombTexture, bombRectangle1); Rectangle bombRectangle2 = new Rectangle(64, 65, 125 - 64, 126 - 65); SpriteHelper bombAnimation2 = new SpriteHelper(bombTexture, bombRectangle2); Rectangle bombRectangle3 = new Rectangle(125, 65, 186-125 , 126 - 65); SpriteHelper bombAnimation3 = new SpriteHelper(bombTexture, bombRectangle3); Rectangle bombRectangle4 = new Rectangle(186 , 65, 247-186, 126 - 65); SpriteHelper bombAnimation4 = new SpriteHelper(bombTexture, bombRectangle4); Rectangle bombRectangle5 = new Rectangle(247, 65, 308-247, 126 - 65); SpriteHelper bombAnimation5 = new SpriteHelper(bombTexture, bombRectangle5); bombAnimationFrames.Add(bombAnimation1); bombAnimationFrames.Add(bombAnimation2); bombAnimationFrames.Add(bombAnimation3); bombAnimationFrames.Add(bombAnimation4); bombAnimationFrames.Add(bombAnimation5); _bombAnimationFrames = bombAnimationFrames; _timeToLive = 5000; _origionalTime = _timeToLive; _power = 2; CollisionType= CollisionTypes.Bomb; _exploded = false; }
public void LoadContent() { Texture2D explosionTexture = _content.Load<Texture2D>("fire"); explosionCrossRectangle = new Rectangle(10, 10, 69 - 10, 69 - 10); _explosionCross = new SpriteHelper(explosionTexture, explosionCrossRectangle); Rectangle explosionRightRectangle = new Rectangle(71, 10, 130 - 71, 69 - 10); _explosionRight = new SpriteHelper(explosionTexture, explosionRightRectangle); Rectangle explosionRightEndRectangle = new Rectangle(132, 10 , 191 - 132, 69 - 10); _explosionRightEnd = new SpriteHelper(explosionTexture, explosionRightEndRectangle); Texture2D explosionTextureLeft = SpriteHelper.Flip(explosionTexture, false, true); Rectangle explosionLeftRectangle = new Rectangle(explosionTextureLeft.Width - 130, 10, 130-71 , 69 - 10); _explosionLeft = new SpriteHelper(explosionTextureLeft, explosionLeftRectangle); Rectangle explosionLeftEndRectangle = new Rectangle(explosionTextureLeft.Width - 191, 10, 191 - 132, 69 - 10); _explosionLeftEnd = new SpriteHelper(explosionTextureLeft, explosionLeftEndRectangle); Texture2D explosionTextureDown = SpriteHelper.RotateTexture90Degrees(explosionTexture); Rectangle explosionDownRectangle = new Rectangle(10, 71, 69 - 10, 130 - 71); _explosionDown = new SpriteHelper(explosionTextureDown, explosionDownRectangle); Rectangle explosionDownEndRectangle = new Rectangle(10, 132, 69 - 10, 191 - 132); _explosionDownEnd = new SpriteHelper(explosionTextureDown, explosionDownEndRectangle); Texture2D explosionTextureUp = SpriteHelper.Flip(explosionTextureDown, true, false); Rectangle explosionUpRectangle = new Rectangle(10, explosionTextureUp.Height - 130, 69 - 10, 130- 71); _explosionUp = new SpriteHelper(explosionTextureUp, explosionUpRectangle); Rectangle explosionUpEndRectangle = new Rectangle(10, explosionTextureUp.Height - 191, 69 - 10, 191 - 132); _explosionUpEnd = new SpriteHelper(explosionTextureUp, explosionUpEndRectangle); }
public override void LoadContent(ContentManager content) { _brickTextures = content.Load<Texture2D>("blocks"); _brickRectangle = new Rectangle(64, 4, 125 - 64, 65 - 4); _brick = new SpriteHelper(_brickTextures, _brickRectangle); //explosions take 1500 ms to disappear, 1500/4 frames = 375 ms. List<SpriteHelper> destroyAnimationFrames = new List<SpriteHelper>(); destroyAnimationFrames.Add(_brick); Rectangle destroy1Rectangle = new Rectangle(125, 4, 186 - 125, 65 - 4); SpriteHelper destroy1 = new SpriteHelper(_brickTextures, destroy1Rectangle); destroyAnimationFrames.Add(destroy1); Rectangle destroy2Rectangle = new Rectangle(186, 4, 247 - 186, 65 - 4); SpriteHelper destroy2 = new SpriteHelper(_brickTextures, destroy2Rectangle); destroyAnimationFrames.Add(destroy2); Rectangle destroy3Rectangle = new Rectangle(247, 4, 308 - 247, 65 - 4); SpriteHelper destroy3 = new SpriteHelper(_brickTextures, destroy3Rectangle); destroyAnimationFrames.Add(destroy3); _brickDestroyAnimation = new Animation(375, destroyAnimationFrames, true); CollisionType = CollisionTypes.BlockBreakable; _destroying = false; _destroyTime = 1500; }
public void LoadContent() { _backgroundTexture = _content.Load<Texture2D>("layout_level_empty"); _background = new SpriteHelper(_backgroundTexture, _backgroundRectangle); _backgroundFacifyBar = new SpriteHelper(_backgroundTexture, _backgroundFancifyBarRectangle); BombermanSound.LoadSounds(_content); BombermanSound.PlayTheme(); foreach (var bomberManGuy in _players) { bomberManGuy.LoadContent(_content, _graphics); } _gameField.LoadAllFieldContent(_content, _graphics); }
public void LoadContent(ContentManager content, GraphicsDeviceManager graphics) { _hitBoxTexture = new Texture2D(graphics.GraphicsDevice, 1, 1); _hitBoxTexture.SetData(new Color[] { Color.Red }); _hitBox = new SpriteHelper(_hitBoxTexture, new Rectangle(0, 0, 1, 1)); _playerDrawColor =GetPlayerDrawColor(_playerColor); Texture2D originalTexture = content.Load<Texture2D>("character1_sprites"); _playerTexture = originalTexture; _player = new SpriteHelper(_playerTexture, _playerRectangle); #region AnnimationInit Rectangle idleFrame1Rectangle = new Rectangle(6, 7, 63 - 6, 84 - 7); Rectangle idleFrame2Rectangle = new Rectangle(63, 7, 120 - 63, 84 - 7); List<SpriteHelper> idleAnimationFrames = new List<SpriteHelper>(); idleAnimationFrames.Add(new SpriteHelper(_playerTexture, idleFrame1Rectangle)); idleAnimationFrames.Add(new SpriteHelper(_playerTexture, idleFrame2Rectangle)); _idleAnimation = new Animation(300, idleAnimationFrames); Rectangle leftFrame1Rectangle = new Rectangle(6, 84, 67 - 6, 165 - 84); Rectangle leftFrame2Rectangle = new Rectangle(68, 84, 129 - 68, 165 - 84); Rectangle leftFrame3Rectangle = new Rectangle(129, 84, 189 - 129, 165 - 84); List<SpriteHelper> leftAnimationFrames = new List<SpriteHelper>(); leftAnimationFrames.Add(new SpriteHelper(_playerTexture, leftFrame1Rectangle)); leftAnimationFrames.Add(new SpriteHelper(_playerTexture, leftFrame2Rectangle)); leftAnimationFrames.Add(new SpriteHelper(_playerTexture, leftFrame3Rectangle)); _leftAnimation = new Animation(190, leftAnimationFrames); Texture2D vertFlipPlayer = SpriteHelper.Flip(_playerTexture, false, true); Rectangle rightFrame1Rectangle = new Rectangle(vertFlipPlayer.Width - 67, 84, 67 - 6, 165 - 84); Rectangle rightFrame2Rectangle = new Rectangle(vertFlipPlayer.Width - 129, 84, 129 - 68, 165 - 84); Rectangle rightFrame3Rectangle = new Rectangle(vertFlipPlayer.Width - 189, 84, 189 - 129, 165 - 84); List<SpriteHelper> rightAnimationFrames = new List<SpriteHelper>(); rightAnimationFrames.Add(new SpriteHelper(vertFlipPlayer, rightFrame1Rectangle)); rightAnimationFrames.Add(new SpriteHelper(vertFlipPlayer, rightFrame2Rectangle)); rightAnimationFrames.Add(new SpriteHelper(vertFlipPlayer, rightFrame3Rectangle)); _rightAnimation = new Animation(190, rightAnimationFrames); Rectangle downFrame1Rectangle = new Rectangle(6, 165, 65 - 6, 247 - 165); Rectangle downFrame2Rectangle = new Rectangle(65, 165, 124 - 65, 247 - 165); Rectangle downFrame3Rectangle = new Rectangle(124, 165, 183 - 124, 247 - 165); List<SpriteHelper> downAnimationFrames = new List<SpriteHelper>(); downAnimationFrames.Add(new SpriteHelper(_playerTexture, downFrame1Rectangle)); downAnimationFrames.Add(new SpriteHelper(_playerTexture, downFrame2Rectangle)); downAnimationFrames.Add(new SpriteHelper(_playerTexture, downFrame3Rectangle)); _downAnimation = new Animation(190, downAnimationFrames); Rectangle upFrame1Rectangle = new Rectangle(6, 247, 64 - 6, 328 - 247); Rectangle upFrame2Rectangle = new Rectangle(64, 247, 124 - 65, 328 - 247); Rectangle upFrame3Rectangle = new Rectangle(123, 247, 182 - 124, 328 - 247); List<SpriteHelper> upAnimationFrames = new List<SpriteHelper>(); upAnimationFrames.Add(new SpriteHelper(_playerTexture, upFrame1Rectangle)); upAnimationFrames.Add(new SpriteHelper(_playerTexture, upFrame2Rectangle)); upAnimationFrames.Add(new SpriteHelper(_playerTexture, upFrame3Rectangle)); _upAnimation = new Animation(190, upAnimationFrames); Rectangle deadFrame1Rectangle = new Rectangle(6, 328, 79 - 6, 408 - 328); Rectangle deadFrame2Rectangle = new Rectangle(79, 328, 152 - 79, 408 - 328); Rectangle deadFrame3Rectangle = new Rectangle(152, 328, 225 - 152, 408 - 328); Rectangle deadFrame4Rectangle = new Rectangle(225, 328, 299 - 225, 408 - 328); List<SpriteHelper> deadAnimationFrames = new List<SpriteHelper>(); deadAnimationFrames.Add(new SpriteHelper(_playerTexture, deadFrame1Rectangle)); deadAnimationFrames.Add(new SpriteHelper(_playerTexture, deadFrame2Rectangle)); deadAnimationFrames.Add(new SpriteHelper(_playerTexture, deadFrame3Rectangle)); deadAnimationFrames.Add(new SpriteHelper(_playerTexture, deadFrame4Rectangle)); _deadAnimation = new Animation(190, deadAnimationFrames, true); Rectangle normalFrame1Rectangle = new Rectangle(6, 7, 63 - 6, 84 - 7); List<SpriteHelper> normalAnimationFrames = new List<SpriteHelper>(); normalAnimationFrames.Add(new SpriteHelper(_playerTexture, normalFrame1Rectangle)); _normalAnimation = new Animation(1000, normalAnimationFrames); #endregion bombProtoType = new Bomb(); bombProtoType.LoadContent(content); _amountOfAllowedBombs = 3; _placedBombs = new List<Bomb>(); _currentAnimation = _normalAnimation; }
public override void LoadContent(ContentManager content) { _brickRectangle = new Rectangle(3,4,64-3,65-4); _brickTextures = content.Load<Texture2D>("blocks"); _brick = new SpriteHelper(_brickTextures,_brickRectangle); }
public void LoadContent() { _spriteBatch = new SpriteBatch(_graphics.GraphicsDevice); Texture2D logo = _content.Load<Texture2D>("logo"); _logoHelper = new SpriteHelper(logo, _logoRect); //_audioEngine = new AudioEngine(_content.RootDirectory + "//BomberbroAudio.xgs"); //_waveBankTheme = new WaveBank(_audioEngine, _content.RootDirectory + "//Theme.xwb"); //_soundBankTheme = new SoundBank(_audioEngine, _content.RootDirectory + "//Theme.xsb"); //_waveBankSoundEffect = new WaveBank(_audioEngine, _content.RootDirectory + "//SoundEffects.xwb"); //_soundBankSoundEffect = new SoundBank(_audioEngine, _content.RootDirectory + "//SoundEffect.xsb"); //_currentSong = _soundBankTheme.GetCue("Theme"); //_explosion2 = _soundBankSoundEffect.GetCue("Explosion 2"); //_cancel1 = _soundBankSoundEffect.GetCue("Cancel 1"); //_cancel2 = _soundBankSoundEffect.GetCue("Cancel 2"); //_collision1 = _soundBankSoundEffect.GetCue("Collision 1"); //_collision2 = _soundBankSoundEffect.GetCue("Collision 2"); //_completeDead = _soundBankSoundEffect.GetCue("Complete-Dead"); //_explosion1 = _soundBankSoundEffect.GetCue("Explosion 1"); //_hit = _soundBankSoundEffect.GetCue("Hit"); //_marioCoin = _soundBankSoundEffect.GetCue("Mario Coin"); //_randomMelody1 = _soundBankSoundEffect.GetCue("Random Melody 1"); //_randomMelody2 = _soundBankSoundEffect.GetCue("Random Melody 2"); //_sfx1 = _soundBankSoundEffect.GetCue("SFX1"); //_thumbMove1 = _soundBankSoundEffect.GetCue("ThumbMove 1"); //_random = _soundBankSoundEffect.GetCue("Random"); //_currentSong.Play(); //_musicVolume = 1.0f; //_musicPitch = 50.0f; BombermanSound.LoadSounds(_content); BombermanSound.PlayTheme(); _font = _content.Load<SpriteFont>("TestFont"); }