/**
* Copyright Nowloading_ ( http://wonderfl.net/user/Nowloading_ )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/mGBW
*/
package {
import flash.display.Sprite;
import flash.events.Event;
public class test extends Sprite {
/*
private var kux:Array = [70,90,140,140,110,100,130,130,95,80,70];
private var kuy:Array = [80,50,50,90,130,130,90,60,60,80,80];
private var rix1:Array = [155,165,165,155,155];
private var riy1:Array = [50,50,90,90,50]
private var rix2:Array = [195,205,205,175,165,195,195];
private var riy2:Array = [50,50,85,130,130,85,50];
private var ax:Array = [230,290,270,270,260,260,230,230];
private var ay:Array = [50,50,65,130,130,60,60,50];
*/
private var px:Array = [50,200,300,300];
private var py:Array = [50,50,150,250];
private var b:int = 3;
private var c:uint = 0xff9999
private var board:hitohude;
public function test() {
init();
}
private function init():void{
board = new hitohude();
addChild(board);
board.setv(px,py);
addEventListener(Event.ENTER_FRAME,oEF);
}
private function oEF(e:Event):void{
board.make(px,py,b,c);
if(px[0] == 999){
removeEventListener(Event.ENTER_FRAME,oEF);
}
}
}
}
import flash.display.Sprite;
class hitohude extends Sprite{
private var va:Array;
private var vb:Array;
private var t:int=0;
private var r:int=20;
private var a:Array;
private var b:Array;
public function hitohude() {
init();
}
private function init():void{
a = new Array();
b = new Array();
va = new Array();
vb = new Array();
}
public function setv(a:Array,b:Array):void{
for(var i:int; i<a.length-1; i++){
va[i] = (a[i+1] - a[i])/r;
vb[i] = (b[i+1] - b[i])/r;
}
}
public function make(a:Array,b:Array,bou:int,c:uint):Array{
if(t<= a.length-2){
graphics.lineStyle(bou,c);
graphics.moveTo(a[t],b[t]);
a[t]+=va[t];
b[t]+=vb[t];
graphics.lineTo(a[t],b[t]);
if((a[t] == a[t+1]) && ( b[t] == b[t+1])){
t+=1;
}
} else{
a[0]=999;
}
return a,b;
}
}