X hits on this document

294 views

0 shares

0 downloads

0 comments

59 / 102

                   // TODO: Vibrate device and play sound

               }

               // TODO: Relate to animation when changing state

               postUpdateStateChange = CatapultState.Reset;

               // TODO: Update animation

           }

           else

           {

               // TODO: Vibrate the device

           }

           break;

       case CatapultState.Hit:

           // TODO: only check score when animation is finished                    

           if (enemy.Score >= winScore)

           {

               GameOver = true;

               break;

           }

           postUpdateStateChange = CatapultState.Reset;                    

           // TODO: Update animation

           break;

       case CatapultState.Reset:

           AnimationRunning = false;

           break;

       default:

           break;

   }

   lastUpdateState = currentState;

   if (postUpdateStateChange != 0)

   {

       currentState = postUpdateStateChange;

   }

   base.Update(gameTime);

}

As you can see, the method mainly updates the catapult’s own state and the state of its fired projectile. Notice the many placeholders, which we will later use to animate the catapult according to its state, to play sounds and to cause the device to vibrate.

Page | 59

Document info
Document views294
Page views294
Page last viewedSat Dec 10 23:23:48 UTC 2016
Pages102
Paragraphs3115
Words17333

Comments