Frame 1
onLoad = function () {
ballNum = 0;
};
onEnterFrame = function () {
if (Key.isDown(32)) {
newBall = _root.createEmptyMovieClip("newball_" + ballNum, _root.getNextHighestDepth());
ballNum = ballNum + 1;
newBall.attachMovie("Ball", "innerBall_" + ballNum, newBall.getNextHighestDepth());
newBall._x = _xmouse;
newBall._y = _ymouse;
}
};
Instance of Symbol 7 MovieClip in Frame 1
onClipEvent (enterFrame) {
if (Key.isDown(32)) {
_alpha = 0;
}
}
Instance of Symbol 9 MovieClip "x" in Frame 1
onClipEvent (enterFrame) {
if (Key.isDown(46)) {
_alpha = 0;
for (i in _root) {
if ((_root[i]._name != "Ground") and (_root[i]._name != "x")) {
_root[i].swapDepths(_root.getNextHighestDepth());
_root[i].removeMovieClip();
}
}
}
}
Symbol 2 MovieClip [Ball] Frame 1
#initclip 2
Object.registerClass("Ball", Ball);
#endinitclip
stop();
Symbol 2 MovieClip [Ball] Frame 7
gotoAndStop (1);
Instance of Symbol 13 MovieClip "Slider" in Symbol 14 MovieClip Frame 1
onClipEvent (load) {
totalLength = _parent.Bar._height;
currentPos = (_y - _parent.Bar._y) / 10;
_root.gravityScale = currentPos;
}
on (press) {
startDrag (this, false, _x, _parent.Bar._y, _x, _parent.Bar._y + _parent.Bar._height);
}
on (release) {
stopDrag();
}
onClipEvent (enterFrame) {
currentPos = (_y - _parent.Bar._y) / 10;
_root.gravityScale = currentPos;
}
Symbol 15 MovieClip [__Packages.Ball] Frame 0
class Ball extends MovieClip
{
var scale, gravity, touchingGround, falling, bouncing, waitBounce, onEnterFrame;
function Ball () {
super();
scale = 30;
gravity = 9.81;
touchingGround = false;
falling = true;
bouncing = false;
waitBounce = true;
onEnterFrame = function () {
this.scale = _root.gravityScale;
if (this.falling and (!this.touchingGround)) {
this._y = this._y + (this.gravity / this.scale);
this.gravity = this.gravity + 9.81;
}
if (this.bouncing and (this.gravity > 0)) {
this._y = this._y - (this.gravity / this.scale);
this.gravity = this.gravity - 9.81;
}
if (this.gravity <= 0) {
this.bouncing = false;
this.falling = true;
}
if (this.hitTest(_root.Ground)) {
if (((this.gravity / this.scale) <= 3) and ((this.gravity / this.scale) > -3)) {
this.gravity = 0;
this.falling = false;
this.bouncing = false;
} else {
this.falling = false;
this.bouncing = true;
this.gravity = this.gravity * -0.75;
this.waitBounce = false;
if (Math.abs(this.gravity) > 100) {
(this.gotoAndPlay("bounce"));// not popped
} else {
(this.gotoAndPlay("bounceSmall"));// not popped
}
}
}
};
}
}