X hits on this document

364 views

0 shares

0 downloads

0 comments

88 / 102

           // Catapult hit animation

animations["Destroyed"].Draw(spriteBatch, catapultPosition,

               spriteEffects);

           // Projectile smoke animation

animations["hitSmoke"].Draw(spriteBatch, catapultPosition,

               spriteEffects);

           break;

       case CatapultState.Reset:

           DrawIdleCatapult();

           break;

       default:

           break;

   }

   base.Draw(gameTime);

}

The main change is drawing the animations relevant to the current catapult state.

184.

Open the GameplayScreen.cs file and navigate to the GameplayScreen class’s Update method. Locate the “TODO” marker comments and replace the surrounding code to look like the following:

C#

...

if (player.Score > computer.Score)

{

   AudioManager.PlaySound("gameOver_Win");

}

else

{

   AudioManager.PlaySound("gameOver_Lose");

}

base.Update(gameTime, otherScreenHasFocus

...

185.

Open the CatapultGame.cs file and navigate to the CatapultGame class’s constructor. Uncomment the constructors final line so that the surrounding code will look as follows:

C#

...

   //Add two new screens

   screenManager.AddScreen(new BackgroundScreen(), null);

   screenManager.AddScreen(new MainMenuScreen(), null);

   AudioManager.Initialize(this);

Page | 88

Document info
Document views364
Page views364
Page last viewedSat Jan 21 08:47:56 UTC 2017
Pages102
Paragraphs3115
Words17333

Comments