stop();
var r,r2:Number = 0;//半逕
var i:Number;
var direct:Number=1;
var timer_var:Number;
var power:Number=0.8;
var yspeed:Number=0;
var xspeed:Number=0;
var friction:Number=0.9;//控制越來越慢
var objKeyboard:Object;
var ddd:Array=new Array();
ddd=[0,0,0,0];
stage.addEventListener(Event.ENTER_FRAME,loop_fun);
stage.addEventListener(KeyboardEvent.KEY_DOWN, reportKeyDown);
stage.addEventListener(KeyboardEvent.KEY_UP, reportKeyUp);
function loop_fun(e:Event):void{
//----hero control---------------------------
xspeed*=friction;
yspeed*=friction;
hero.y+=yspeed;
hero.x+=xspeed;
//----hero control---------------------------
//----hero control---------------------------
var com_ddd:String=String(ddd[0]+""+ddd[1]+ddd[2]+ddd[3]);
//trace(com_ddd);
switch (Number(com_ddd)) {
case 0010 :
yspeed-=power*1.3;
break;
case 0001 :
yspeed+=power*1.3;
break;
case 1000 :
xspeed-=power*1.3;
break;
case 0100 :
xspeed+=power*1.3;
break;
}
//----hero control---------------------------
(r<300)? r+=5:r=0;
enemy.x +=4*direct;
if(enemy.x>450){direct=-1;}
if(enemy.x<90){ direct=1; }
timer_var=getTimer()/1000;
remove_bullet();
ger_bullet();
if(timer_var>=0.3){
(r2<300)? r2+=5:r2=0;
ger_bullet2();
}
//----histTest---------------------------
for (i=1;i<=20;i++){
var dect_eb:MovieClip = MovieClip(root).getChildByName("eb" + i);
if (HitTest.complexHitTestObject(dect_eb,hero,3)){ trace(111) }
}
//----histTest---------------------------
}//function
function ger_bullet(){
for (i=1; i<=20;i++) { // 一個下半圓帶入sin cos是由0-3.2 形成一個半弧
var eb:enemy_bullet=new enemy_bullet();
MovieClip(root).addChild(eb);
eb.name = "eb" + String( i );
eb.rotation=-(90-i*(180/20));//每一個子彈旋轉角
eb.x = r*Math.cos(i*3.2/20)+enemy.x;
eb.y = r*Math.sin(i*3.2/20)+enemy.y;
This entry passed through the Full-Text RSS service — if this is your content and you're reading it on someone else's site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers. Five Filters recommends: Jousting With Toothpicks - The Case For Challenging Corporate Journalism http://www.medialens.org/index.php/alerts/alert-archive/alerts-2013/719-jousting-with-toothpicks-the-case-for-challenging-corporate-journalism.html.
留言列表