On Game1.cs class .... enter a float Timer
....................
using ...
public static float timer= 0 f ;
namespace STARTER
{
public class Game1 : Microsoft.Xna.Framework.Game
{
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
..................
The Update method, add the variable timer the time spent ( gameTime.ElapsedGameTime.Milliseconds) ... when the variable is greater than the waiting time limit, for example, 1000, run the event and reset the timer ...
public void Update (GameTime gametime) {
timer + = gameTime.ElapsedGameTime.Milliseconds;
if (timer> 1000)
{
code for the event!
timer = 0;
}
0 comments:
Post a Comment