In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

flash on 2012-3-29

Get Adobe Flash player
by hacker_cobulht0 29 Mar 2012
    Embed
/**
 * Copyright hacker_cobulht0 ( http://wonderfl.net/user/hacker_cobulht0 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/mH73Z
 */

//3つのむらさきマーカーを動かしてひよこをむらさきポイントに追い詰めて動けなくさせたら勝ち
//ひよこがきいろポイントにたどり着いてしまったら負け
//ひよこは縦横斜めに動けるけど むらさきマーカーは縦横のみ というのをうーん…
package {     
    import flash.display.Sprite;
    import flash.events.*;
    import flash.text.*;
    // Tweener
    import caurina.transitions.Tweener;
    
    [SWF(width = "465", height = "465", backgroundColor = 0xffffff, frameRate = "60")]
    
    public class Oikomi extends Sprite{
        
        private var btList:Array=new Array();
        
        private var mChick:mainChick=new mainChick();
        private var marker1:marker= new marker();
        private var marker2:marker= new marker();
        private var marker3:marker= new marker();
        
        private var prevPush:Array=new Array();
        
        private var winText:TextField = new TextField();
        private var _chickNet:chickNet;
        
        public function Oikomi(){
            if (stage) init();else addEventListener(Event.ADDED_TO_STAGE,init );
        }
        public function init(ev:Event = null){
            removeEventListener( Event.ADDED_TO_STAGE, init ) ;    
            
            addChild(marker1);
            addChild(marker2);
            addChild(marker3);
            
            for (var q:int=0; q < 11; q++) {
                var bt:button=new button();
                bt.my_pt=q;
                addChild(bt);
                btList.push(bt);
                
                if(q<9){
                    bt.x = 135+(q%3)*100;
                    bt.y = 120+Math.floor(q /3)*100;
                }else if(q==9){
                    bt.x = 135+3*100;
                    bt.y = 120+1*100;
                }else if(q==10){
                    bt.x = 135+(-1*100);
                    bt.y = 120+1*100;
                }
                
                bt.addEventListener(MouseEvent.MOUSE_UP, btPush);
            }
            
            var bg:back_ground=new back_ground(btList);
            addChildAt(bg,0);
            
            _chickNet=new chickNet(btList);
            addChild(_chickNet);
            _chickNet.visible=false;
            
                        
            mChick.x=btList[4].x;
            mChick.y=btList[4].y;            
            btList[4].status="chick";
            addChild(mChick);
            
            marker1.x=btList[0].x;
            marker1.y=btList[0].y;
            btList[0].status="marker";            
            
            marker2.x=btList[10].x;
            marker2.y=btList[10].y;
            btList[10].status="marker";
            
            marker3.x=btList[6].x;
            marker3.y=btList[6].y;
            btList[6].status="marker";
            
            
            //テキストフォーマット作成                
            var fmt:TextFormat = new TextFormat();
            fmt.size  = 25;
            fmt.align = TextFormatAlign.CENTER;
            fmt.color = 0xFB5E79;
            fmt.font="Impact"        
            //テキストフィールド作成
            winText.width=200;
            winText.height=50;
            winText.x=130;
            winText.y=40;
            winText.defaultTextFormat = fmt;
            winText.selectable = false;
            winText.text = "your turn";

            addChild(winText);
            
            addEventListener(Event.ENTER_FRAME, _ef);
        }
        private function _ef(ev){
            for (var q:int=0; q < 11; q++) {
                var bt=btList[q];
                if(bt.status=="Possible"||bt.status=="marker"){bt.visible=true;}else{bt.visible=false;};
            }
        }
        
        
        
        
        //ボタンについて//----------------------------------------------------------------------------------------------------
        //ボタン押したら
        private function btPush(ev){
            var now_bt=ev.target;
            var hList:Array=func_hList();
                if(prevPush.length==0){
                    switch (now_bt.my_pt) {
                    case 0 :
                        func_btPush1([1,3,10],hList);
                      break;
                    case 1 :
                        func_btPush1([0,2,4],hList);
                      break;
                    case 2 :
                        func_btPush1([1,5,9],hList);
                      break;
                    case 3 :
                        func_btPush1([0,10,4,6],hList);
                      break;
                    case 4 :
                        func_btPush1([1,3,5,7],hList);
                      break;
                    case 5 :
                        func_btPush1([2,4,9,8],hList);
                      break;
                    case 6 :
                        func_btPush1([3,7,10],hList);
                      break;
                    case 7 :
                        func_btPush1([4,6,8],hList);
                      break;
                    case 8 :
                        func_btPush1([5,7,9],hList);
                      break;
                    case 9 :
                        func_btPush1([2,5,8],hList);
                      break;
                    case 10 :
                        func_btPush1([0,3,6],hList);
                      break;
                    default :                
                     break;
                    }
                    prevPush=func_pushMarker(now_bt.my_pt);
                }else{
                    if(btList[now_bt.my_pt].status=="marker"){
                        func_backNone();                        
                    }else{
                        Tweener.addTween(prevPush[0], {x:now_bt.x, y:now_bt.y, time:0.5,transition:"easeOutQuad",onCompleteParams:[prevPush[1],now_bt.my_pt],onComplete:func_readyturnChick});
                        func_backNone();
                    }
                    prevPush=[];
                }
        }
        //【サーチ】
        //ひよこ&マーカーをひとまとめにリスト かえす
        private function func_hList():Array{
            var arr:Array=new Array();
            for (var q:int=0; q < 11; q++) {
                var bt=btList[q];
                if(bt.status=="chick"||bt.status=="marker"){arr.push(bt.my_pt);};
            }return arr;
        }
        //現在選択中のマーカーをリスト かえす
        private function func_pushMarker(arg1:uint):Array{
            var arr:Array=new Array();
            var tar=btList[arg1];
            for (var q:int=0; q < 3; q++) {
                var mk=this["marker"+(q+1)];
                if(tar.x==mk.x&&tar.y==mk.y){arr.push(mk,tar.my_pt);}
            }return arr;
        }
        
        //【ステータス変更】
        //次へ移動可能なボタンを表示させる
        private function func_btPush1(arg1:Array,arg2:Array){
            for (var q:uint=0; q < arg1.length; q++) {
                var num:uint=arg1[q];
                
                if(num!=arg2[0]&&num!=arg2[1]&&num!=arg2[2]&&btList[num].status!="marker"){
                    btList[num].status="Possible";
                }
            }
        }
        //Possibleとされたものをすべてnoneへ
        private function func_backNone(){
            for (var q:uint=0; q < 11; q++) {
                var tar=btList[q];
                if(tar.status=="Possible"){
                    tar.status="none";
                }
            }
        }
        //ボタン移動後markerとnoneの情報を入れ替える
        private function func_readyturnChick(arg1,arg2){
            btList[arg1].status="none";
            btList[arg2].status="marker";
            if(ck_winYou()){winYou();}else{
                winText.text = "chick turn";
                _chickNet.visible=true;
                turnChick();}
        }
        
        
        
        
        
        //----------------------------------------------------------------------------------------------------
        //ひよこのターン//----------------------------------------------------------------------------------------------------
        private function turnChick(){
            var hList:Array=func_hList();//-ボタンについて-併用
            var now_chick=func_searchChick();
            
            switch (now_chick) {
                case 0 :
                    func_moveChick2(func_moveChick1([1,3,4,10],hList),now_chick);//1,3,10
                  break;
                case 1 :
                    func_moveChick2(func_moveChick1([0,2,3,4,5],hList),now_chick);//0,2,4
                  break;
                case 2 :
                    func_moveChick2(func_moveChick1([1,4,5,9],hList),now_chick);//1,5,9
                  break;
                case 3 :
                    func_moveChick2(func_moveChick1([0,1,10,4,6],hList),now_chick);//0,10,4,6
                  break;
                case 4 :
                    func_moveChick2(func_moveChick1([0,1,2,3,5,6,7,8],hList),now_chick);//1,3,5,7
                  break;
                case 5 :
                    func_moveChick2(func_moveChick1([1,2,4,7,8,9],hList),now_chick);//2,4,9,8
                  break;
                case 6 :
                    func_moveChick2(func_moveChick1([3,4,7,10],hList),now_chick);//3,7,10
                  break;
                case 7 :
                    func_moveChick2(func_moveChick1([3,4,5,6,8],hList),now_chick);//4,6,8
                  break;
                case 8 :
                    func_moveChick2(func_moveChick1([4,5,7,9],hList),now_chick);//5,7,9
                  break;
                case 9 :
                    func_moveChick2(func_moveChick1([2,5,8],hList),now_chick);//2,5,8
                  break;                
                default :                
                 break;
            }
        }
        
        //次へ移動
        private function func_moveChick2(arg1:Array,arg2:uint){
            var chk:Boolean=false;
            for (var q:uint=0; q < arg1.length; q++) {
                var tar:uint=arg1[q];
                if(tar==10){
                    if(arg2==0||arg2==3||arg2==6){chk=true;}            
                }
            }
            
            if(chk){
                Tweener.addTween(mChick, {x:btList[10].x, y:btList[10].y, time:0.8,transition:"easeOutQuad",onComplete:winChick});
            }else{
                var rd:uint=Math.floor (Math.random () * arg1.length) ;
                var _go:uint=arg1[rd];
                Tweener.addTween(mChick, {x:btList[_go].x, y:btList[_go].y, time:0.8,transition:"easeOutQuad",onCompleteParams:[_go,arg2],onComplete:afterChick});
            }
        }
        
        //【サーチ】
        //ひよこの位置uint かえす
        private function func_searchChick():uint{
            var num:uint;
            var kr:int=-1
            for (var q:int=0; q < 11; q++) {
                var bt=btList[q];
                if(bt.status=="chick"){kr=bt.my_pt;};
            }if(kr==-1){kr=_torikoboshi();}
            num=kr;
            return num;
        }
        //次へ移動可能な場所へのリスト かえす
        private function func_moveChick1(arg1:Array,arg2:Array):Array{
            var arr:Array=new Array();
            for (var q:uint=0; q < arg1.length; q++) {
                var num:uint=arg1[q];
                if(num!=arg2[0]&&num!=arg2[1]&&num!=arg2[2]&&num!=arg2[3]){
                    arr.push(btList[num].my_pt);
                }
            }
            return arr;
        }
        
        //【ステータス変更】
        //アヒル移動後 アヒルのステータス変更
        private function afterChick(arg1:uint,arg2:uint){
            btList[arg1].status="chick";
            btList[arg2].status="none";
            _chickNet.visible=false;
            winText.text = "your turn";
        }
        
        
        //----------------------------------------------------------------------------------------------------
        //判定等//----------------------------------------------------------------------------------------------------
        private function winChick(){
            _chickNet.visible=false;
            all_none();
            winText.text = "Chick Win";
            Tweener.addTween(mChick, {alpha:0, time:2,transition:"easeOutQuad"});
        }
        private function winYou(){
            all_none();
            winText.text = "You Win";
            mChick.pic.foot.visible=false;
            mChick.pic.x=-10;
            mChick.pic.y=-15;
        }
        private function all_none(){
            for (var q:uint=0; q < 11; q++) {                
                    btList[q].status="none";                
            }
        }
        
        
        private function ck_winYou():Boolean{
            var flg:Boolean;
            var chk:uint;
            var arr:Array=new Array();
            var str:String;
            
            for (var q:int=0; q < 11; q++) {
                var bt=btList[q];
                if(bt.status=="marker"){arr.push(bt.my_pt);}
                if(bt.status=="chick"){chk=bt.my_pt;}
            }
            arr.sort(Array.NUMERIC);
            str=String(arr);
            
            if(chk==9&&str=="2,5,8"){flg=true;}
            else{flg=false;}
            return flg;
        }
        
        
        private function _torikoboshi():uint{
            var num:uint;
            for (var q:int=0; q < 11; q++) {
                var bt=btList[q];
                if(bt.x==mChick.x&&bt.y==mChick.y){
                    num=bt.my_pt;
                    bt.status="chick";
                };
            }
            return num;
        }
    }//
}











