public override void Update(GameTime gameTime) { float diff = 30 - (float)gameTime.TotalGameTime.Subtract(ReleaseTime).TotalSeconds * 60; if (diff <= 0) { diff = .01f; } Velocity.X = (TargetPlayer.Character.Hitbox.Center.X - Position.X) / diff; Velocity.Y = (TargetPlayer.Character.Hitbox.Center.Y - Position.Y) / diff; VelocityZ = (TargetPlayer.Character.PositionZ - PositionZ) / diff; Position += Velocity; PositionZ += VelocityZ; if (Knocked == true) { SourcePosition = Position; Position.X = SourcePosition.X + Velocity.X * (float)gameTime.TotalGameTime.Subtract(ReleaseTime).TotalSeconds * 60; Position.Y = SourcePosition.Y + Velocity.Y * (float)ReleaseTime.Subtract(gameTime.TotalGameTime).TotalSeconds * 60 + .5F * (float)Math.Pow(ReleaseTime.Subtract(gameTime.TotalGameTime).TotalSeconds * 60, 2) / 2F; if (gameTime.TotalGameTime.Subtract(ReleaseTime).TotalSeconds * 60 >= 60) { Knocked = false; } } Hitbox.Width = Sprite.Width; Hitbox.Height = Sprite.Height; Hitbox.X = (int)Position.X; Hitbox.Y = (int)Position.Y + (int)PositionZ; rotation += (float)gameTime.ElapsedGameTime.TotalSeconds * 15; float circle = MathHelper.Pi * 2; rotation = rotation % circle; }
public override void Update(GameTime gameTime) { if (gameTime.TotalGameTime.Subtract(ReleaseTime).TotalSeconds * 60 >= 60) { MarkForDelete = true; } Position.X = SourcePosition.X + Velocity.X * (float)gameTime.TotalGameTime.Subtract(ReleaseTime).TotalSeconds * 60; Position.Y = SourcePosition.Y + Velocity.Y * (float)ReleaseTime.Subtract(gameTime.TotalGameTime).TotalSeconds * 60 + .5F * (float)Math.Pow(ReleaseTime.Subtract(gameTime.TotalGameTime).TotalSeconds * 60, 2) / 2F; Hitbox.Width = Sprite.Width; Hitbox.Height = Sprite.Height; Hitbox.X = (int)Position.X - 25; Hitbox.Y = (int)Position.Y - 25; rotation += (float)gameTime.ElapsedGameTime.TotalSeconds * 15; float circle = MathHelper.Pi * 2; rotation = rotation % circle; }