flash on 2010-11-10
♥0 |
Line 28 |
Modified 2010-11-11 10:39:36 |
MIT License
archived:2017-03-20 02:40:04
ActionScript3 source code
/**
* Copyright geko ( http://wonderfl.net/user/geko )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/i9RG
*/
package {
import flash.display.Sprite;
public class Ball extends Sprite {
private var ax:Number = 0;
private var ay:Number = 0;
public function Ball(color:uint = 0x000000, alpha:Number = 1, radius:Number = 20) {
graphics.beginFill(color, alpha);
graphics.drawCircle(0, 0, radius);
graphics.endFill();
}
public function move(_x:Number = 0, _y:Number = 0):void{
x = _x;
y = _y;
}
public function translate(_x:Number = 0, _y:Number = 0):void{
x += _x;
y += _y;
}
public function spring(_x:Number = 0, _y:Number = 0):void{
ax += _x;
ay += _y;
ax *= 0.9;
ay *= 0.9;
x += ax;
y += ay;
}
}
}