import flash.display.*;
import flash.filters.GlowFilter;
import flash.events.*;
////BackGround//----------------------------------------------------------------------------------------------------
class back_ground extends Sprite{
    private var arr1:Array=[0xFB5E79,0xff505e,0xFF6975,0xff9ca4,0xfe9e78];//0xFFB403
public function back_ground(argList){
    var bmp:BitmapData = new BitmapData(465, 465, false, 0xffffff);
    var sh:Sprite = new Sprite();    
    
    var dot:Sprite=new Sprite();
    dot.graphics.beginFill(0xFDD9B5,0.25);
    for(var j:int=0; j < 1150; j++){
        var yp;
        if(j%2==0){yp=Math.floor(j / 48)*20+10;}else{yp=Math.floor(j / 48)*20;}    
        dot.graphics.drawCircle(j%48*10,yp,5);            
    }dot.graphics.endFill();
    sh.addChild(dot);
    //
    sh.graphics.lineStyle(5,0xE3DA37);
    sh.graphics.moveTo(argList[0].x,argList[0].y);
    sh.graphics.lineTo(argList[2].x,argList[2].y);
    sh.graphics.moveTo(argList[10].x,argList[10].y);
    sh.graphics.lineTo(argList[9].x,argList[9].y);
    sh.graphics.moveTo(argList[6].x,argList[6].y);
    sh.graphics.lineTo(argList[8].x,argList[8].y);
    sh.graphics.moveTo(argList[0].x,argList[0].y);
    sh.graphics.lineTo(argList[6].x,argList[6].y);
    sh.graphics.moveTo(argList[1].x,argList[1].y);
    sh.graphics.lineTo(argList[7].x,argList[7].y);
    sh.graphics.moveTo(argList[2].x,argList[2].y);
    sh.graphics.lineTo(argList[8].x,argList[8].y);
    sh.graphics.moveTo(argList[10].x,argList[10].y);
    sh.graphics.lineTo(argList[0].x,argList[0].y);
    sh.graphics.moveTo(argList[10].x,argList[10].y);
    sh.graphics.lineTo(argList[6].x,argList[6].y);
    sh.graphics.moveTo(argList[9].x,argList[9].y);
    sh.graphics.lineTo(argList[2].x,argList[2].y);
    sh.graphics.moveTo(argList[9].x,argList[9].y);
    sh.graphics.lineTo(argList[8].x,argList[8].y);
    sh.graphics.endFill();
    
    for (var q:int=0; q < 9; q++) {
        var rd:uint=Math.floor (Math.random () * arr1.length) ;
        sh.graphics.beginFill(arr1[rd],0.8);
        sh.graphics.drawCircle(argList[q].x,argList[q].y,10);
        sh.graphics.endFill();
    }
    sh.graphics.beginFill(0xFFB403);
    sh.graphics.drawCircle(argList[10].x,argList[10].y,10);
    sh.graphics.endFill();
    
    sh.graphics.lineStyle(5,0xFFB403);
    sh.graphics.drawCircle(argList[10].x,argList[10].y,20);
    sh.graphics.endFill();
    
    sh.graphics.lineStyle(5,0xE3DA37);
    sh.graphics.beginFill(0x7851A9,0.8);
    sh.graphics.drawCircle(argList[9].x,argList[9].y,10);
    sh.graphics.endFill();
    
    sh.graphics.lineStyle(5,0x7851A9,0.5);
    sh.graphics.drawCircle(argList[9].x,argList[9].y,20);
    sh.graphics.endFill();    
    //
    bmp.draw(sh);
    addChild(new Bitmap(bmp))
}
}




