Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Update
- public void Update(GameTime gameTime)
- {
- //Update timer.
- timer += (int)gameTime.ElapsedGameTime.TotalMilliseconds;
- if (timer >= lifeTime)
- {
- _remove = true;
- }
- //Update properties.
- speedUpdater.Update(gameTime); //Speed.
- directionUpdater.Update(gameTime); //Direction.
- rotationUpdater.Update(gameTime); //Rotation.
- sizeUpdater.Update(gameTime); //Size.
- float currentSpeed = speedUpdater.GetValue(); //Calculate and save the speed.
- float currentDirection = directionUpdater.GetValue(); //Calculate and save the direction.
- //Update position.
- position.X += currentSpeed * (float)Math.Cos(currentDirection / 180 * Math.PI) * (float)gameTime.ElapsedGameTime.TotalSeconds;
- position.Y += currentSpeed * (float)Math.Sin(currentDirection / 180 * Math.PI) * (float)gameTime.ElapsedGameTime.TotalSeconds;
- }
Advertisement
Add Comment
Please, Sign In to add comment