flash on 2009-8-17
♥0 |
Line 35 |
Modified 2009-08-17 11:20:46 |
MIT License
archived:2017-03-20 09:10:23
ActionScript3 source code
/**
* Copyright resistor ( http://wonderfl.net/user/resistor )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/5GUn
*/
# class Arrow
# {
# public var img:DisplayImage;
# public var x:int, y:int;
# public var vx:Number = 0, vy:Number = 0, ax:Number = 0, ay:Number = 0;
# public var rot:int = 0, speed:int = 0;
# private const MULTIPLY:Number = 64 / Math.PI;
#
# function Arrow(x:int, y:int) {
# this.x = x;
# this.y = y;
# }
#
# public function step(col:uint):void
# {
# ax += ( (col & 0xff) - 0x80 ) * .0005;
# ay += ( (col >> 8 & 0xff) - 0x80 ) * .0005;
# vx += ax;
# vy += ay;
# x += vx;
# y += vy;
#
# rot = (128 + Math.atan2( vy, vx )* MULTIPLY) & 127;
# speed = Math.min(ALPHA_STEPS-1, (vx*vx + vy*vy));
# img = rotArr[rot + ROT_STEPS * speed];
#
# ax *= .96;
# ay *= .96;
# vx *= .92;
# vy *= .92;
#
# ( x > stageWidth ) ? x = 0 : ( x < 0 ) ? x = stageWidth : 0;
# ( y > stageHeight ) ? y = 0 : ( y < 0 ) ? y = stageHeight : 0;
# }
# }