////Button&Obj//----------------------------------------------------------------------------------------------------
class button extends SimpleButton{
    public var status:String="none";
    public var my_pt:uint;
    private var upPic:Sprite=new Sprite();
    private var overPic:Sprite=new Sprite();
public function button(){
    upPic.graphics.beginFill(0xFFFFF);
    upPic.graphics.drawCircle(0,0,10);
    upPic.graphics.endFill();
    upPic.filters = [ new GlowFilter( 0xFFB403, 1, 20, 20, 2,1,false,true ) ] ;
    
    overPic.graphics.lineStyle(5,0xFF6975,0.8);
    overPic.graphics.drawCircle(0,0,16);
    overPic.graphics.endFill();    
    
    this.useHandCursor = true;
    this.upState = upPic; 
    this.overState = overPic;
    this.downState = overPic;
    this.hitTestState = upPic; 
}
}





////Marker//----------------------------------------------------------------------------------------------------
class marker extends Sprite{
public function marker(){
    this.graphics.beginFill(0x7851A9,0.5);
    this.graphics.drawCircle(0,0,15);
    this.graphics.endFill();
}
}






//----------------------------------------------------------------------------------------------------
////
////
////
////CHICK
class mainChick extends Sprite{
    public var pic:drawChick=new drawChick();
public function mainChick(){
    addChild(pic);
    pic.x=-5;
    pic.y=-5;
}
}

