⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ie4.html

📁 javascript各种效果的实例及源代码
💻 HTML
📖 第 1 页 / 共 2 页
字号:
 apache()
}
}

//AH64 MODE
function apache(){
 with (Math){
  enemy[0][2]=enemy[0][2]+1
  if (enemy[0][2]<=0){enemy[0][2]=0}
  enemy[0][0]=enemy[0][0]-sin(rol)*5-IY*5*sin(rol)+DY*5*sin(rol)
  enemy[0][0]=enemy[0][0]-enemy[0][2]*2
  enemy[0][1]=enemy[0][1]+IY*5*cos(rol)-DY*5*cos(rol)

  tmpPTN=Math.floor(rol/Math.PI*8+0.5)
  if (tmpPTN>=16){tmpPTN=tmpPTN-16}
  if (tmpPTN<0){tmpPTN=tmpPTN+16}
  tmpDX=200-enemy[0][0]
  tmpDY=150-enemy[0][1]
  tmpEVR=sqrt(pow(tmpDX,2)+pow(tmpDY,2))
  tmpEVX=200-tmpEVR*cos(-rol+atan2(tmpDY,tmpDX))
  tmpEVY=150-tmpEVR*sin(-rol+atan2(tmpDY,tmpDX))
 }
 spMOV(5,tmpEVX-enemy[0][2]*2.5,tmpEVY-enemy[0][2]*2.5)
 eneV(5,enemy[0][2]*5,tmpPTN+40)
 enemy[0][4]=enemy[0][2]
 
 with (Math){
 if (enemy[1][2]!=0){
  if (enemy[1][2]<15){
   enemy[1][0]=enemy[1][0]+eMSLdx
   enemy[1][0]=enemy[1][0]+eMSLdx
  }else{
   enemy[1][0]=enemy[1][0]+(200-enemy[1][0])/8
   enemy[1][1]=enemy[1][1]+(150-enemy[1][1])/8
  }
  tmpDX=200-enemy[1][0]
  tmpDY=150-enemy[1][1]
  tmpEVR=sqrt(pow(tmpDX,2)+pow(tmpDY,2))
  tmpEVX=200-tmpEVR*cos(-rol+atan2(tmpDY,tmpDX))
  tmpEVY=150-tmpEVR*sin(-rol+atan2(tmpDY,tmpDX))
  spMOV(6,tmpEVX-enemy[1][2]*2.5,tmpEVY-enemy[1][2]*2.5)
  eneV(6,enemy[1][2]*5,94)
  enemy[0][4]=enemy[0][2]
  enemy[1][2]=enemy[1][2]+1
  if (enemy[1][2]==19){
   enemy[1][2]=0
  }
 }
 if (enemy[1][2]>=18){
  if (abs(200-tmpEVX)<12){
   if (abs(150-tmpEVY)<12){
    spMOV(6,-1000,0)
    document.images["Su27"].src=icons[97].src
    endFLG=1
   }
  }
 }
 if (enemy[0][2]==7){
  enemy[1][0]=enemy[0][0]
  enemy[1][1]=enemy[0][1]
  enemy[1][2]=enemy[0][2]
  enemy[1][4]=0
  eMSLdx=(200-enemy[1][0])/14
  eMSLdy=(150-enemy[1][1])/14
 }
 }
 if (enemy[0][2]==19){
  hitAH()
  ahFLG=0
  enemy[0][0]=100+200*Math.random()
  enemy[0][1]=100+100*Math.random()
  enemy[0][2]=0
  enemy[0][3]=14
  enemy[0][5]=0-Math.floor(20*Math.random())
  enemy[1][0]=100+200*Math.random()
  enemy[1][1]=100+100*Math.random()
  enemy[1][2]=0
  enemy[1][3]=14
  enemy[1][5]=0-Math.floor(20*Math.random())
 }
}


//ENEMY VIEW
function eneV(spNO,siz,PN){
 document.images[spNO].src=icons[PN].src
 zoom(spNO,siz,siz)
}

//HIT CHECK
function hitCHK(){
 if (tmpEVX>=fireNo[0][1]+200-11){
  if (tmpEVX<=fireNo[0][1]+200+11){
   if (tmpEVY>=fireNo[0][2]+150-11){
    if (tmpEVY<=fireNo[0][2]+150+11){
     eneV(5+i0,enemy[i0][2]*5,96)
     Hwait[i0]=1
     SCORE=SCORE+100+50*i0
     parent.document.forms[0].elements[0].value = SCORE
    }
   }
  }
 }
}

//HIT CHECK FOR AH64
function hitAH(){
for (iAH=0; iAH<5; iAH++){
 if (tmpEVX>=fireNo[iAH][1]+200-11){
  if (tmpEVX<=fireNo[iAH][1]+200+11){
   if (tmpEVY>=fireNo[iAH][2]+150-11){
    if (tmpEVY<=fireNo[iAH][2]+150+11){
     eneV(5,enemy[0][2]*5,97)
     Hwait[0]=1
    }
   }
  }
 }
}
 if (Hwait[0]==1){
  SCORE=SCORE+1000
  parent.document.forms[0].elements[0].value = SCORE
 }
}

