protected bool Move(Movement movement, GameTime gameTime) { // If movement has not been processed yet. if (movement.isNew) { target = movement.mouse; } // Divide the number of pixels moved per second by 1000 to get the distance in millisecs, then // multiply this value by the number of millisecs since last update. pixelsMovedThisUpdate = (float)((pixelsMovedPerSec / 1000) * gameTime.ElapsedGameTime.TotalMilliseconds); // Similar technique for max force allowed this update. maxForceThisUpdate = (float)((maxForcePerSec / 1000) * gameTime.ElapsedGameTime.TotalMilliseconds); // Using the steering manager to apply behaviors. steering.Seek(target, 100); // Use the manager to update the position vector. steering.Update(); SetAnimation(); return true; }
public void Update(GameTime gameTime, Movement movement) { Move(movement, gameTime); graphics.Update(gameTime, position, pixelsMovedThisUpdate / velocity.Length()); }