public SpriteAnimationPlayer() { mAnimToPlay = null; mCurrFrame = 0; mSecondsOnCurrFrame = 0; mPlaying = false; }
public static void LoadData(Game myGame) { mSoulSpriteSheet = new SpriteSheet(); mSoulSpriteSheet.SetTexture(myGame.Content.Load<Texture2D>("enemySprites/Soul")); mSoulSpriteSheet.AddSprite(new Vector2(0, 0), kFrameSizeInPixels); // mSoulAnimation = new SpriteAnimation(); mSoulAnimation.AddFrame(mSoulSpriteSheet, 0, 0.2f); mSoulAnimation.AddFrame(mSoulSpriteSheet, 0, 0.2f, true); }
public static new void LoadData(Game myGame) { lightningCowSpriteSheet = new SpriteSheet(); lightningCowSpriteSheet.SetTexture(myGame.Content.Load<Texture2D>("Enemies/CowRun"));//("Enemies/LightningCow5fps")); mPainSheet = new SpriteSheet(); mPainSheet.SetTexture(myGame.Content.Load<Texture2D>("enemySprites/lightningCowHurtDeath"));//("Enemies/LightningCow5fps")); lightningCowAnimation = new SpriteAnimation(); mPainAnimation = new SpriteAnimation(); for (int i = 0; i < 4; i++) { lightningCowSpriteSheet.AddSprite(new Vector2(i * 100, 0), new Vector2(100, 100)); lightningCowAnimation.AddFrame(lightningCowSpriteSheet, i, .1f); } mPainSheet.AddSprite(new Vector2(0, 0), new Vector2(100, 100)); mPainAnimation.AddFrame(mPainSheet, 0, 2f); mHackSmoke = myGame.Content.Load<Texture2D>("Particles/SmokeParticleEffectSprite"); mMooSnd = myGame.Content.Load<SoundEffect>("Audio/moo"); mThunderSnd = myGame.Content.Load<SoundEffect>("Audio/thunder"); //mTexture = myGame.Content.Load<Texture2D>("enemySprites/evilCow"); }
public static void LoadData(Game myGame) { // load all static data here mBlinkingSpriteSheet = new SpriteSheet(); mBlinkingSpriteSheet.SetTexture(myGame.Content.Load<Texture2D>("CharSprite/boyStandingStill")); for (int i = 0; i < 2; ++i) { mBlinkingSpriteSheet.AddSprite(new Vector2(i * 30, 0), new Vector2(30, 50)); } // mBlinkingAnimation = new SpriteAnimation(); mBlinkingAnimation.AddFrame(mBlinkingSpriteSheet, 1, 1.0f); mBlinkingAnimation.AddFrame(mBlinkingSpriteSheet, 0, 0.1f); mRunningSouthSpriteSheet = new SpriteSheet(); mRunningSouthSpriteSheet.SetTexture(myGame.Content.Load<Texture2D>("CharSprite/boyRunningFoward5fps")); mRunningNorthSpriteSheet = new SpriteSheet(); mRunningNorthSpriteSheet.SetTexture(myGame.Content.Load<Texture2D>("CharSprite/boyRunningBackward5fps")); mRunningSidewaysSpriteSheet = new SpriteSheet(); mRunningSidewaysSpriteSheet.SetTexture(myGame.Content.Load<Texture2D>("CharSprite/boyRunningSideways5fps")); mRunningSouthAnimation = new SpriteAnimation(); mRunningEastAnimation = new SpriteAnimation(); mRunningWestAnimation = new SpriteAnimation(); mRunningNorthAnimation = new SpriteAnimation(); for (int i = 0; i < 4; ++i) { mRunningSouthSpriteSheet.AddSprite( new Vector2(i * kFrameSizeInPixels.X, 0), kFrameSizeInPixels); mRunningSidewaysSpriteSheet.AddSprite(new Vector2(i * kFrameSizeInPixels.X, 0), kFrameSizeInPixels); mRunningNorthSpriteSheet.AddSprite( new Vector2(i * kFrameSizeInPixels.X, 0), kFrameSizeInPixels); mRunningSouthAnimation.AddFrame(mRunningSouthSpriteSheet, i, 0.1f); mRunningEastAnimation.AddFrame(mRunningSidewaysSpriteSheet, i, 0.1f, true); // flip this one mRunningWestAnimation.AddFrame(mRunningSidewaysSpriteSheet, i, 0.1f); mRunningNorthAnimation.AddFrame(mRunningNorthSpriteSheet, i, 0.1f); } mHackSmoke = myGame.Content.Load<Texture2D>("Particles/SmokeParticleEffectSprite"); mOuch = myGame.Content.Load<Texture2D>("Particles/ouch"); mSwingBatSnd = myGame.Content.Load<SoundEffect>("Audio/batSwing"); mPlayerDamageSnd = myGame.Content.Load<SoundEffect>("Audio/playerDamage"); mCollectSoulSnd = myGame.Content.Load<SoundEffect>("Audio/collectSoul"); }
protected void HandleStun(GameTime gameTime, SpriteAnimationPlayer player, SpriteAnimation normal, SpriteAnimation pain) { if (mStunTimeout > 0) { mStunTimeout -= (float)gameTime.ElapsedGameTime.TotalSeconds; if (player.GetAnimationToPlay() != pain) { player.SetAnimationToPlay(pain); } } else { if (player.GetAnimationToPlay() != normal) { player.SetAnimationToPlay(normal); } } }
public void SetAnimationToPlay(SpriteAnimation animation) { mAnimToPlay = animation; Stop(); }