public void LoadContent(ContentManager Content) { AnimationSheet playerSheet = new AnimationSheet(); playerSheet.Load(Content, "Spritesheets\\players"); playerAnimations = new AnimatedSprite(playerSheet, "StandDown"); playerAnimations.SetTexture("player" + (playerIndex + 1)); footstepSound = Content.Load<SoundEffect>("SFX/footsteps"); bombPlaceSound = Content.Load<SoundEffect>("SFX/bombplace"); }
public override void LoadContent(ContentManager Content) { bgtex.SetTexture(Content.Load<Texture2D>("Images/Menu/bg")); winTextFont = Content.Load<SpriteFont>("Fonts/Badaboom"); AnimationSheet winSheet = new AnimationSheet(); winSheet.Load(Content, "Spritesheets\\winsprite"); playerWinAnimation = new AnimatedSprite(winSheet, "Win"); playerWinAnimation.position = new Vector2(GlobalGameData.windowWidth / 2, GlobalGameData.windowHeight / 2); playerWinAnimation.frameRate = 2; winSong = Content.Load<Song>("Music/victory"); }
public SoftBlock(TileObjectManager manager, int tilePosX, int tilePosY, Texture2D tex, AnimatedSprite destroyAnimation, int type) : base(manager, tilePosX, tilePosY) { blockTex = tex; Solid = true; isDead = false; //Hook to destroy when burnt OnFireSpread += Destroy; this.blockType = type; sourceRect = new Rectangle(0, type * GlobalGameData.tileSize, GlobalGameData.tileSize, GlobalGameData.tileSize); this.destroyAnimation = destroyAnimation; }
void Destroy() { isDead = true; manager.SpawnPowerup(tilePositionX, tilePositionY); //Draw offset to center sprite Vector2 drawOffset = new Vector2(GlobalGameData.tileSize / 2 * GlobalGameData.drawRatio, GlobalGameData.tileSize / 2 * GlobalGameData.drawRatio); Vector2 drawPos = DrawPosition + drawOffset; AnimatedSprite newAnim = new AnimatedSprite(destroyAnimation); newAnim.SetAnimation("Block" + (blockType + 1)); manager.level.floatingAnimationManager.Add(newAnim, drawPos); newAnim.OnAnimationEnd += RemoveThis; }
/// <summary> /// Add a new floating animation /// </summary> /// <param name="animation">Animation to float</param> /// <param name="pos">Position to float at</param> public void Add(AnimatedSprite animation, Vector2 pos) { animation.position = pos; floatingAnimationList.Add(animation); }
public void LoadContent(ContentManager Content) { aesthetics.LoadContent(Content); aesthetics.GenerateTiles(solidArea); tileObjectManager.LoadContent(Content); AnimationSheet playerDeathAnimationSheet = new AnimationSheet(); playerDeathAnimationSheet.Load(Content, "Spritesheets\\deathsprite"); playerDeathAnimation = new AnimatedSprite(playerDeathAnimationSheet, "Death"); playerDeathSound = Content.Load<SoundEffect>("SFX/death"); for (int i = 0; i < 4; ++i) { playerDeathSoundInstance[i] = playerDeathSound.CreateInstance(); playerDeathSoundInstance[i].Volume = GlobalGameData.SFXVolume; } for (int i = 0; i < 4; ++i) { players[i].LoadContent(Content); } fireManager.SetSolidArea(solidArea); }
/// <summary> /// Copy constructor /// </summary> /// <param name="sprite">AnimatedSprite to copy</param> public AnimatedSprite(AnimatedSprite sprite) : this() { animationSheet = sprite.animationSheet; currentAnimation = sprite.currentAnimation; currentTexture = sprite.currentTexture; scale = sprite.animationSheet.defaultScale; frameRate = sprite.animationSheet.defaultFrameRate; }
public void LoadContent(ContentManager Content) { bombTex = Content.Load<Texture2D>("Images/Game/bomb"); blockTex = Content.Load<Texture2D>("Images/Game/softblocks"); loaded = true; powerupTex = new Texture2D[3]; powerupTex[0] = Content.Load<Texture2D>("Images/Game/bombup"); powerupTex[1] = Content.Load<Texture2D>("Images/Game/fireup"); powerupTex[2] = Content.Load<Texture2D>("Images/Game/speedup"); AnimationSheet destroySoftblockAnimationSheet = new AnimationSheet(); destroySoftblockAnimationSheet.Load(Content, "Spritesheets\\softblocks"); destroySoftblockAnimation = new AnimatedSprite(destroySoftblockAnimationSheet, "Block1"); powerupSound = Content.Load<SoundEffect>("SFX/powerup"); bombExplosionSound = Content.Load<SoundEffect>("SFX/bombexplode"); powerupSoundInstance = powerupSound.CreateInstance(); bombExplosionSoundInstance = bombExplosionSound.CreateInstance(); powerupSoundInstance.Volume = GlobalGameData.SFXVolume; bombExplosionSoundInstance.Volume = GlobalGameData.SFXVolume; }