//Su-27 WRITE
function Su27w(){
 if (IY-DY>0){
  document.images["Su27"].src=icons[91].src
 }else{
  if (IY-DY<0){
   document.images["Su27"].src=icons[92].src
  }else{
   document.images["Su27"].src=icons[90].src
  }
 }
}

//HORIZON ROLL CALCULATION
function rollHR(){
 rol=rol+IX*0.1-DX*0.1
 if (rol>=Math.PI){rol=rol-Math.PI*2}
 if (rol<-Math.PI){rol=rol+Math.PI*2}
 tmpPitch=tmpPitch+IY*5*Math.cos(rol)-DY*5*Math.cos(rol)
 if (tmpPitch>=148){tmpPitch=148}
 if (tmpPitch<=-148){tmpPitch=-148}
 roll(tmpPitch,rol)
}

//MY BULLET WRITE
function bulW(){
 with (Math){
  for (ib=0; ib<7; ib++){
   fireNo[ib][0]=fireNo[1+ib][0]
   if (sin(rol)>=0){
    fireNo[ib][1]=fireNo[1+ib][1]-cos(rol)*(abs(sin(rol))*5*(IY-DY+1))
   }else{
    fireNo[ib][1]=fireNo[1+ib][1]+cos(rol)*(abs(sin(rol))*5*(IY-DY+1))
   }
   fireNo[ib][2]=fireNo[1+ib][2]+abs(sin(rol)*(abs(sin(rol))*5*(IY-DY+1)))
   fireNo[ib][2]=fireNo[ib][2]-8*(IY-DY)
  }


  fireNo[7][0]=0
  fireNo[7][1]=-1000
  fireNo[7][2]=0
  if (FIRE==1){if (GUN>0){
   if (fireNo[6][0]==0){
    fireNo[7][0]=1
    fireNo[7][1]=0
    fireNo[7][2]=0
    GUN=GUN-1
    parent.document.forms[0].elements[1].value = GUN
   }
  }}

  for (ib=0; ib<8; ib++){
    spMOV(Buloff+ib,fireNo[ib][1]+200-sizeF[ib],fireNo[ib][2]+150-sizeF[ib])
  }
 }
}

//MY MISSILE WRITE
function mslW(){
 if (MSLc==9){
  MSLc=0
  eneV(5+TGT,enemy[TGT][4],99)
  eneV(5+TGT,enemy[TGT][2],99)
  i0=TGT
  eneA()
 }
 if (MSLc==8){
  MSLc=0
  spMOV("MSL",-1000,0)
 }
 for (ims=0; ims<7; ims++){
  if (MSLc==7-ims){
   with (Math){
    MSLx[0]=MSLx[0]-sin(rol)*5-IY*5*sin(rol)+DY*5*sin(rol)
    MSLy[0]=MSLy[0]+IY*5*cos(rol)-DY*5*cos(rol)

    tmx=enemy[TGT][0]-MSLx[0]
    tmy=enemy[TGT][1]-MSLy[0]
    MSLx[0]=MSLx[0]+tmx/3
    MSLy[0]=MSLy[0]+tmy/3
    MSLc=MSLc+1
    tmpRO()
    spMOV("MSL",tmpEVX,tmpEVY)
    zoom("MSL",floor(pow(1.245,12-MSLc)),floor(pow(1.245,12-MSLc)))
    if (abs(tmx)<14){if (abs(tmy)<14){mslHIT()}}
   }
  }
 }
 if (MSLc==0){if (MSL==1){if (MSLr>=1){
  MSLx[0]=200;MSLy[0]=160;MSLc=1;MSLr=MSLr-1
  parent.document.forms[0].elements[2].value = MSLr
  TGT=0
  if (ahFLG==0){
   if (enemy[1][2]>enemy[0][2]){TGT=1}
   if (enemy[1][2]==enemy[0][2]){
    with (Math){
     tmpDX=200-enemy[0][0]
     tmpDY=150-enemy[0][1]
     tmpEVR1=sqrt(pow(tmpDX,2)+pow(tmpDY,2))
     tmpDX=200-enemy[1][0]
     tmpDY=150-enemy[1][1]
     tmpEVR2=sqrt(pow(tmpDX,2)+pow(tmpDY,2))
     if (tmpEVR2<tmpEVR1){TGT=1}
    }
   }
  }
  spMOV("MSL",192,152)
  with (Math){
   zoom("MSL",floor(pow(1.245,12-MSLc)),floor(pow(1.245,12-MSLc)))
  }
 }}}
}

//MISSILE tmp rotation
function tmpRO(){
 with (Math){
  tmpDX=200-MSLx[0]
  tmpDY=150-MSLy[0]
  tmpEVR=sqrt(pow(tmpDX,2)+pow(tmpDY,2))
  tmpEVX=200-tmpEVR*cos(-rol+atan2(tmpDY,tmpDX))
  tmpEVY=150-tmpEVR*sin(-rol+atan2(tmpDY,tmpDX))
 }
}

