double addLimitedDelta(double prevVal,double currentVal,double delta){
  if (delta == 0)   return currentVal;
  double oldDelta=currentVal - prevVal;
  if (oldDelta != 0 && Math.signum(oldDelta) != Math.signum(delta))   return currentVal;
  if (delta > 0) {
    return prevVal + Math.max(delta,oldDelta);
  }
 else {
    return prevVal + Math.min(delta,oldDelta);
  }
}

double addLimitedDelta ( double prevVal , double currentVal , double delta ) { if ( delta == 0 ) return currentVal ; double oldDelta = currentVal - prevVal ; if ( oldDelta != 0 && Math . signum ( oldDelta ) != Math . signum ( delta ) ) return currentVal ; if ( delta > 0 ) { return prevVal + Math . max ( delta , oldDelta ) ; } else { return prevVal + Math . min ( delta , oldDelta ) ; } }
if the player is standing on two platforms moving in the same direction , then the natural behavior is for the player to move twice as fast .
