// assume we have globalVelocity and someParticle float slowingFactor = 1; // change to make the fluid more viscous if(sprite.xVelocity > globalXVelocity) { // slow it down // since it's probably in flash, the time step is static, so this // gets called every frame, and every frame occurs at a set frequency sprite.xVelocity -= slowingFactor; // make sure we didn't slow it down too much if(sprite.xVelocity < globalXVelocity) sprite.xVelocity = globalXVelocity; } else if(sprite.xVelocity < globalXVelocity) { // moving too slow, so speed it up sprite.xVelocity += slowingFactor; // and make sure it's not too fast if(sprite.xVelocity > globalXVelocity) sprite.xVelocity = globalXVelocity; }