//MISSILE HIT
function mslHIT(){
 MSLc=9;MSL=0
 spMOV("MSL",-1000,0)
 eneV(5+TGT,enemy[TGT][2]*5,97)
 SCORE=SCORE+100+50*TGT+ahFLG*1000
 parent.document.forms[0].elements[0].value = SCORE
}

//END GAME
function edG(){
  gameEND.style.posTop = 100
  document.forms[2].elements[0].value = SCORE
}

//-------------------------------------------------------
//------------- SUB FUNCTIONS (FOR IE) ------------------
//-------------------------------------------------------

//IMAGE SETUP
function spINI(spX,spY,spIMG){
 with (document) {
  write("<IMG SRC='"+spIMG+"' STYLE='position:absolute'>")
  images[spCOUNT].style.posLeft = spX
  images[spCOUNT].style.posTop =  spY
  spCOUNT=spCOUNT+1
 }
}

//ON LOAD
function onLD(){
 document.onkeypress = keyDown
 document.onkeyup = keyUp
}

//RESTART
function restart(){
 RES.style.posTop = -1000
 timerID = setTimeout("intervalT()",50)
}

//IMAGE ZOOM
function zoom(spNO,zoomX,zoomY){
   document.images[spNO].style.height = zoomY
   document.images[spNO].style.width =  zoomX
}

//REFRESH GAME
function refG(){
 IX=0
 IY=0
 DX=0
 DY=0
 FIRE=0
 MSL=0
 MSLr=10
 MSLc=0
 SCORE=0
 Mtimer=0
 AHtimer=0
 ahFLG=0
 GUN=500
 endFLG=0
 enemy[0][0]=280
 enemy[0][1]=100
 enemy[0][2]=0
 enemy[0][3]=0
 enemy[0][4]=0
 enemy[0][5]=0
 enemy[1][0]=150
 enemy[1][1]=120
 enemy[1][2]=0
 enemy[1][3]=0
 enemy[1][4]=0
 enemy[1][5]=0

  spMOV(5,0,-1000)
  spMOV(6,0,-1000)

 for (i=0; i<8; i++){
  Hwait[i]=0
 }
 for (i=0; i<8; i++){
  fireNo[i][0]=0
  fireNo[i][1]=-1000
  fireNo[i][2]=0
 }
  gameEND.style.posTop = -1000
  parent.document.forms[0].elements[0].value = 0
  parent.document.forms[0].elements[1].value = 500
  parent.document.forms[0].elements[2].value = 10
  parent.document.forms[0].elements[3].value = 2000
  startG()
}

//-->
</SCRIPT>
</HEAD>


<BODY BGCOLOR="#00AFFF" TEXT="#FFFFFF" ONLOAD="onLD()">
<SCRIPT LANGUAGE="JavaScript">
<!--
 spINI(1000,0,"lr0.gif")
 spINI(1000,0,"r45c.gif")
 spINI(1000,0,"r135c.gif")
 spINI(1000,0,"l45c.gif")
 spINI(1000,0,"l135c.gif")

 zoom(0,400,300)
 spMOV(0,0,149)

 spINI(1,1,"null.gif")
 spMOV(5,1000,150)

 spINI(1,1,"null.gif")
 spMOV(6,1000,150)

//-->
</SCRIPT>

<SCRIPT LANGUAGE="JavaScript">
<!--
//MY BULLET LAYER
 Buloff=spCOUNT
 for (ia=0; ia<8; ia++){
  with(Math){
   ix=floor(pow(1.245,ia+3))
   iix=floor(ix/2)
   sizeF[ia]=iix
   iaT=ia.toString()
  }
  spINI(-1000,0,"fire1c.gif")
  zoom(spCOUNT-1,ix,ix)
 }

//-->
</SCRIPT>
<IMG SRC="fire2c.gif" ID="MSL" STYLE="position:absolute; top: -1000; left: 0">

<IMG SRC="su27c.gif" ID="Su27" STYLE="position:absolute; top: 100; left: 150">

<DIV ID="STA" STYLE="position:absolute; top: 150; left: 170">
 <FORM>
 <INPUT TYPE="button" VALUE="开始" ONCLICK="startG()">
 </FORM>
</DIV>

<DIV ID="RES" STYLE="position:absolute; top: -1000; left: 170">
 <FORM>
 <INPUT TYPE="button" VALUE="暂停" ONCLICK="restart()">
 </FORM>
</DIV>

<DIV ID="gameEND" STYLE="position:absolute; top: -2000; left: 110">
 <FONT COLOR="#FF0000" STYLE="font-size:30px">游戏结束</FONT><P>
 <FORM><FONT COLOR="#FFFF00" STYLE="font-size:16px">
 你的积分为:<INPUT TYPE="text" VALUE="" SIZE="10">pts
 <P><BR><P>
 <IMG WIDTH=45 HEIGHT=1 SRC="null.gif">
 <INPUT TYPE="button" VALUE="重新开始" ONCLICK="refG()">
 </FONT></FORM>
</DIV>


</BODY>
</HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -