HRA: TETRIS

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

 

138
p138.html / p138.zip
Znama logicka hra.
21589b
NN 4.04

UKAZKA / CLICK HERE

Zdrojovy tvar / Source code:

<HTML> <HEAD><TITLE>JavaScript DESTINATION - P138</TITLE> <SCRIPT LANGUAGE="JavaScript"> <!-- var acti=0 var timerID = null var timerINT = 500 var scrn = new Array(220) var icons = new Array(8) icons[0]=new Image();icons[0].src="bl0.gif" icons[1]=new Image();icons[1].src="bl1.gif" icons[2]=new Image();icons[2].src="bl2.gif" icons[3]=new Image();icons[3].src="bl3.gif" icons[4]=new Image();icons[4].src="bl4.gif" icons[5]=new Image();icons[5].src="bl5.gif" icons[6]=new Image();icons[6].src="bl6.gif" icons[7]=new Image();icons[7].src="bl7.gif" icons[8]=new Image();icons[8].src="bl8.gif" var styl = new Array(280) var tmps = new Array(10) var lv = 1 var rst = 1 var bb1 = 0 var bb2 = 0 var bb3 = 0 var bb4 = 0 var bbo = 0 var hcp = 0 var hcr = 0 var hcx = 0 var hcy = 0 var hcf = 0 var nowp = 5 var nowr = 0 var nowx = 3 var nowy = 0 var movf = 0 var chkf = 0 var total = 0 var score = 0 function interval1(){ clearTimeout(timerID) DownCheck() timerID = setTimeout("interval1()",timerINT) } function start(){ systm="" ver=navigator.appVersion Nv=ver.charAt(0) len=ver.length for(iln=0;iln<len;iln++) if(ver.charAt(iln)=="(") break systm = ver.charAt(iln+1).toUpperCase() for (ia=0; ia<220; ia++){ scrn[ia]=0 } lv = 1 bb1 = 0 bb2 = 0 bb3 = 0 bb4 = 0 bbo = 0 nowp = 5 nowr = 0 nowx = 3 nowy = 0 total = 0 score = 0 if (rst == 1){ document.TetriScript.LINE.value = "0 riadkov" document.TetriScript.PTS.value = "0 bodov" }else{ document.TetriScript.LINE.value = "SELECT LEVEL" if (systm != "C"){if (Nv >= 4){ document.TetriScript.PTS.value = "LEVEL L KLAVES" }else{ document.TetriScript.PTS.value = "KLIKNI ROTACIA" } }else{ document.TetriScript.PTS.value = "KLIKNI ROTACIA" } } for (ia=0; ia<22; ia++){ for (ib=0; ib<10; ib++){ iaa=ia*10+ib+16 SetIcon(0,iaa) } } if (rst == 1){ WriNxt() nowp = patn nowr = rotat WriScr() WriNxt() acti=1 rst =0 timerID = setTimeout("interval1()",10) }else{ for (iaa=0; iaa<16; iaa++){ SetIcon (0,iaa) rst=1 acti=0 clearTimeout(timerID) } } } function SetIcon(flag, position){ document.images[position].src=icons[flag].src } function WriNxt(){ with (Math) { patn = floor(random()*7)+1 rotat = floor(random()*4) } for (iaa=0; iaa<16; iaa++){ SetIcon (0,iaa) } offset=patn*40 + rotat*10 - 40 outpos=styl[offset]*4+styl[offset+1]-5 SetIcon (patn,outpos) outpos=styl[offset+2]*4+styl[offset+3]-5 SetIcon (patn,outpos) outpos=styl[offset+4]*4+styl[offset+5]-5 SetIcon (patn,outpos) outpos=styl[offset+6]*4+styl[offset+7]-5 SetIcon (patn,outpos) } function WriScr(){ if (movf == 0){ SetIcon (0,bb1) SetIcon (0,bb2) SetIcon (0,bb3) SetIcon (0,bb4) } movf=0 offset=nowp*40+nowr*10-40 bbo = offset outpos=(styl[offset]+nowy)*10+styl[offset+1]+nowx+5 SetIcon (nowp,outpos) bb1=outpos outpos=(styl[offset+2]+nowy)*10+styl[offset+3]+nowx+5 SetIcon (nowp,outpos) bb2=outpos outpos=(styl[offset+4]+nowy)*10+styl[offset+5]+nowx+5 SetIcon (nowp,outpos) bb3=outpos outpos=(styl[offset+6]+nowy)*10+styl[offset+7]+nowx+5 SetIcon (nowp,outpos) bb4=outpos } function LeftClick(){ if (acti == 1){ iab=styl[bbo+1]+nowx if (iab >= 2){ iab=styl[bbo+3]+nowx if (iab >= 2){ iab=styl[bbo+5]+nowx if (iab >= 2){ iab=styl[bbo+7]+nowx if (iab >= 2){ hcp=nowp hcr=nowr hcx=nowx-1 hcy=nowy HitChk(hcp,hcr,hcx,hcy) if (hcf == 0){ nowx=nowx-1 WriScr() } } } } } } } function RightClick(){ if (acti == 1){ iab=styl[bbo+1]+nowx if (iab <= 9){ iab=styl[bbo+3]+nowx if (iab <= 9){ iab=styl[bbo+5]+nowx if (iab <= 9){ iab=styl[bbo+7]+nowx if (iab <= 9){ hcp=nowp hcr=nowr hcx=nowx+1 hcy=nowy HitChk(hcp,hcr,hcx,hcy) if (hcf == 0){ nowx=nowx+1 WriScr() } } } } } } } function RotateClick(){ if (acti == 1){ hcp=nowp hcr=nowr+1 if (hcr == 4){hcr=0} hcx=nowx hcy=nowy iaoff=hcp*40 + hcr*10 - 40 iab=styl[iaoff+1]+hcx if (iab <= 10){ if (iab >= 1 ){ iab=styl[iaoff+0]+hcy if (iab <= 22){ if (iab >= 1 ){ iab=styl[iaoff+3]+hcx if (iab <= 10){ if (iab >= 1 ){ iab=styl[iaoff+2]+hcy if (iab <= 22){ if (iab >= 1 ){ iab=styl[iaoff+5]+hcx if (iab <= 10){ if (iab >= 1 ){ iab=styl[iaoff+4]+hcy if (iab <= 22){ if (iab >= 1 ){ iab=styl[iaoff+7]+hcx if (iab <= 10){ if (iab >= 1 ){ iab=styl[iaoff+6]+hcy if (iab <= 22){ if (iab >= 1 ){ HitChk(hcp,hcr,hcx,hcy) if (hcf == 0){ nowr=hcr WriScr() } } } } } } } } } } } } } } } } } }else{ if (rst == 1){ lv=lv+1 if (lv == 6){lv=1} timerINT = 600-(lv * 100) document.TetriScript.LINE.value = "NASTAV SI UROVEN" document.TetriScript.PTS.value = "LEVEL "+lv } } } function DownCheck(){ if (acti == 1){ chkf=0 iab=styl[bbo+0]+nowy if (iab <= 21){ iab=styl[bbo+2]+nowy if (iab <= 21){ iab=styl[bbo+4]+nowy if (iab <= 21){ iab=styl[bbo+6]+nowy if (iab <= 21){ hcp=nowp hcr=nowr hcx=nowx hcy=nowy+1 HitChk(hcp,hcr,hcx,hcy) if (hcf == 0){ nowy=nowy+1 WriScr() chkf=1 } } } } } if (chkf == 0){ tmps[0]=(styl[bbo+0]+nowy-1)*10 iab=tmps[0]+styl[bbo+1]+nowx-1 scrn[iab]=nowp tmps[1]=(styl[bbo+2]+nowy-1)*10 iab=tmps[1]+styl[bbo+3]+nowx-1 scrn[iab]=nowp tmps[2]=(styl[bbo+4]+nowy-1)*10 iab=tmps[2]+styl[bbo+5]+nowx-1 scrn[iab]=nowp tmps[3]=(styl[bbo+6]+nowy-1)*10 iab=tmps[3]+styl[bbo+7]+nowx-1 scrn[iab]=nowp tmps[4]=-1 tmps[5]=-1 tmps[6]=-1 tmps[7]=-1 tmps[8]=0 for (iae=0; iae<4; iae++){ iag=tmps[iae] iah=1 if (tmps[4] == iag){iah=0} if (tmps[5] == iag){iah=0} if (tmps[6] == iag){iah=0} if (tmps[7] == iag){iah=0} for (iaf=0; iaf<10; iaf++){ if (scrn[iag+iaf] == 0){iah=0} } if (iah == 1){ tmps[8]=tmps[8]+1 total=total+1 tmps[iae+4]=iag for (iaf=0; iaf<10; iaf++){ SetIcon(8,iag+iaf+16) } } } if (tmps[8] == 1){score=score+20} if (tmps[8] == 2){score=score+80} if (tmps[8] == 3){score=score+300} if (tmps[8] == 4){score=score+1200} document.TetriScript.LINE.value = total+" riadkov" document.TetriScript.PTS.value = score+" bodov" if (total >= 25){ document.TetriScript.LINE.value = "MISSION CLEAR!!" acti=0 clearTimeout(timerID) } if (tmps[4] >= tmps[5]){ tmps[9]=tmps[4] tmps[4]=tmps[5] tmps[5]=tmps[9] } if (tmps[4] >= tmps[6]){ tmps[9]=tmps[4] tmps[4]=tmps[6] tmps[6]=tmps[9] } if (tmps[4] >= tmps[7]){ tmps[9]=tmps[4] tmps[4]=tmps[7] tmps[7]=tmps[9] } if (tmps[5] >= tmps[6]){ tmps[9]=tmps[5] tmps[5]=tmps[6] tmps[6]=tmps[9] } if (tmps[5] >= tmps[7]){ tmps[9]=tmps[5] tmps[5]=tmps[7] tmps[7]=tmps[9] } if (tmps[6] >= tmps[7]){ tmps[9]=tmps[6] tmps[6]=tmps[7] tmps[7]=tmps[9] } for (ial=0; ial<4; ial++){ if (tmps[4+ial] != -1){ for (iam=0; iam<(tmps[4+ial]-10); iam++){ ian=tmps[4+ial]-1-iam scrn[ian+10]=scrn[ian] } for (iam=0; iam<10; iam++){scrn[iam]=0} } } for (iam=0; iam<220; iam++){SetIcon(scrn[iam],iam+16)} nowx=3 nowy=0 nowp=patn nowr=rotat movf=1 WriScr() hcp=nowp hcr=nowr hcx=nowx hcy=nowy HitChk(hcp,hcr,hcx,hcy) if (hcf == 1){acti=0 document.TetriScript.LINE.value = "KONIEC HRY!!" clearTimeout(timerID) } WriNxt() } } } function HitChk(hcp,hcr,hcx,hcy){ hcf=0 iaoff=hcp*40 + hcr*10 - 40 iad=(styl[iaoff+0]+hcy)*10+styl[iaoff+1]+hcx-11 if (scrn[iad] >= 1){hcf=1} iad=(styl[iaoff+2]+hcy)*10+styl[iaoff+3]+hcx-11 if (scrn[iad] >= 1){hcf=1} iad=(styl[iaoff+4]+hcy)*10+styl[iaoff+5]+hcx-11 if (scrn[iad] >= 1){hcf=1} iad=(styl[iaoff+6]+hcy)*10+styl[iaoff+7]+hcx-11 if (scrn[iad] >= 1){hcf=1} } function keyDown(DnEvents){ k=DnEvents.which if (k == 50){DownCheck()} if (k == 53){RotateClick()} if (k == 76){RotateClick()} if (k == 108){RotateClick()} if (k == 54){RightClick()} if (k == 52){LeftClick()} if (k == 83){start()} if (k == 115){start()} } systm="" ver=navigator.appVersion Nv=ver.charAt(0) len=ver.length for(iln=0;iln<len;iln++) if(ver.charAt(iln)=="(") break systm = ver.charAt(iln+1).toUpperCase() if (systm != "C"){if (Nv >= 4){ document.onkeydown = keyDown document.captureEvents(Event.KEYDOWN) }} //--> </SCRIPT> </HEAD> <BODY BGCOLOR="#CCCCFF" TEXT="#000000" VLINK="#FF0000" ONLOAD="focus()"> <SCRIPT LANGUAGE="JavaScript"> <!-- for (ia=0; ia<220; ia++){ scrn[ia]=0 } for (ia=0; ia<4; ia++){ document.write("<IMG BORDER=0 WIDTH=16 HEIGHT=16 SRC='bl0.gif'><IMG BORDER=0 WIDTH=16 HEIGHT=16 SRC='bl0.gif'><IMG BORDER=0 WIDTH=16 HEIGHT=16 SRC='bl0.gif'><IMG BORDER=0 WIDTH=16 HEIGHT=16 SRC='bl0.gif'><BR>") } for (ia=0; ia<22; ia++){ document.write("<CENTER><IMG BORDER=0 WIDTH=16 HEIGHT=16 SRC='bl0.gif'><IMG BORDER=0 WIDTH=16 HEIGHT=16 SRC='bl0.gif'><IMG BORDER=0 WIDTH=16 HEIGHT=16 SRC='bl0.gif'><IMG BORDER=0 WIDTH=16 HEIGHT=16 SRC='bl0.gif'><IMG BORDER=0 WIDTH=16 HEIGHT=16 SRC='bl0.gif'><IMG BORDER=0 WIDTH=16 HEIGHT=16 SRC='bl0.gif'><IMG BORDER=0 WIDTH=16 HEIGHT=16 SRC='bl0.gif'><IMG BORDER=0 WIDTH=16 HEIGHT=16 SRC='bl0.gif'><IMG BORDER=0 WIDTH=16 HEIGHT=16 SRC='bl0.gif'><IMG BORDER=0 WIDTH=16 HEIGHT=16 SRC='bl0.gif'></CENTER>") } tmps[1]="22233233--22233233--22233233--22233233--" tmps[2]="12212223--12212232--21222332--12222332--" tmps[3]="13222332--21223233--13222332--21223233--" tmps[4]="12222333--22233132--12222333--22233132--" tmps[5]="12223233--23313233--22233343--22232432--" tmps[6]="13233233--21222333--22233242--22323334--" tmps[7]="13233343--21222324--13233343--21222324--" for (ib=1; ib<8; ib++){ for (ia=0; ia<40; ia++){ ic = tmps[ib].charAt(ia) iz = ib * 40 + ia - 40 styl[iz] = 4 if (ic == "1"){styl[iz] = 1} if (ic == "2"){styl[iz] = 2} if (ic == "3"){styl[iz] = 3} if (ic == "4"){styl[iz] = 4} } } systm="" ver=navigator.appVersion Nv=ver.charAt(0) len=ver.length for(iln=0;iln<len;iln++) if(ver.charAt(iln)=="(") break systm = ver.charAt(iln+1).toUpperCase() if (systm != "C"){if (Nv >= 4){ document.write("<LAYER LEFT='96' TOP='16'><PRE><FONT SIZE='+1'>Cisto <B><FONT COLOR='#3F3FFF'>KLAVESNICOVE</FONT></B> ovladanie</FONT><BR> </PRE></LAYER><PRE><CENTER><FONT SIZE='-1'>DOLAVA/DOPRAVA..4,6 ROTACIA..5 DOLE..2</CENTER><CENTER><FORM NAME='TetriScript'><HR><INPUT TYPE='text' NAME='LINE' SIZE=15 VALUE ='VYBER SI UROVEN'> START/RESET .. STLAC S !!! <INPUT TYPE='text' NAME='PTS' SIZE=15 VALUE ='LEVEL L KLAVES!'></FORM></CENTER></PRE>") }else{ document.write('<FORM NAME="TetriScript"><HR><CENTER><INPUT TYPE="button" VALUE=" LEFT " ONCLICK="LeftClick()"><INPUT TYPE="button" VALUE=" ROTATE " ONCLICK="RotateClick()"><INPUT TYPE="button" VALUE=" RIGHT " ONCLICK="RightClick()"></CENTER><CENTER><INPUT TYPE="button" VALUE=" DOWN " ONCLICK="DownCheck()"></CENTER><PRE><CENTER><INPUT TYPE="text" NAME="LINE" SIZE=15 VALUE ="SELECT LEVEL"> <INPUT TYPE="button" VALUE="START / RESET" ONCLICK="start()"> <INPUT TYPE="text" NAME="PTS" SIZE=15 VALUE ="CLICK ROTATE "></CENTER></PRE></FORM>') }}else{ document.write('<FORM NAME="TetriScript"><HR><CENTER><INPUT TYPE="button" VALUE=" LEFT " ONCLICK="LeftClick()"><INPUT TYPE="button" VALUE=" ROTATE " ONCLICK="RotateClick()"><INPUT TYPE="button" VALUE=" RIGHT " ONCLICK="RightClick()"></CENTER><CENTER><INPUT TYPE="button" VALUE=" DOWN " ONCLICK="DownCheck()"></CENTER><PRE><CENTER><INPUT TYPE="text" NAME="LINE" SIZE=15 VALUE ="SELECT LEVEL"> <INPUT TYPE="button" VALUE="START / RESET" ONCLICK="start()"> <INPUT TYPE="text" NAME="PTS" SIZE=15 VALUE ="CLICK ROTATE "></CENTER></PRE></FORM>') } //--> </SCRIPT> <CENTER><A HREF="javascript:history.back()">Navrat</a> / <a href="priklady-english.html">BACK</A></CENTER> </BODY> </HTML>
[ Navrat / BACK ]