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

runaway β

マウスで黒いのを導いて、他の奴から逃げるだけ。
緑の奴→自分に向かってくる
青い奴→自分に向かってきて、たまに自分の
灰の奴→自分に向かってきて、時々丸い球をうってくる
進行方向にワープする
サイドプレイするには右下のReLoadをクリックで。
Get Adobe Flash player
by honekingu 04 Jan 2016
    Embed
/**
 * Copyright honekingu ( http://wonderfl.net/user/honekingu )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/bPOY
 */

//敵が増えたりする予定で、敵の種類も増やすつもり。
//classを使用してる方
//メインはこちらになります
package {
    import flash.display.Sprite;
 import flash.events.Event;
 import flash.text.TextField;
    public class FlashTest extends Sprite {
         
         private var enemyZ:Array = new Array();//zonbie
         private var iZ:int;//↑の数
         private var enemyS:Array = new Array();//skeleton
         private var iS:int;//↑の数
         private var enemyE:Array = new Array();//ender
         private var iE:int;//↑の数
         private var texi:TextField;//scoreの表示用
         private var score:int;//スコアの記録用
         private var scorep:int;//スコアの加算用
         private var spawn:int;//新しい敵を出すまでの間隔
         private var spwam:int//何をスポーンさせるかの乱数
         private var speed:Number=5;//敵の動くスピード
         public function FlashTest() {
              //プレイヤーの作成
               player = new Sprite();
               player.graphics.beginFill(0x000000);
               player.graphics.drawCircle(0,0,16);
               player.graphics.endFill();
               player.x = 100
               player.y = 100
               addChild(player)
               //初期enemy
               iZ=0
               addEventListener(Event.ENTER_FRAME,player_move)
           enemyZ[iZ] = new Zonbie(player,Math.random()*2.5+1);
               enemyZ[iZ].x = Math.random()*400
               enemyZ[iZ].y = Math.random()*200+200
               enemyZ[iZ].addEventListener("hit",End)
               addChild(enemyZ[iZ]);
               iZ++
               //リザルト画面的な
               addEventListener(Event.ENTER_FRAME,_score)
               texi = new TextField();
               addChild(texi)
         }
         public function _score(event:Event):void{
             scorep=(iZ*1)+(iE*2)+(iS*2)
             score += scorep
             spawn ++
             if(spawn>150){
                 if(Math.random()*10<1){
                     spawn = 0
                     spwam = Math.random()*3
                     var porx:int = pos()
                     var pory:int = pos()
                     if(spwam<1){
                        //ゾンビのスポーン
                        addEventListener(Event.ENTER_FRAME,player_move)
                        enemyZ[iZ] = new Zonbie(player,Math.random()*2.5+1);
                        enemyZ[iZ].x = player.x+(Math.random()*200*porx)+200*porx
                        enemyZ[iZ].y = player.y+(Math.random()*200*pory)+200*pory
                        enemyZ[iZ].addEventListener("hit",End)
                        addChild(enemyZ[iZ]);
                        iZ++
                     }
                     else if(spwam<2){
                         //エンダーのスポーン
                         enemyE[iE] = new Ender(player,this,Math.random()*2.5+1);
                         enemyE[iE].x = player.x+(Math.random()*200*porx)+200*porx
                         enemyE[iE].y = player.y+(Math.random()*200*pory)+200*pory
                         enemyE[iE].addEventListener("hit",End)
                         addChild(enemyE[iE]);
                         iE++
                     }
                     else{
                         //スケルトンのスポーン
                         enemyS[iS] = new Skeleton(player,Math.random()*2.5+1,this);
                         enemyS[iS].x = player.x+(Math.random()*150*porx)+150*porx
                         enemyS[iS].y = player.y+(Math.random()*150*pory)+150*pory
                         enemyS[iS].addEventListener("hit",End)
                         addChild(enemyS[iS]);
                         iS++
                     }

                 }
             }
         }
         public function End(event:Event):void{
             removeEventListener(Event.ENTER_FRAME,player_move)
             removeEventListener(Event.ENTER_FRAME,_score)
             texi.text = "socore:"+score
         }

         public function player_move(event:Event):void{
             var radians:Number = Math.atan2((mouseY - player.y),(mouseX - player.x));
             var rot:Number = radians * 180/ Math.PI
              player.rotation = rot + 90
              player.x += Math.cos(rot * Math.PI / 180)*speed;
              player.y += Math.sin(rot * Math.PI / 180)*speed;
         }
         public function pos():int{
             var a:int
             if(Math.random()*2<1){
                 return a=1
             }
             else{
                 return a=-1
             }
         }

    }
}
import flash.utils.Proxy;
import flash.geom.Point;
import flash.display.Stage;

