Exemple #1
0
        // Just for reference, dt is in units where 1 = 1 physics tick
        public virtual void Draw(double dt)
        {
            Vector2d lerploc = Misc.LerpVector2d(OldLoc, Loc, dt);
            Vector3d v       = new Vector3d(lerploc);

            Sprite.Draw(v);
        }
Exemple #2
0
 // We do the interpolation here~
 // dt is the time since the last frame, in milliseconds.
 void Follow(IGameObj o, int dt)
 {
     // If the target suddenly vanishes, we stay where we are...
     // Though it should never vanish as long as we have a reference to it...  Hmm.
     if (FollowTarget == null)
     {
         SetHold(Target);
     }
     else
     {
         double frameFraction = Math.Min(1.0, (double)dt / 50.0);
         Target = Misc.LerpVector2d(o.OldLoc, o.Loc, frameFraction);
     }
 }