class drawChick extends Sprite{
    private var head:Sprite=new Sprite();
    private var body:Sprite=new Sprite();
    private var scarf:Sprite=new Sprite();
    public var foot:Sprite=new Sprite();
    
    private var arr1:Array=[0xEF324E,0xFD7C6E,0x1CA9C9,0x9D726A];
public function drawChick(){
        head.graphics.beginFill(0xFFCC33);
        head.graphics.drawCircle(0,0,10);//head
        head.graphics.endFill();
        var head_1:Sprite = new Sprite();
        head_1.graphics.beginFill(0x34929A);//eye
        head_1.graphics.drawCircle(-1,-1,2);
        head_1.graphics.endFill();
        head_1.graphics.beginFill(0xF6712E);//mouse
        head_1.graphics.drawEllipse(-15,-2,7,4);        
        head_1.graphics.endFill();
        head.addChild(head_1);
        addChild(head);
        
        body.graphics.beginFill(0xFFCC33);//body
        body.graphics.drawEllipse(2,2,30,20);
        body.graphics.endFill();
        var body_1:Sprite = new Sprite();
        body_1.graphics.beginFill(0xFFCC33);//teil
        body_1.graphics.moveTo(20,5);
        body_1.graphics.lineTo(35,-1);
        body_1.graphics.lineTo(32,13);
        body_1.graphics.endFill();
        body.addChild(body_1);
        addChild(body);    
        
        foot.graphics.lineStyle(2,0xF6721E);//foot
        foot.graphics.moveTo(18,23);
        foot.graphics.lineTo(18,25);
        foot.graphics.moveTo(18,25);
        foot.graphics.lineTo(15,30);
        foot.graphics.moveTo(18,25);
        foot.graphics.lineTo(12,28);
        foot.graphics.moveTo(18,25);
        foot.graphics.lineTo(10,25);        
        foot.graphics.endFill();
        
        addChild(foot);    
        
        var rd:uint=Math.floor (Math.random () * arr1.length) ;
        var skf_cal=arr1[rd]
        scarf.graphics.beginFill(skf_cal);
        scarf.graphics.drawEllipse(-5,8,14,3);
        scarf.graphics.endFill();    
        scarf.rotation=-40;        
        var scarf_1:Sprite = new Sprite();    
        scarf_1.graphics.beginFill(skf_cal);
        scarf_1.graphics.drawEllipse(0,0,15,5);
        scarf_1.graphics.endFill();    
        scarf_1.rotation=-60;
        scarf_1.x=5;scarf_1.y=8;        
        var scarf_2:Sprite = new Sprite();    
        scarf_2.graphics.beginFill(skf_cal);
        scarf_2.graphics.drawEllipse(0,0,15,5);
        scarf_2.graphics.endFill();    
        scarf_2.rotation=-20;
        scarf_2.x=5;scarf_2.y=8;        
        scarf.addChild(scarf_2);
        scarf.addChild(scarf_1);
        addChild(scarf);
    }
}

