protected override void UpdateWorld() { if (GamePad.ButtonBackClicked()) { Exit(); } #region add a new road segment if (GamePad.ButtonAClicked()) { mRoad.FinalizeRoadSegment(mDir, mLength); } #endregion #region Update vectorDir and size by thumbSticks mDir += GamePad.ThumbSticks.Right; mLength += GamePad.ThumbSticks.Left.Y; mTicksToTravel += GamePad.ThumbSticks.Left.X; mRoad.UpdateRoadSegment(mDir, mLength); mBall.TopOfAutoDrawSet(); #endregion #region tell the Ball to update itself mTicksHasPassed++; if (mBall.Update(mTicksToTravel)) { mTicksHasPassed = 0; } #endregion #region restart ... if (GamePad.ButtonBClicked()) { mRoad.ResetRoad(); mBall.ResetBallPosition(); } #endregion EchoToTopStatus("Number of updates to travel each segment:" + mTicksToTravel + " NumHasPassed(" + mTicksHasPassed + ")"); EchoToBottomStatus("Vector Direction" + mDir + " Size: " + mLength); }
protected override void UpdateWorld() { if (GamePad.ButtonBackClicked()) { Exit(); } #region add a new road segment if (GamePad.ButtonAClicked()) { mRoad.FinalizeRoadSegment(mDir, mLength); } #endregion #region Update vectorDir and size by thumbSticks mDir += GamePad.ThumbSticks.Right; mLength += GamePad.ThumbSticks.Left.Y; mRoad.UpdateRoadSegment(mDir, mLength); mCar.TopOfAutoDrawSet(); #endregion #region tell the car to update itself mTurnRate += 0.02f * GamePad.ThumbSticks.Left.X; mTurnRate = MathHelper.Clamp(mTurnRate, 0f, 1f); mCar.Update(mTurnRate); #endregion #region restart ... if (GamePad.ButtonBClicked()) { mRoad.ResetRoad(); mCar.ResetCarPosition(); } #endregion EchoToTopStatus("Turn rate: " + mTurnRate); }