Fake Gravity Algo

Hi,

This is the fake Gravity algo. I have copied this from book “Flash MX 2004 Game Design”.

//————– Copy from here ——————-

// Object require on Stage

// ball:MovieClip – Idally with a circle or whatever you want.

var ymov:Number = 0;
//
var gravity:Number = 2;
ball.onEnterFrame = function() { 
 ymov += gravity;
 ball._y += ymov;
 if (ball._y>(Stage.height – ball._height)) {
  ball._y = Stage.height – ball._height;
  ymov *= -1;
 }
};

//————– Stop Copying ——————-