X hits on this document

227 views

0 shares

0 downloads

0 comments

70 / 102

   cloud2Position += new Vector2(16.0f, 0.0f) * elapsedTime *

       windDirection * wind.Y;

if (cloud2Position.X > ScreenManager.GraphicsDevice.Viewport.Width)

       cloud2Position.X = -cloud2Texture.Width * 2.0f;

   else if (cloud2Position.X < -cloud2Texture.Width * 2.0f)

cloud2Position.X = ScreenManager.GraphicsDevice.Viewport.Width;

}

This simply updates the positions of the clouds according to the wind, and causes them to wrap around the screen should they exit its boundaries.

149.

Override the HandleInput method. This will be used to actually handle the user’s input:

C#

public override void HandleInput(InputState input)

{

   if (input == null)

       throw new ArgumentNullException("input");

   if (gameOver)

   {

       if (input.IsPauseGame(null))

       {

           FinishCurrentGame();

       }

       foreach (GestureSample gestureSample in input.Gestures)

       {

           if (gestureSample.GestureType == GestureType.Tap)

           {

               FinishCurrentGame();

           }

       }

       return;

   }

   if (input.IsPauseGame(null))

   {

       PauseCurrentGame();

   }

   else if (isHumanTurn) // If waiting for human input

   {

       // Read all available gestures

       foreach (GestureSample gestureSample in input.Gestures)

Page | 70

Document info
Document views227
Page views227
Page last viewedSun Dec 04 10:59:00 UTC 2016
Pages102
Paragraphs3115
Words17333

Comments