dist/melonjs.js
function computeVelocity(vel) {
         // apply fore if defined
         if (this.force.x) {
           vel.x += this.force.x * me.timer.tick;
         }

         if (this.force.y) {
           vel.y += this.force.y * me.timer.tick;
         } // apply friction


         if (this.friction.x || this.friction.y) {
           this.applyFriction(vel);
         } // apply gravity if defined


         if (this.gravity.y) {
           vel.x += this.gravity.x * this.mass * me.timer.tick;
         }

         if (this.gravity.y) {
           vel.y += this.gravity.y * this.mass * me.timer.tick; // check if falling / jumping

           this.falling = vel.y * Math.sign(this.gravity.y) > 0;
           this.jumping = this.falling ? false : this.jumping;
         } // cap velocity


         if (vel.y !== 0) {
           vel.y = me.Math.clamp(vel.y, -this.maxVel.y, this.maxVel.y);
         }

         if (vel.x !== 0) {
           vel.x = me.Math.clamp(vel.x, -this.maxVel.x, this.maxVel.x);
         }
       }
function computeVelocity(vel) {
         // apply fore if defined
         if (this.force.x) {
           vel.x += this.force.x * me.timer.tick;
         }

         if (this.force.y) {
           vel.y += this.force.y * me.timer.tick;
         } // apply friction


         if (this.friction.x || this.friction.y) {
           this.applyFriction(vel);
         } // apply gravity if defined


         if (this.gravity.y) {
           vel.x += this.gravity.x * this.mass * me.timer.tick;
         }

         if (this.gravity.y) {
           vel.y += this.gravity.y * this.mass * me.timer.tick; // check if falling / jumping

           this.falling = vel.y * Math.sign(this.gravity.y) > 0;
           this.jumping = this.falling ? false : this.jumping;
         } // cap velocity


         if (vel.y !== 0) {
           vel.y = me.Math.clamp(vel.y, -this.maxVel.y, this.maxVel.y);
         }

         if (vel.x !== 0) {
           vel.x = me.Math.clamp(vel.x, -this.maxVel.x, this.maxVel.x);
         }
       }
function computeVelocity ( vel ) { // apply fore if defined if ( this . force . x ) { vel . x += this . force . x * me . timer . tick ; } if ( this . force . y ) { vel . y += this . force . y * me . timer . tick ; } // apply friction if ( this . friction . x || this . friction . y ) { this . applyFriction ( vel ) ; } // apply gravity if defined if ( this . gravity . y ) { vel . x += this . gravity . x * this . mass * me . timer . tick ; } if ( this . gravity . y ) { vel . y += this . gravity . y * this . mass * me . timer . tick ; // check if falling / jumping this . falling = vel . y * Math . sign ( this . gravity . y ) > 0 ; this . jumping = this . falling ? false : this . jumping ; } // cap velocity if ( vel . y !== 0 ) { vel . y = me . Math . clamp ( vel . y , - this . maxVel . y , this . maxVel . y ) ; } if ( vel . x !== 0 ) { vel . x = me . Math . clamp ( vel . x , - this . maxVel . x , this . maxVel . x ) ; } }
compute the new velocity value
@ignore
compute the new velocity value