00:00
00:00
loopchocolateman1234
Sup......ma namez Charlie, oh ya make sure you lock the door im going out for some drinks....

Age 36, Male

Flash Intermediate

What!?

Canada

Joined on 7/19/08

Level:
12
Exp Points:
1,362 / 1,600
Exp Rank:
47,456
Vote Power:
5.37 votes
Rank:
Civilian
Global Rank:
> 100,000
Blams:
7
Saves:
36
B/P Bonus:
0%
Whistle:
Normal
Medals:
407

Physics Ball Code!

Posted by loopchocolateman1234 - April 19th, 2011


Here it is!

onClipEvent (load) {
var acceleration = 0.005;
var termVelocity = 20;
var yVel = 0;
var xVel = 0;
var e = 0.8;
var f = 0.8;
var dragged = 0;
}
onClipEvent (enterFrame) {
if (this._y<380) {
if (dragged == 0) {
yVel += (termVelocity-yVel)*acceleration;
}
} else if (this._y>380) {
yVel *= -1*e;
xVel *= f;
this._y = 380;
}
if (this._x>530) {
xVel *= -1*e;
yVel *= f;
this._x = 530;
} else if (this._x<20) {
xVel *= -1*e;
yVel *= f;
this._x = 20;
}
if (dragged == 0) {
this._y += yVel;
this._x += xVel;
}
}
on (press) {
this.startDrag(false);
dragged = 1;
velocity = 0;
xVel = 0;
}
on (release, releaseOutside) {
this.stopDrag();
dragged = 0;
}


Comments

Comments ain't a thing here.