HRA: HARD BLOCK

ID
Nazov / Name:
Popis / Description:
Dlzka / Length:
Testovane pod / Tested under:

 

131
p131.html / p131.zip
Odbijanie lopticky odraznikom za ucelom znicenia tehliciek.
6679h
NN 4.04

UKAZKA / CLICK HERE

Zdrojovy tvar / Source code:

<HTML> <HEAD> <TITLE>JavaScript DESTINATION - P131</TITLE> <SCRIPT LANGUAGE="JavaScript"> <!-- var timerID = null var INT = 100 var loadFLG=0 var gameFLG=0 var missFLG=0 var tim = 0 var blcol = new Array(5) var blsta = new Array(40) var blclr = 0 var ballX = 0 var ballY = 0 var ballN = 3 var ballDX= 0 var ballDY= 0 var tmpRL = 193 blcol[0]="#FFFF00" blcol[1]="#FFB000" blcol[2]="#FF8000" blcol[3]="#FF4000" blcol[4]="#FF0000" blcol[5]="#000000" function mainF(){ clearTimeout(timerID) tim=tim+1 with (Math){tmptim=floor(tim/10)} document.layers["info"].document.forms[0].TM.value=tmptim ballX=ballX+ballDX ballY=ballY+ballDY outCHK() blkCHK() document.layers["ball"].moveTo(ballX,ballY) if (gameFLG==1){timerID = setTimeout("mainF()",INT)} } function initG(){ if (blclr >= 40){ blclr=0 tim=0 ballN=3 with (Math){tmptim=floor(tim/10)} document.layers["info"].document.forms[0].TM.value=tmptim document.layers["ovrmes"].visibility="HIDE" document.layers["clrmes"].visibility="HIDE" for (ib=0; ib<5; ib++){for (ia=0; ia<8; ia++){ document.layers[ib*8+ia+1].bgColor=blcol[ib] blsta[ib*8+ia]=ib }} } document.layers["info"].document.forms[0].BL.value=ballN document.layers["starter"].visibility="HIDE" gameFLG=1;loadFLG=1 ballX=209;ballY=270;ballDX=-8;ballDY=-8;tmpRL=193;missFLG=0 timerID = setTimeout("mainF()",INT) } function SUP(){ document.layers["UD"].layers["UP"].visibility="HIDE" document.layers["UD"].layers["DN"].visibility="SHOW" INT=10 } function SDN(){ document.layers["UD"].layers["DN"].visibility="HIDE" document.layers["UD"].layers["UP"].visibility="SHOW" INT=100 } function MouseMv(Mvx){ if (loadFLG==1){ tmpRL=Mvx.pageX-20 if (tmpRL<16){tmpRL=16} if (tmpRL>370){tmpRL=370} document.layers["racket"].left=tmpRL } } function outCHK(){ if (ballX < 16){ballX=32-ballX;ballDX=-ballDX} if (ballX > 401){ballX=802-ballX;ballDX=-ballDX} if (ballY < 16){ballY=32-ballY;ballDY=-ballDY} if (ballY >= 272){ if (missFLG==0){ tmpX=(ballDX/ballDY)*(272-ballY)+ballX if (tmpX >= tmpRL-12){ if (tmpX <= tmpRL+42){ ballY=272;ballDY=-ballDY ballX=tmpX ballRD=tmpX-tmpRL with (Math){ballDX=8*abs(ballDX)/ballDX} if (ballRD<-4){ballDX=-15} if (ballRD>36){ballDX=15} if (ballRD>=14){if (ballRD<=16){ballDX=-2}} if (ballRD>=17){if (ballRD<=20){ballDX=2}} if (ballRD>=0){if (ballRD<=4){ballDX=-4}} if (ballRD>=28){if (ballRD<=32){ballDX=4}} if (ballRD>=-4){if (ballRD<=-1){ballDX=-11}} if (ballRD>=33){if (ballRD<=36){ballDX=11}} } } if (ballDY>0){missFLG=1} }else{ if (ballY>290){missFLG=0;ballN=ballN-1;gameEnd()} } } } function blkCHK(){ tmpY=ballY+4;tmpX=ballX+4 if (tmpY>=48){if (tmpY<=147){if (tmpX>=29){if (tmpX<=396){ with (Math) { ia=floor((tmpX-29)/46);ib=floor((tmpY-48)/20);ic=ib*8+ia } if (blsta[ic]<=4){ tmpbc=blsta[ic]+1 blsta[ic]=tmpbc document.layers[ic+1].bgColor=blcol[tmpbc] if (tmpbc==5){blclr=blclr+1} if (blclr >= 40){gameEnd()} if (ballDX>0){ iy=(ballDY/ballDX)*(29+46*ia-tmpX)+tmpY if (iy>48+20*ib+18){ tmpY1=48+20*ib+18 tmpX1=(ballDX/ballDY)*(48+20*ib+18-tmpY)+tmpX ballX=tmpX1-4;ballY=tmpY1-4 ballDY=-ballDY }else{ if (iy<44+20*ib){ tmpY1=48+20*ib tmpX1=(ballDX/ballDY)*(48+20*ib-tmpY)+tmpX ballX=tmpX1-4;ballY=tmpY1-4 ballDY=-ballDY }else{ tmpX1=29+46*ia tmpY1=(ballDY/ballDX)*(29+46*ia-tmpX)+tmpY ballX=tmpX1-4;ballY=tmpY1-4 ballDX=-ballDX } } }else{ iy=(ballDY/ballDX)*(29+46*ia+44-tmpX)+tmpY if (iy>48+20*ib+18){ tmpY1=48+20*ib+18 tmpX1=(ballDX/ballDY)*(48+20*ib+18-tmpY)+tmpX ballX=tmpX1-4;ballY=tmpY1-4 ballDY=-ballDY }else{ if (iy<44+20*ib){ tmpY1=48+20*ib tmpX1=(ballDX/ballDY)*(48+20*ib-tmpY)+tmpX ballX=tmpX1-4;ballY=tmpY1-4 ballDY=-ballDY }else{ tmpX1=29+46*ia+44 tmpY1=(ballDY/ballDX)*(29+46*ia+44-tmpX)+tmpY ballX=tmpX1-4;ballY=tmpY1-4 ballDX=-ballDX } } } } }}}} } function gameEnd(){ document.layers["info"].document.forms[0].BL.value=ballN gameFLG=0 loadFLG=0 document.layers["starter"].visibility="SHOW" if (blclr >= 40){ document.layers["clrmes"].visibility="SHOW" } if (ballN <= 0){ document.layers["ovrmes"].visibility="SHOW" blclr=40 } } function onLD(){ document.onmousemove = MouseMv document.captureEvents(Event.MOUSEMOVE) document.layers["starter"].visibility="SHOW" } //--> </SCRIPT> </HEAD> <BODY BGCOLOR="#DEB887" ONLOAD="onLD()"> <LAYER LEFT="16" TOP="16" CLIP="0,0,393,299" BGCOLOR="#000000"></LAYER> <SCRIPT LANGUAGE="JavaScript"> <!-- for (ib=0; ib<5; ib++){ for (ia=0; ia<8; ia++){ tmpL=29+46*ia;tmpT=48+20*ib document.write("<LAYER LEFT="+tmpL+" TOP="+tmpT+" CLIP='2,2,43,17' BGCOLOR='"+blcol[ib]+"'></LAYER>") blsta[ib*8+ia]=ib } } //--> </SCRIPT> <LAYER NAME="ball" LEFT="209" TOP="270" CLIP="0,0,7,7"> <LAYER LEFT="2" TOP="0" CLIP="0,0,3,7" BGCOLOR="#B0B0B0"></LAYER> <LAYER LEFT="0" TOP="2" CLIP="0,0,7,3" BGCOLOR="#B0B0B0"></LAYER> <LAYER LEFT="1" TOP="1" CLIP="0,0,5,5" BGCOLOR="#FFFFFF"></LAYER> </LAYER> <LAYER NAME="racket" LEFT="193" TOP="280" CLIP="0,0,39,3" BGCOLOR="#B0B0FF"> </LAYER> <LAYER NAME="info" LEFT="416" TOP="16"> <PRE> <FONT STYLE="font-size:24px" COLOR="#000044"><I><B>Hard Block</B></I></FONT> <FORM> LOPTA:<INPUT TYPE="text" NAME="BL" SIZE=5 VALUE = "3" > CAS :<INPUT TYPE="text" NAME="TM" SIZE=5 VALUE = "0" > </FORM> </PRE> </LAYER> <LAYER NAME="UD" LEFT="416" TOP="170"> <LAYER NAME="UP"><A HREF="javascript:SUP()">ZRYCHLIT</A></LAYER> <LAYER NAME="DN" visibility="HIDE"><A HREF="javascript:SDN()">SPOMALIT</A></LAYER> <PRE> <FONT SIZE=-1><A HREF="javascript:history.back()">Navrat</a> / <a href="priklady-english.html">BACK</A></FONT><P> </PRE> </LAYER> <LAYER NAME="clrmes" TOP=150 LEFT=160 visibility="HIDE"> <FONT STYLE="font-size:24px" COLOR="#44CC44">VYHRAL SI!</FONT> </LAYER> <LAYER NAME="ovrmes" TOP=150 LEFT=160 visibility="HIDE"> <FONT STYLE="font-size:24px" COLOR="#CC4444">KONIEC HRY!</FONT> </LAYER> <LAYER NAME="starter" TOP=200 LEFT=180 visibility="HIDE"> <FORM><INPUT TYPE="button" VALUE="START" ONCLICK="initG();blur()"></FORM> </LAYER> </BODY> </HTML>
[ Navrat / BACK ]