X hits on this document

340 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 views340
Page views340
Page last viewedThu Jan 19 05:01:28 UTC 2017
Pages102
Paragraphs3115
Words17333

Comments