Esempio n. 1
0
 /// <summary>
 /// Updates the bounds of the entity based on movement velocity, then sets the draw location to the new bounds.
 /// </summary>
 public void Move()
 {
     if (KnockbackVelocity.Length() == GameData.Instance.PhysicsConstants.ZeroLength)
     {
         boundsLocation += MovementVelocity;
         bounds          = new Rectangle(boundsLocation.ToPoint(), bounds.Size);
     }
     SetLocation();
 }
Esempio n. 2
0
 private void UpdateKnockback()
 {
     if (KnockbackVelocity.Length() > GameData.Instance.PhysicsConstants.ZeroVelocity)
     {
         Friction  = new Vector2(KnockbackVelocity.X, KnockbackVelocity.Y) / (GameData.Instance.PhysicsConstants.KnockbackMultiplier * KnockbackVelocity.Length());
         Friction *= GameData.Instance.PhysicsConstants.MassMultiplier * (Mass / DefaultMass);
         if (KnockbackVelocity.Length() > Friction.Length())
         {
             KnockbackVelocity += Friction;
         }
         else
         {
             KnockbackVelocity = Vector2.Zero;
         }
     }
 }