Tuesday, May 22, 2007

Project 7: Bouncy Ball



The code for the gravity came from an excellent tutorial on flash physics. Google 'flash gravity effect' and it's the first to show. The code for the shadow is my doing >_<

The Code (attached to the shadow movie clip):

onClipEvent(load) {
var mcheight:Number = this._height;
var mcwidth:Number = this._width;
}
onClipEvent(enterFrame) {
_root.shadow2._x = _root.ball._x;
var difference:Number = this._y - _root.ball._y;
this._height = (difference/20) + 15;
this._width = (difference/20) + 55;
this._alpha = (100 - (difference/2)) + 90;
}

No comments: