X hits on this document

369 views

0 shares

0 downloads

0 comments

62 / 102

       case CatapultState.Idle:

           DrawIdleCatapult();

           break;

       case CatapultState.Aiming:

           // TODO: Handle aiming animation

           break;

       case CatapultState.Firing:

           // TODO: Handle firing animation

           break;

case CatapultState.Firing | CatapultState.ProjectileFlying:

       case CatapultState.ProjectileFlying:

           // TODO: Handle firing animation

           projectile.Draw(gameTime);

           break;

       case CatapultState.ProjectileHit:

           // Draw the catapult

           DrawIdleCatapult();

           // TODO: Handle projectile hit animation

           break;

       case CatapultState.Hit:

           // TODO: Handle catapult destruction animation

           // TODO: Handle explosion animation

           break;

       case CatapultState.Reset:

           DrawIdleCatapult();

           break;

       default:

           break;

   }

   base.Draw(gameTime);

}

134.

Add the “Fire” method, which instructs the Catapult class to fire a projectile. This method will only be used by the Human player:

C#

public void Fire(float velocity)

{

   projectile.Fire(velocity, velocity);

}

This concludes our current iteration for the Catapult class. We will now move yet again to the various player classes and expand them further.

135.

Open the Player.cs file and add the following two properties to the Player class:

C#

public Player Enemy

Page | 62

Document info
Document views369
Page views369
Page last viewedSat Jan 21 11:43:58 UTC 2017
Pages102
Paragraphs3115
Words17333

Comments