////chickNet//----------------------------------------------------------------------------------------------------
class chickNet extends Sprite{
public function chickNet(argList){
    var sh:Sprite = new Sprite();

    sh.graphics.lineStyle(5,0xFCE883);
    sh.graphics.moveTo(argList[0].x,argList[0].y);
    sh.graphics.lineTo(argList[2].x,argList[2].y);
    sh.graphics.moveTo(argList[10].x,argList[10].y);
    sh.graphics.lineTo(argList[9].x,argList[9].y);
    sh.graphics.moveTo(argList[6].x,argList[6].y);
    sh.graphics.lineTo(argList[8].x,argList[8].y);
    sh.graphics.moveTo(argList[0].x,argList[0].y);
    sh.graphics.lineTo(argList[6].x,argList[6].y);
    sh.graphics.moveTo(argList[1].x,argList[1].y);
    sh.graphics.lineTo(argList[7].x,argList[7].y);
    sh.graphics.moveTo(argList[2].x,argList[2].y);
    sh.graphics.lineTo(argList[8].x,argList[8].y);
    sh.graphics.moveTo(argList[10].x,argList[10].y);
    sh.graphics.lineTo(argList[0].x,argList[0].y);
    sh.graphics.moveTo(argList[10].x,argList[10].y);
    sh.graphics.lineTo(argList[6].x,argList[6].y);
    sh.graphics.moveTo(argList[9].x,argList[9].y);
    sh.graphics.lineTo(argList[2].x,argList[2].y);
    sh.graphics.moveTo(argList[9].x,argList[9].y);
    sh.graphics.lineTo(argList[8].x,argList[8].y);
    sh.graphics.endFill();
    
    sh.graphics.moveTo(argList[0].x,argList[0].y);
    sh.graphics.lineTo(argList[8].x,argList[8].y);
    sh.graphics.moveTo(argList[2].x,argList[2].y);
    sh.graphics.lineTo(argList[6].x,argList[6].y);
    
    sh.graphics.moveTo(argList[3].x,argList[3].y);
    sh.graphics.lineTo(argList[1].x,argList[1].y);
    sh.graphics.lineTo(argList[5].x,argList[5].y);
        
    sh.graphics.moveTo(argList[3].x,argList[3].y);
    sh.graphics.lineTo(argList[7].x,argList[7].y);
    sh.graphics.lineTo(argList[5].x,argList[5].y);
    sh.graphics.endFill();
    sh.filters = [ new GlowFilter( 0xFCE883, 1, 20, 20, 2,1,false,true ) ] ;
    
    addChild(sh)
}
}