Partager via


Game.Update Method

Called when the game has determined that game logic needs to be processed. This might include the management of the game state, the processing of user input, or the updating of simulation data. Override this method with game-specific logic.

Syntax

'Declaration
Protected Overridable Sub Update ( _
         gameTime As GameTime _
)
protected virtual void Update (
         GameTime gameTime
)
protected:
virtual void Update(
         GameTime gameTime
)

Parameters

  • gameTime
    Type: GameTime
    Time passed since the last call to Update.

Remarks

Bb199616.bp(en-us,XNAGameStudio.42).gifBest Practice

When updating the game state, you can examine SignedInGamer.GameDefaults to determine a player's preferences for settings such as game difficulty and controller sensitivity.

Update and Draw are called at different rates depending on whether IsFixedTimeStep is true or false. If IsFixedTimeStep is false, Update and Draw will be called in a continuous loop. If IsFixedTimeStep is true, Update will be called at the interval specified in TargetElapsedTime, while Draw will only be called if an Update is not due. If Draw is not called, IsRunningSlowly will be set to true.

Requirements

Namespace: Microsoft.Xna.Framework

Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)

See Also

Concepts

Game State Management Sample at App Hub Online

Reference

SignedInGamer.GameDefaults
Game Class
Game Members
Microsoft.Xna.Framework Namespace

Platforms

Windows Phone