1

I am working on a mono game using c# (Visual Studio 2015)that needs to incorporate random velocities.

I am working with: const float BaseSpeed = 0.15f;

    Vector2 upLeft = new Vector2(-BaseSpeed, -BaseSpeed);
    Vector2 upRight = new Vector2(BaseSpeed, -BaseSpeed);
    Vector2 downRight = new Vector2(BaseSpeed, BaseSpeed);
    Vector2 downLeft = new Vector2(-BaseSpeed, BaseSpeed);

I need to replace .15f with a physics based update (distance x time). I know it involves using "gameTime.ElapsedGameTime.Milliseconds" but I keep getting an error that says 'gameTime does not exist in this context.'

I might be trying to set it in the wrong location.

Can anyone explain how to do this distance*time calculation?

eldron
  • 11
  • 1
  • 1
    Where is this code? It should be in the `Update()` method. If it's in a method that you're calling from `Update()`, you'll need to pass the `gameTime` value to that other method. – itsme86 Aug 04 '16 at 15:05
  • @itsme86 *you'll need to pass* or increase it's scope – Conrad Frix Aug 04 '16 at 15:06

0 Answers0