import flash.display.Sprite;
import flash.events.Event;
import flash.text.TextField;
class Zonbie extends Sprite {
    private var _target:Sprite;
    private var _speed:Number;
    public function Zonbie(target:Sprite,speed:Number){
         _target=target;
         _speed=speed
         this.graphics.beginFill(0x00FF00)
         this.graphics.drawCircle(0,0,16);
         this.graphics.endFill();
         addEventListener(Event.ENTER_FRAME,zombie_move)
    }
    public function zombie_move(event:Event):void{
         if(Math.sqrt((_target.x-this.x)*(_target.x-this.x)+(_target.y-this.y)*(_target.y-this.y))<=32){
              dispatchEvent(new Event("hit"))
         }
         var radians:Number = Math.atan2((_target.y - this.y),(_target.x - this.x));
         var rot:Number = radians * 180/ Math.PI
         this.x += Math.cos(rot * Math.PI / 180)*_speed
         this.y += Math.sin(rot * Math.PI / 180)*_speed
    }  
}
class Ender extends Sprite {
    private var _target:Sprite;
    private var __stage:*;
    private var _speed:Number;
    private var texi:TextField = new TextField
    public function Ender(target:Sprite , _stage:*,speed:Number){
        _target=target;
        __stage=_stage;
        _speed=speed
        this.graphics.beginFill(0x666699)
        this.graphics.drawCircle(0,0,16);
        this.graphics.endFill();
        addEventListener(Event.ENTER_FRAME,Ender_move)
        addChild(texi)
    }
    public function Ender_move(event:Event):void{
        if(Math.sqrt((_target.x-this.x)*(_target.x-this.x)+(_target.y-this.y)*(_target.y-this.y))<=32){
            dispatchEvent(new Event("hit"))
        }
        var radians:Number = Math.atan2((_target.y - this.y),(_target.x - this.x));
        var rot:Number = radians * 180/ Math.PI
        this.x += Math.cos(rot * Math.PI / 180)*_speed
        this.y += Math.sin(rot * Math.PI / 180)*_speed
        if(Math.random()*100<1){
            radians = Math.atan2((__stage.mouseY - _target.y),(__stage.mouseX - _target.x))
            rot = radians * 180/ Math.PI
            this.x = Math.cos(rot * Math.PI / 180)*200+_target.x
            this.y = Math.sin(rot * Math.PI / 180)*200+_target.y
        }
    }
}
class Skeleton extends Sprite {
 private var _target:Sprite;
 private var _speed:Number;
 private var arrows:Array = new Array();
 private var iA:int
 private var __stage:*;
 private var texi:TextField = new TextField
 private var i:int
 private var fPoint:Point
 public function Skeleton(target:Sprite,speed:Number,_stage:*){
  _target=target;
  _speed=speed
  __stage=_stage
         this.graphics.beginFill(0x808080)
         this.graphics.drawCircle(0,0,16);
         this.graphics.endFill();
         addEventListener(Event.ENTER_FRAME,Skeleton_move)
    }
    public function Skeleton_move(event:Event):void{
         if(Math.sqrt((_target.x-this.x)*(_target.x-this.x)+(_target.y-this.y)*(_target.y-this.y))<=32){
              dispatchEvent(new Event("hit"))
         }
         var radians:Number = Math.atan2((_target.y - this.y),(_target.x - this.x));
         var rot:Number = radians * 180/ Math.PI
         this.x += Math.cos(rot * Math.PI / 180)*_speed
         this.y += Math.sin(rot * Math.PI / 180)*_speed
         if(Math.random()*100<1){
              fPoint = new Point(this.x,this.y)
              arrows[iA] = new Arrow(Math.cos(rot * Math.PI / 180),Math.sin(rot * Math.PI / 180),_target,fPoint)
              arrows[iA].addEventListener("hit",arEnd)
              __stage.addChild(arrows[iA])
              iA++;
         }
    }  
    public function arEnd(event:Event):void{
         dispatchEvent(new Event("hit"))
    }
 
}
class Arrow extends Sprite {
 private var _arTarget:Sprite
 private var _arX:Number
 private var _arY:Number
 private var _fPoint:Point
 private var texi:TextField = new TextField
 public function Arrow(arX:Number,arY:Number,arTarget:Sprite,fpoint:Point){
  _arTarget = arTarget
  addChild(texi)
  _arX = arX//Skeletonクラスから送られたx方向
  _arY = arY//Skeletonクラスから送られたy方向
  this.x=fpoint.x;
  this.y=fpoint.y;
  _fPoint = fpoint
  this.graphics.beginFill(0xFF0000)
  this.graphics.drawCircle(0,0,4)
  this.graphics.endFill();
  addEventListener(Event.ENTER_FRAME,arrow_move)
 }
 public function arrow_move(event:Event):void{
  this.x += _arX*6
  this.y += _arY*6
  if(Math.sqrt((_arTarget.x-(this.x))*(_arTarget.x-(this.x))+(_arTarget.y-(this.y))*(_arTarget.y-(this.y)))<=20){
   dispatchEvent(new Event("hit"))
  }
  
  
 }
}