Quantunet.com

My Account

Joins Us
Flash 8 Actionscript 2.0 Knowledgebase
Bounce On Floor With Gravity  

Download .fla

Actionscript

var gravity = 10;
var elasticity = 0.9;
var floor = 250;
var Vy = 0;
ball_mc._y = 40;

ball_mc.onEnterFrame = function() {

Vy = Vy + gravity;
this._y += Vy/4;

if (this._y > floor) {
this._y = floor;
Vy = -Vy*elasticity;
}
};


© 2008 Quantunet LLC All Rights Reserved | Intellectual Property | Terms of Use | Privacy
Home | About Quantunet | FAQ's | Contact Us