»
EnglishFrenchVietnamese

Print - Crazy Balls - JavaScriptBank.com

Full version: jsB@nk » Game » Skill » Crazy Balls
URL: https://www.javascriptbank.com/crazy-balls-index.html

Crazy Balls © JavaScriptBank.comCrazy Balls is a fun little JavaScript. The instructions are simple, do not be destroyed by the smaller balls.

Full version: jsB@nk » Game » Skill » Crazy Balls
URL: https://www.javascriptbank.com/crazy-balls-index.html



JavaScript
<SCRIPT language=JavaScript type=text/javascript>var vel=15 /* ogni qanti millisec il ciclo si ripete */var hitDist=8 /* determina il raggio entro il quale si è colpiti*/ var angL=1;var angT=1;var TotPalle=4 /*Numero tot di palle avversarie*/var valAng = 500 /* ogni quanti cicli cambio vel e angolo */var numpalle=1; var turno=1; /*contatore per il punteggio e l`angolazione */var xturno=1; /*contatore per ingresso di nuove palle ogni 800 xturni*/var liv=4 /* determina di qunto velocemente si muove la palla grande*/var cambioang=1; /* contatore per il cambio angolazione */var stepL = new Array(1,1,1,1);/* step di ogni palla*/var stepT = new Array(1,1,1,1);/* step di ogni palla*/var colpito = "no"function gioca(){for (i=0; i<numpalle; i++){palla=document.images[i].style;/* controllo che la palla resti nel quadrato */if ( palla.posLeft+(stepL[i]*angL) >= 392 )       {stepL[i]=stepL[i]*(-1)}else if ( palla.posLeft+(stepL[i]*angL) <= 203 )       {stepL[i]=stepL[i]*(-1)}else if ( palla.posTop+(stepT[i]*angT) <= 103 )       {stepT[i]=stepT[i]*(-1)}else if ( palla.posTop+(stepT[i]*angT) >= 292 )       {stepT[i]=stepT[i]*(-1)}else palla.posLeft = palla.posLeft+(stepL[i]*angL); palla.posTop = palla.posTop+(stepT[i]*angT) var Bigball = document.images[TotPalle].style var xLeft= Bigball.posLeft-palla.posLeft var xTop = Bigball.posTop-palla.posTop if (xLeft<0){xLeft=xLeft*(-1)}; if (xTop<0){xTop=xTop*(-1)} if ( (xTop <= hitDist) && (xLeft <= hitDist) ){azzera()return true}} /* fine ciclo for */if ( cambioang == valAng - 50 ) {document.images[TotPalle+6].style.zIndex=3}if ( cambioang == 2 ) {document.images[TotPalle+6].style.zIndex=1}if (cambioang == valAng){angL=AngCasuale()angT=AngCasuale()cambioang=0}if (xturno == 600 && numpalle < TotPalle){numpalle++xturno = 1inizializza(numpalle)/*porto la nuova palla in gioco*/}if (numpalle < TotPalle) {scoreform.xturno.value = 600-xturno}if ( turno == 30000 ){return true}scoreform.score.value = turnoturno++xturno++cambioang++window.setTimeout("gioca()",vel)}/* end funz gioca */function AngCasuale(){var x=  Math.random()x = x.toString()x = x.substr(2,1)if(x=="0" || x== "1" || x== "2" || x== "3"){x=1}else if ( x== "4" || x== "5" || x== "6" || x=="7" ){x=2}else if ( x== "8" || x== "9" ){x=3}return x}function azzera(){alert("you have lost!")turno=0xturno=0cambioang=0numpalle=1angL=1; angT=1palla=document.images[0].style;palla.posLeft=220palla.posTop=120for ( i=1; i<TotPalle; i++ ) { var dist = 20*i;  document.images[i].style.posLeft=200+dist; document.images[i].style.posTop=80; }}  function inizializza(nPalla){nPalla=nPalla-1var x = AngCasuale()x=x*30document.images[nPalla].style.posLeft=220+xdocument.images[nPalla].style.posTop=110}function moveBall(n){  var ball = document.images[n].styleif ( window.event.y > ball.posTop && ball.posTop <= 284 )   { ball.posTop = ball.posTop+liv  } else if (window.event.y < ball.posTop && ball.posTop >= 110 )    { ball.posTop = ball.posTop-liv  } if ( window.event.x > ball.posLeft && ball.posLeft <= 320 )   { ball.posLeft = ball.posLeft+liv  } else if (window.event.x < ball.posLeft && ball.posLeft >= 280 )    { ball.posLeft = ball.posLeft-liv  }}function advise(){alert("you have to play from the internet site http://de.geocities.com/freedbase/index.html if you want to save the results")}</SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<BODY onmousemove=moveBall(TotPalle)><DIV style="Z-INDEX: 5; LEFT: 10px; COLOR: white; POSITION: absolute; TOP: 10px">Are you ready for CRAZY BALLS Ver.02?</DIV><IMG id=ball0 style="Z-INDEX: 2; LEFT: 320px; WIDTH: 9px; POSITION: absolute; TOP: 110px; HEIGHT: 9px" src="ball.jpg"> <IMG id=ball1 style="Z-INDEX: 2; LEFT: 200px; WIDTH: 9px; POSITION: absolute; TOP: 80px; HEIGHT: 9px" src="ball.jpg"> <IMG id=ball2 style="Z-INDEX: 2; LEFT: 220px; WIDTH: 9px; POSITION: absolute; TOP: 80px; HEIGHT: 9px" src="ball.jpg"> <IMG id=ball3 style="Z-INDEX: 2; LEFT: 240px; WIDTH: 9px; POSITION: absolute; TOP: 80px; HEIGHT: 9px" src="ball.jpg"> <IMG id=BigBall style="Z-INDEX: 2; LEFT: 300px; WIDTH: 13px; POSITION: absolute; TOP: 200px; HEIGHT: 13px" src="ball.jpg"> <IMG id=tavola style="Z-INDEX: 1; LEFT: 200px; WIDTH: 200px; POSITION: absolute; TOP: 100px; HEIGHT: 200px" src="tavola.gif"> <IMG id=bordit0 style="Z-INDEX: 1; LEFT: 200px; WIDTH: 200px; POSITION: absolute; TOP: 100px; HEIGHT: 5px" src="barraOr.gif"> <IMG id=bordit1 style="Z-INDEX: 1; LEFT: 200px; WIDTH: 200px; POSITION: absolute; TOP: 300px; HEIGHT: 5px" src="barraOr.gif"> <IMG id=bordit2 style="Z-INDEX: 1; LEFT: 200px; WIDTH: 5px; POSITION: absolute; TOP: 100px; HEIGHT: 200px" src="barraVer.gif"> <IMG id=bordit3 style="Z-INDEX: 1; LEFT: 400px; WIDTH: 5px; POSITION: absolute; TOP: 100px; HEIGHT: 205px" src="barraVer.gif"> <IMG id=light style="Z-INDEX: 1; LEFT: 410px; POSITION: absolute; TOP: 200px" src="light.jpg" width="101" height="101"> <IMG id=table2 style="Z-INDEX: 2; LEFT: 410px; POSITION: absolute; TOP: 200px" src="tavola2.gif" width="100" height="100"> <FORM name=scoreform><DIV style="Z-INDEX: 5; LEFT: 10px; COLOR: white; POSITION: absolute; TOP: 100px">your points:</DIV><INPUT style="Z-INDEX: 3; LEFT: 10px; POSITION: absolute; TOP: 120px" readOnly size=10 name=score> <INPUT style="Z-INDEX: 3; LEFT: 10px; POSITION: absolute; TOP: 150px" onclick=gioca() type=button value=Start> <DIV style="FONT-WEIGHT: normal; FONT-SIZE: 15px; LEFT: 10px; COLOR: white; LINE-HEIGHT: normal; FONT-STYLE: normal; POSITION: absolute; TOP: 193px; FONT-VARIANT: normal">New ball entry: countdown</DIV><INPUT style="LEFT: 10px; POSITION: absolute; TOP: 210px" name=xturno size="20"> </FORM><FORM onsubmit="return advise()" encType=multipart/form-data><INPUT style="LEFT: 410px; POSITION: absolute; TOP: 10px" maxLength=6 size=10 name=xPoints=> <INPUT style="LEFT: 410px; POSITION: absolute; TOP: 40px" maxLength=10 size=10 value=public name=xGroup=> <INPUT style="LEFT: 410px; POSITION: absolute; TOP: 70px" maxLength=10 size=10 name=xPlayer=> <INPUT style="Z-INDEX: 3; LEFT: 410px; POSITION: absolute; TOP: 100px" type=submit value="save scores"> <DIV style="FONT-WEIGHT: normal; FONT-SIZE: 15px; LEFT: 510px; COLOR: white; LINE-HEIGHT: normal; FONT-STYLE: normal; POSITION: absolute; TOP: 15px; FONT-VARIANT: normal">Points</DIV><DIV style="FONT-WEIGHT: normal; FONT-SIZE: 15px; LEFT: 510px; COLOR: white; LINE-HEIGHT: normal; FONT-STYLE: normal; POSITION: absolute; TOP: 45px; FONT-VARIANT: normal">Group</DIV><DIV style="FONT-WEIGHT: normal; FONT-SIZE: 15px; LEFT: 510px; COLOR: white; LINE-HEIGHT: normal; FONT-STYLE: normal; POSITION: absolute; TOP: 75px; FONT-VARIANT: normal">Player Name</DIV></FORM><DIV style="FONT-WEIGHT: normal; FONT-SIZE: 15px; Z-INDEX: 1; LEFT: 10px; COLOR: white; LINE-HEIGHT: normal; FONT-STYLE: normal; POSITION: absolute; TOP: 260px; FONT-VARIANT: normal">by</DIV><A style="FONT-WEIGHT: normal; FONT-SIZE: 15px; Z-INDEX: 1; LEFT: 10px; COLOR: white; LINE-HEIGHT: normal; FONT-STYLE: normal; POSITION: absolute; TOP: 280px; FONT-VARIANT: normal" href="http://de.geocities.com/freedbase/index.html"><I>Stefano Molinari</I></A> <DIV style="Z-INDEX: 1; LEFT: 10px; POSITION: absolute; TOP: 320px">Crazy Balls is a fun little JavaScript. The instructions are simple, don&#39;t be destroyed by the smaller balls. </DIV><DIV>You can save your results if you play from the internet site <A href="http://de.geocities.com/freedbase/index.html"><B>FreeDbase</B></A>...<br>it is free, you do not need any registration if you leave the GROUP=public <br>Or you can register at <B>FreeDbase</B> and create your own group (free)</DIV></FORM></BODY><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


Files
http://javascriptbank.com/javascript/game/Crazy_Balls/ball.jpghttp://javascriptbank.com/javascript/game/Crazy_Balls/light.jpghttp://javascriptbank.com/javascript/game/Crazy_Balls/barraOr.gifhttp://javascriptbank.com/javascript/game/Crazy_Balls/barraVer.gifhttp://javascriptbank.com/javascript/game/Crazy_Balls/tavola.gifhttp://javascriptbank.com/javascript/game/Crazy_Balls/tavola2.gif