Единый форум поддержки

Информация о пользователе

Привет, Гость! Войдите или зарегистрируйтесь.


Вы здесь » Единый форум поддержки » Корзина » Игры для форумов!


Игры для форумов!

Сообщений 1 страница 14 из 14

1

Крестики, нолики:

Код:
<html>

<head>
<meta content="text/html; charset=windows-1251" http-equiv="Content-Type">
<!-- TWO STEPS TO INSTALL TIC-TAC-TOE:

  1.  Copy the coding into the HEAD of your HTML document
  2.  Add the last code into the BODY of your HTML document  -->
<!-- STEP ONE: Paste this code into the HEAD of your HTML document  -->
<script language="JavaScript">
<!-- Original:  Maximilian Stocker (maxstocker@reallyusefulcomputing.com) -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
var x = "x.gif";
// Location of where you uploaded your site's x.jpg image

var o = "o.gif";
// Location of where you uploaded your site's o.jpg image

var blank = "blank.jpg";
// Location of where you uploaded your site's blank.jpg image

var pause = 0;
var all = 0;
var a = 0;
var b = 0;
var c = 0;
var d = 0;
var e = 0;
var f = 0;
var g = 0;
var h = 0;
var i = 0;
var temp="";
var ok = 0;
var cf = 0;
var choice=9;
var aRandomNumber = 0;
var comp = 0; 
var t = 0;
var wn = 0;
var ls = 0;
var ts = 0;
function help() {
alert("Welcome to Tic-Tac-Toe!  You play as the X's and the computer is the O's.  Select the square you want to put your X into by clicking them.  You cannot occupy a square that is already occupied. The first player to get three squares in a row wins.  Good Luck!!")
}
function logicOne() {
if ((a==1)&&(b==1)&&(c==1)) all=1;
if ((a==1)&&(d==1)&&(g==1)) all=1;
if ((a==1)&&(e==1)&&(i==1)) all=1;
if ((b==1)&&(e==1)&&(h==1)) all=1;
if ((d==1)&&(e==1)&&(f==1)) all=1;
if ((g==1)&&(h==1)&&(i==1)) all=1;
if ((c==1)&&(f==1)&&(i==1)) all=1;
if ((g==1)&&(e==1)&&(c==1)) all=1;
if ((a==2)&&(b==2)&&(c==2)) all=2;
if ((a==2)&&(d==2)&&(g==2)) all=2;
if ((a==2)&&(e==2)&&(i==2)) all=2;
if ((b==2)&&(e==2)&&(h==2)) all=2;
if ((d==2)&&(e==2)&&(f==2)) all=2;
if ((g==2)&&(h==2)&&(i==2)) all=2;
if ((c==2)&&(f==2)&&(i==2)) all=2;
if ((g==2)&&(e==2)&&(c==2)) all=2;
if ((a != 0)&&(b != 0)&&(c != 0)&&(d != 0)&&(e != 0)&&(f != 0)&&(g != 0)&&(h != 0)&&(i != 0)&&(all == 0)) all = 3;
} 
function logicTwo() {
if ((a==2)&&(b==2)&&(c== 0)&&(temp=="")) temp="C";
if ((a==2)&&(b== 0)&&(c==2)&&(temp=="")) temp="B";
if ((a== 0)&&(b==2)&&(c==2)&&(temp=="")) temp="A";
if ((a==2)&&(d==2)&&(g== 0)&&(temp=="")) temp="G";
if ((a==2)&&(d== 0)&&(g==2)&&(temp=="")) temp="D";
if ((a== 0)&&(d==2)&&(g==2)&&(temp=="")) temp="A";
if ((a==2)&&(e==2)&&(i== 0)&&(temp=="")) temp="I";
if ((a==2)&&(e== 0)&&(i==2)&&(temp=="")) temp="E";
if ((a== 0)&&(e==2)&&(i==2)&&(temp=="")) temp="A";
if ((b==2)&&(e==2)&&(h== 0)&&(temp=="")) temp="H";
if ((b==2)&&(e== 0)&&(h==2)&&(temp=="")) temp="E";
if ((b== 0)&&(e==2)&&(h==2)&&(temp=="")) temp="B";
if ((d==2)&&(e==2)&&(f== 0)&&(temp=="")) temp="F";
if ((d==2)&&(e== 0)&&(f==2)&&(temp=="")) temp="E";
if ((d== 0)&&(e==2)&&(f==2)&&(temp=="")) temp="D";
if ((g==2)&&(h==2)&&(i== 0)&&(temp=="")) temp="I";
if ((g==2)&&(h== 0)&&(i==2)&&(temp=="")) temp="H";
if ((g== 0)&&(h==2)&&(i==2)&&(temp=="")) temp="G";
if ((c==2)&&(f==2)&&(i== 0)&&(temp=="")) temp="I";
if ((c==2)&&(f== 0)&&(i==2)&&(temp=="")) temp="F";
if ((c== 0)&&(f==2)&&(i==2)&&(temp=="")) temp="C";
if ((g==2)&&(e==2)&&(c== 0)&&(temp=="")) temp="C";
if ((g==2)&&(e== 0)&&(c==2)&&(temp=="")) temp="E";
if ((g== 0)&&(e==2)&&(c==2)&&(temp=="")) temp="G";
}
function logicThree() {
if ((a==1)&&(b==1)&&(c==0)&&(temp=="")) temp="C";
if ((a==1)&&(b==0)&&(c==1)&&(temp=="")) temp="B";
if ((a==0)&&(b==1)&&(c==1)&&(temp=="")) temp="A";
if ((a==1)&&(d==1)&&(g==0)&&(temp=="")) temp="G";
if ((a==1)&&(d==0)&&(g==1)&&(temp=="")) temp="D";
if ((a==0)&&(d==1)&&(g==1)&&(temp=="")) temp="A";
if ((a==1)&&(e==1)&&(i==0)&&(temp=="")) temp="I";
if ((a==1)&&(e==0)&&(i==1)&&(temp=="")) temp="E";
if ((a==0)&&(e==1)&&(i==1)&&(temp=="")) temp="A";
if ((b==1)&&(e==1)&&(h==0)&&(temp=="")) temp="H";
if ((b==1)&&(e==0)&&(h==1)&&(temp=="")) temp="E";
if ((b==0)&&(e==1)&&(h==1)&&(temp=="")) temp="B";
if ((d==1)&&(e==1)&&(f==0)&&(temp=="")) temp="F";
if ((d==1)&&(e==0)&&(f==1)&&(temp=="")) temp="E";
if ((d==0)&&(e==1)&&(f==1)&&(temp=="")) temp="D";
if ((g==1)&&(h==1)&&(i==0)&&(temp=="")) temp="I";
if ((g==1)&&(h==0)&&(i==1)&&(temp=="")) temp="H";
if ((g==0)&&(h==1)&&(i==1)&&(temp=="")) temp="G";
if ((c==1)&&(f==1)&&(i==0)&&(temp=="")) temp="I";
if ((c==1)&&(f==0)&&(i==1)&&(temp=="")) temp="F";
if ((c==0)&&(f==1)&&(i==1)&&(temp=="")) temp="C";
if ((g==1)&&(e==1)&&(c==0)&&(temp=="")) temp="C";
if ((g==1)&&(e==0)&&(c==1)&&(temp=="")) temp="E";
if ((g==0)&&(e==1)&&(c==1)&&(temp=="")) temp="G";
}
function clearOut() {
document.game.you.value="0";
document.game.computer.value="0";
document.game.ties.value="0";
}
function checkSpace() {
if ((temp=="A")&&(a==0)) {
ok=1;
if (cf==0) a=1;
if (cf==1) a=2;
}
if ((temp=="B")&&(b==0)) {
ok=1;
if (cf==0) b=1;
if (cf==1) b=2;
}
if ((temp=="C")&&(c==0)) {
ok=1;
if (cf==0) c=1;
if (cf==1) c=2;
}
if ((temp=="D")&&(d==0)) {
ok=1;
if (cf==0) d=1;
if (cf==1) d=2;
}
if ((temp=="E")&&(e==0)) {
ok=1;
if (cf==0) e=1;
if (cf==1) e=2;
}
if ((temp=="F")&&(f==0)) {
ok=1
if (cf==0) f=1;
if (cf==1) f=2;
}
if ((temp=="G")&&(g==0)) {
ok=1
if (cf==0) g=1;
if (cf==1) g=2;
}
if ((temp=="H")&&(h==0)) {
ok=1;
if (cf==0) h=1;
if (cf==1) h=2;
}
if ((temp=="I")&&(i==0)) {
ok=1;
if (cf==0) i=1; 
if (cf==1) i=2; 
}
}
function yourChoice(chName) {
pause = 0;
if (all!=0) ended();
if (all==0) {
cf = 0;
ok = 0;
temp=chName;
checkSpace();
if (ok==1) {
document.images[chName].src = x;
}
if (ok==0)taken();
process();
if ((all==0)&&(pause==0)) myChoice();
   }
}
function taken() {
alert("Эта клетка занята!")
pause=1;
}
function myChoice() {
temp="";
ok = 0;
cf=1;
logicTwo();
logicThree();
checkSpace();
while(ok==0) {
aRandomNumber=Math.random()
comp=Math.round((choice-1)*aRandomNumber)+1;
if (comp==1) temp="A";
if (comp==2) temp="B";
if (comp==3) temp="C";
if (comp==4) temp="D";
if (comp==5) temp="E";
if (comp==6) temp="F";
if (comp==7) temp="G";
if (comp==8) temp="H";
if (comp==9) temp="I";
checkSpace();
}
document.images[temp].src= o;
process();
}
function ended() {
alert("Игры закончена ! Чтобы сыграть ещё нажмите кнопку (Новая Игра)")
}
function process() {
logicOne();
if (all==1){ alert("Вы выграли!"); wn++; }
if (all==2){ alert("Я выиграл!"); ls++; }
if (all==3){ alert("Ничья..."); ts++; }
if (all!=0) {
document.game.you.value = wn;
document.game.computer.value = ls;
document.game.ties.value = ts;
   }
}
function playAgain() {
if (all==0) {
if(confirm("Вы уверены ?")) reset();
}
if (all>0) reset();
}
function reset() {
all = 0;
a = 0;
b = 0;
c = 0;
d = 0;
e = 0;
f = 0;
g = 0;
h = 0;
i = 0;
temp="";
ok = 0;
cf = 0;
choice=9;
aRandomNumber = 0;
comp = 0;
document.images.A.src= blank;
document.images.B.src= blank;
document.images.C.src= blank;
document.images.D.src= blank;
document.images.E.src= blank;
document.images.F.src= blank;
document.images.G.src= blank;
document.images.H.src= blank;
document.images.I.src= blank;
if (t==0) { t=2; myChoice(); }
t--;
}




var ie4 = (document.all) ? true : false;
var nn4 = (document.layers) ? true : false;

//  End -->
</script>

<meta content="Microsoft FrontPage 3.0" name="GENERATOR">
<title></title>
</head>

<body bgColor="#ffffff">

<p><br>
</p>

<form name="game">
  <div align="center"><center><table border="0">
<TBODY>
    <tr>
      <td><table border="1" borderColor="#000000" cellPadding="0" cellSpacing="0">
<TBODY>
        <tr>
          <td><a href="javascript:yourChoice('A')"><img border="0" height="61" name="A"
          src="blank.jpg" width="56"></a></td>
          <td><a href="javascript:yourChoice('B')"><img border="0" height="61" name="B"
          src="blank.jpg" width="56"></a></td>
          <td><a href="javascript:yourChoice('C')"><img border="0" height="61" name="C"
          src="blank.jpg" width="56"></a></td>
        </tr>
        <tr>
          <td><a href="javascript:yourChoice('D')"><img border="0" height="61" name="D"
          src="blank.jpg" width="56"></a></td>
          <td><a href="javascript:yourChoice('E')"><img border="0" height="61" name="E"
          src="blank.jpg" width="56"></a></td>
          <td><a href="javascript:yourChoice('F')"><img border="0" height="61" name="F"
          src="blank.jpg" width="56"></a></td>
        </tr>
        <tr>
          <td><a href="javascript:yourChoice('G')"><img border="0" height="61" name="G"
          src="blank.jpg" width="56"></a></td>
          <td><a href="javascript:yourChoice('H')"><img border="0" height="61" name="H"
          src="blank.jpg" width="56"></a></td>
          <td><a href="javascript:yourChoice('I')"><img border="0" height="61" name="I"
          src="blank.jpg" width="56"></a></td>
        </tr>
</TBODY>
      </table>
      </td>
      <td><table>
<TBODY>
        <tr colspan="2">
          <td><font face="MS Sans Serif" size="1"><b>Счет:</b></font></td>
        </tr>
        <tr>
          <td><font face="MS Sans Serif" size="1"><input name="you" size="5"
          style="font-family: MS Sans Serif; font-size: 1"></font></td>
          <td><font face="MS Sans Serif" size="1">Вы</font></td>
        </tr>
        <tr>
          <td><font face="MS Sans Serif" size="1"><input name="computer" size="5"
          style="font-family: MS Sans Serif; font-size: 1"></font></td>
          <td><font face="MS Sans Serif" size="1">Компьютер</font></td>
        </tr>
        <tr>
          <td><font face="MS Sans Serif" size="1"><input name="ties" size="5"
          style="font-family: MS Sans Serif; font-size: 1"></font></td>
          <td><font face="MS Sans Serif" size="1">Ничья</font></td>
        </tr>
</TBODY>
      </table>
      </td>
    </tr>
</TBODY>
  </table>
  </center></div><div align="center"><center><p><input onclick="playAgain();" type="button"
  value="Новая Игра"
  style="font-family: MS Sans Serif; font-size: 1; font-weight: bold"> </p>
  </center></div>
</form>
</body>
</html>

Русская рулетка:

Код:
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=windows-1251">
 <Style>
   A:Link{ Color: #000000; Text-decoration: underline}
   A:Visited{ Color: #000000; Text-decoration: underline}
   A:Hover{ Color: #000000; Text-decoration: none}
 td, body {font-family: verdana, arial, helvetica; font-size:11px;}  
 </Style>

<!-- HEAD START HERE -->



<!-- HEAD END HERE -->




</head>
<body bgcolor="#EDEDED" text="#000000" link="#000000" topmargin="0" leftmargin="0">
<center>

<!-- BODY START HERE -->

<p align="center"><strong>Русская рулетка(для двоих)</strong></p>
<p align="center">
<script language="JavaScript">
<!--
counter="0";
turn="0";
a=new Date();
asecs=a.getSeconds();
if (asecs<=9) bullet=4;
else if (asecs<=19) bullet=3;
else if (asecs<=29) bullet=5;
else if (asecs<=39) bullet=1;
else if (asecs<=49) bullet=6;
else if (asecs<=59) bullet=2;
if (asecs%2=="0") turn="1";
function func(){
if (asecs%2=="0") 
{
window.alert(document.forms[0].player1.value + ", сейчас ваша очередь!!!");
}
else {
window.alert(document.forms[0].player2.value + ", а теперь ваша!!!");
}
}
function roulette(){
counter++;
if (turn%2==0)
{
playername = document.forms[0].player1.value;
}
else {
playername = document.forms[0].player2.value;
}
if (counter==bullet) 
{
window.alert("ПАХ ! Вы умерли !");
window.close();
}
else {
window.alert("Щёлк..пронесло !!!");
window.alert("Вы следующий, " + playername);
}
turn++;
}
// -->
</script>
</a></p>
<p align="center">Давайте поиграем в
"Русскую рулетку"!</p>
<p align="center"><font color="#FF0000" size="5">Инструкции:</font></p>
<p align="left">1. Введите имена игроков<br>
2. Щелкните кнопку "Начать
игру".    <br>
3. Нажать кнопу "Пли!".</p>
<pre>
</pre>
<form>
<p>Введите имя игрока 1: <input type="text" size="20" name="player1" value="Игрок 1"><br>
Введите имя игрока 2: <input type="text" size="20" name="player2" value="Игрок 2"></p>
<div align="center"><center><table border="0" cellpadding="" cellspacing="5">
<tr><td width="100"><input style="color: #00ff99; background-color: #000000; border-color: #00cc00;" type="button" value="  Начать игру " onclick="func()"></td>
<td width="100" bgcolor="#C0C0C0"><input style="color: #00ff99; background-color: #000000; border-color: #00cc00;" type="button" value="   Пли!    " onclick="roulette()"></td>
</tr></table></center></div></form>

<!-- BODY END HERE -->



</body>
</html>

Пятнажки:

Код:
<BODY bgcolor=#333399>
<center>
<font color=#fffccc size=3 face=verdana>Пятнашки
<p>
<APPLET code="game15.class" width=300 height=205>
<PARAM name="cell"  value="40">
<PARAM name="font"  value="25">
<PARAM name="sound" value="click.au">
<PARAM name="tics"  value="3">
</APPLET>

Теннис:

Код:
<HTML>
<HEAD>
 <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1251">
<script language="JavaScript">
<!--

var timerID = null
var INT = 10
var loadFLG=0
var gameFLG=0
var missFLG=0
var tim = 0                                    //time
var blcol = new Array(5)                       //block color
var blsta = new Array(40)                      //block status
var blclr = 0                                  //clear block
var ballX = 0                                  //ball data
var ballY = 0
var ballN = 3
var ballDX= 0
var ballDY= 0
var tmpRL = 193
var keyP=0
var keyPr=0
var endFLG=0

blcol[0]="#FFFF00"
blcol[1]="#FFB000"
blcol[2]="#FF8000"
blcol[3]="#FF4000"
blcol[4]="#FF0000"
blcol[5]="#000000"

var ieFLG=0
var n4FLG=0
if (document.all){
 ieFLG=1
}else{
 if (document.getElementById){
  n4FLG=0
 }else{
  n4FLG=1
 }
}


//-----------------------------------------
//------------- main function -------------
//-----------------------------------------


function mainF(){

 clearTimeout(timerID)
 tim=tim+1
 with (Math){tmptim=floor(tim/10)}
 tmptc=""
 tmptb=tim/10
 if (tim==tmptim*10){tmptc=".0"}
 ballX=ballX+ballDX
 ballY=ballY+ballDY
 outCHK()
 blkCHK()
 if (document.getElementById){

  document.SC.TM.value=tmptb+tmptc
  document.SC.CL.value=blclr
  document.SC.SR.value=blclr*200-tim
  document.getElementById("ball").style.top =  ballY
  document.getElementById("ball").style.left = ballX
 }else{
  if (ieFLG==1){
   document.SC.TM.value=tmptb+tmptc
   document.SC.CL.value=blclr
   document.SC.SR.value=blclr*200-tim
   ball.style.posTop = ballY
   ball.style.posLeft = ballX
  }else{
   document.layers["info"].document.forms[0].TM.value=tmptb+tmptc
   document.layers["info"].document.forms[0].CL.value=blclr
   document.layers["info"].document.forms[0].SR.value=blclr*200-tim
   document.layers["ball"].moveTo(ballX,ballY)
  }
 }
 racketMove()
 if (gameFLG==1){timerID = setTimeout("mainF()",INT)}
}


//-----------------------------------------
//------------- sub functions -------------
//-----------------------------------------

//game init

function initG(){
  keyP=0
 if (endFLG == 0){
endFLG=1
  blclr=0
  tim=0
  ballN=3
  with (Math){tmptim=floor(tim/10)}
  if (document.getElementById){
   document.SC.TM.value=tmptim
   document.getElementById("ovrmes").style.top=-1000
   document.getElementById("clrmes").style.top=-1000
  }else{
   if (ieFLG==1){
    document.SC.TM.value=tmptim
    clrmes.style.top=-1000
    ovrmes.style.top=-1000
   }else{
    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++){
   tmpIDn=ib*8+ia+1
   if (document.getElementById){
    document.getElementById(tmpIDn).style.backgroundColor = blcol[ib]
   }else{
    if (ieFLG==1){
     document.all(tmpIDn+9).style.backgroundColor = blcol[ib]
    }else{
     document.layers[tmpIDn].bgColor=blcol[ib]
    }
   }
   blsta[ib*8+ia]=ib
  }}
 }
 if (document.getElementById){
  document.SC.BL.value=ballN
  document.getElementById("starter").style.top=-1000
 }else{
  if (ieFLG==1){
   document.SC.BL.value=ballN
   starter.style.top=-1000
  }else{
   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 keyDown(DnEvents){


 if (ieFLG==0){
  k=DnEvents.which
 }else{
  k=window.event.keyCode
 }

  if (k == 39){keyP=5}                         //Cursor Right
  if (k == 76){keyP=5}                        //cursor right

  if (k == 37){keyP=-5}                        //Cursor Left
  if (k == 74){keyP=-5}                       //cursor left

  if (k == 32){if (gameFLG==0){initG()}}       //Space
  if (k == 80){if (gameFLG==0){initG()}}      //space
}


function keyUp(UpEvents){

 if (ieFLG==0){
  k=UpEvents.which
 }else{
  k=window.event.keyCode
 }
  if (k == 39){keyP=0}                   //6
  if (k == 37 ){keyP=0}                   //4
  if (k == 76){keyP=0}                   //6
  if (k == 74 ){keyP=0}                   //4
}


//racket move

function racketMove(){

 if (loadFLG==1){
  if (keyP != 0){
   tmpkeyP=keyP*keyPr
   if (tmpkeyP>=0){
    if (keyPr != 0){
     if (Math.abs(keyPr)<15){keyPr=keyPr*1.2}
    }else{
     keyPr=keyP
    }
   }else{
   keyPr=keyP
   }
  }else{
   keyPr=0
  }
  tmpRL=tmpRL+keyPr
  if (tmpRL<16){tmpRL=16}
  if (tmpRL>370){tmpRL=370}
  if (document.getElementById){
   document.getElementById("racket").style.left=tmpRL
  }else{
   if (ieFLG==1){
    racket.style.left=tmpRL
   }else{
    document.layers["racket"].left=tmpRL
   }
  }
 }
}

//wall and racket check

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()}
  }
 }
}

//block check

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
   tmpIDnc=ic+1
   if (document.getElementById){
    document.getElementById(tmpIDnc).style.backgroundColor = blcol[tmpbc]
   }else{
    if (ieFLG==1){
     document.all(tmpIDnc+9).style.backgroundColor = blcol[tmpbc]
    }else{
     document.layers[tmpIDnc].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
     }
    }
   }

  }
 }}}}
}

//game end

function gameEnd(){
 gameFLG=0
 loadFLG=0
 if (document.getElementById){
  document.SC.BL.value=ballN
  document.getElementById("starter").style.top=200
  if (blclr >= 40){
   document.getElementById("clrmes").style.top=150
   endFLG=0
  }
  if (ballN <= 0){
   document.getElementById("ovrmes").style.top=160
   endFLG=0
  }
 }else{
  if (ieFLG==1){
   document.SC.BL.value=ballN
   starter.style.top=200
   if (blclr >= 40){
    clrmes.style.top=150
    endFLG=0
   }
   if (ballN <= 0){
    ovrmes.style.top=160
    endFLG=0
   }
  }else{
   document.layers["info"].document.forms[0].BL.value=ballN
   document.layers["starter"].visibility="SHOW"
   if (blclr >= 40){
    document.layers["clrmes"].visibility="SHOW"
    endFLG=0
   }
   if (ballN <= 0){
    document.layers["ovrmes"].visibility="SHOW"
    endFLG=0
   }
  }
 }
}

//Event init

function onLD(){
 document.onkeydown = keyDown
 document.onkeyup = keyUp

 if (document.getElementById){
  document.getElementById("starter").style.top=200
  document.getElementById("info").style.top=16
 }else{
  if (ieFLG==1){
   starter.style.top=200
   info.style.top=16
  }else{
   document.layers["starter"].visibility="SHOW"
  }
 }
 if (n4FLG!=0){document.captureEvents(Event.KEYDOWN|Event.KEYUP)}
}




var ie4 = (document.all) ? true : false;
var nn4 = (document.layers) ? true : false;

//-->
</script>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#7F007F" ALINK="#FF0000" onload="onLD()" ?>
<a name="t0"><div id="gamewindow"
style="BACKGROUND-COLOR: #000000; HEIGHT: 300px; LEFT: 16px; POSITION: absolute; TOP: 16px; WIDTH: 394px"><LAYER BGCOLOR="#000000" CLIP="0,0,393,299">
</LAYER>
</div><script
language="JavaScript">
<!--
//block layer write

for (ib=0; ib<5; ib++){
 for (ia=0; ia<8; ia++){
  tmpL=31+46*ia;tmpT=50+20*ib
  tmpIDn=ib*8+ia+1
  if (n4FLG!=1){
   document.write("<DIV ID='"+tmpIDn+"' STYLE='position:absolute; background-color:"+blcol[ib]+"; top:"+tmpT+"px; left:"+tmpL+"px; width:42; height:16; clip:rect(0,43,17,0)'></DIV>")
  }else{
   document.write("<LAYER LEFT="+tmpL+" TOP="+tmpT+" CLIP='1,1,43,17' BGCOLOR='"+blcol[ib]+"'></LAYER>")
  }
  blsta[ib*8+ia]=ib
 }
}
//-->
</script>
<div id="ball"
style="HEIGHT: 8px; LEFT: 209px; POSITION: absolute; TOP: 270px; WIDTH: 8px"><div
style="BACKGROUND-COLOR: #b0b0b0; CLIP: rect(0px 3px 7px 0px); HEIGHT: 8px; LEFT: 2px; POSITION: absolute; TOP: 0px; WIDTH: 4px"></div><div
style="BACKGROUND-COLOR: #b0b0b0; CLIP: rect(0px 7px 3px 0px); HEIGHT: 4px; LEFT: 0px; POSITION: absolute; TOP: 2px; WIDTH: 8px"></div><div
style="BACKGROUND-COLOR: #ffffff; CLIP: rect(0px 5px 5px 0px); HEIGHT: 6px; LEFT: 1px; POSITION: absolute; TOP: 1px; WIDTH: 6px"></div></div><div
id="racket"
style="BACKGROUND-COLOR: #b0b0ff; CLIP: rect(0px 39px 3px 0px); HEIGHT: 4px; LEFT: 193px; POSITION: absolute; TOP: 280px; WIDTH: 40px"></div><script
language="JavaScript">
<!--
if (n4FLG==1){
 document.write('<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">')
}else{
 document.write('<DIV ID="info" STYLE="position:absolute; top:-1000px; left:416px">')
}
//-->
</script>


<form name="SC">
  <table border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td><font face="MS Sans Serif" size="1">Попыток: </font></td>
      <td><font face="MS Sans Serif" size="1"><input name="BL" size="5" value="3"
      style="font-family: MS Sans Serif; font-size: 1"></font></td>
    </tr>
    <tr>
      <td><font face="MS Sans Serif" size="1">Время: </font></td>
      <td><font face="MS Sans Serif" size="1"><input name="TM" size="5" value="0"
      style="font-family: MS Sans Serif; font-size: 1"></font></td>
    </tr>
    <tr>
      <td><font face="MS Sans Serif" size="1">БЛОК:</font></td>
      <td><font face="MS Sans Serif" size="1"><input name="CL" size="5" value="0"
      style="font-family: MS Sans Serif; font-size: 1"></font></td>
    </tr>
    <tr>
      <td><font face="MS Sans Serif" size="1">Очки:</font></td>
      <td><font face="MS Sans Serif" size="1"><input name="SR" size="5" value="0"
      style="font-family: MS Sans Serif; font-size: 1"></font></td>
    </tr>
  </table>
</form>
<script language="JavaScript">
<!--
if (n4FLG==1){
 document.write('</LAYER><LAYER NAME="clrmes" TOP=150 LEFT=160 visibility="HIDE">')
}else{
 document.write('</DIV><DIV ID="clrmes" STYLE="position:absolute; top:-1000px; left:160px; visibility:visible">')
}
//-->
</script>
<font size="+1" face="Verdana" color="#44cc44"
style="FONT-SIZE: 24px">

<p>Вы всё очистили!</font> <script language="JavaScript">
<!--
if (n4FLG==1){
 document.write('</LAYER><LAYER NAME="ovrmes" TOP=150 LEFT=160 visibility="HIDE">')
}else{
 document.write('</DIV><DIV ID="ovrmes" STYLE="position:absolute; top:-1000px; left:160px; visibility:visible">')
}
//-->
</script> <font
size="+1" face="Verdana" color="#cc4444" style="FONT-SIZE: 24px">Вы проиграли!</font>
<script language="JavaScript">
<!--
if (n4FLG==1){
 document.write('</LAYER><LAYER NAME="starter" TOP=200 LEFT=180 visibility="HIDE"><FONT COLOR="#FFFFFF">')
}else{
 document.write('</DIV><DIV ID="starter" STYLE="position:absolute; top:-1000px; left:180px; color:#FFFFFF; visibility:visible">')
}
//-->
</script> <font face="MS Sans Serif" size="1">Влево =
Курсор ВЛЕВО<br>
Вправо = Курсор ВПРАВО<br>
Старт = ПРОБЕЛ</font></p>
</BODY>
</HTML>

Простенькая игра:

Код:
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=windows-1251">
 <Style>
   A:Link{ Color: #000000; Text-decoration: underline}
   A:Visited{ Color: #000000; Text-decoration: underline}
   A:Hover{ Color: #000000; Text-decoration: none}
 td, body {font-family: verdana, arial, helvetica; font-size:11px;}  
 </Style>

<!-- HEAD START HERE -->



<!-- HEAD END HERE -->




</head>
<body bgcolor="#EDEDED" text="#000000" link="#000000" topmargin="0" leftmargin="0">
<center>

<!-- BODY START HERE -->

<P align=center><!-- Эта программа была сделана Hiroshi Okada.-->
<SCRIPT language=JavaScript>

// ---- Make array
function MakeArray( n){
    this.length = n;
    for (var i = 1; i <= n; i++) { 
        this[i] = 0 
    }
    return this
}

// ----- poor man's random number
var d0 = new Date();
var r0 = d0.getSeconds();
function poor_rand(){
    d1 = new Date();
    r0 = (r0 * r0 + r0 + d1.getSeconds()) % 3721 ;
    return r0 % width_n;
}

// ---- Parameters of game
var height_n = 8;
var width_n =5;

// ---- state of game
var enemy = new MakeArray( width_n); // enemy positions
var wtime; // wait time
var score; // points
var gameover; // in case of gameover set to true

// ----- Make the battlefield.
document.write( "<FORM NAME='fm1'>");
document.write( "<INPUT TYPE='text' NAME='message' SIZE=20>");
document.write( "</FORM>");
document.write( "<FORM NAME='fm2'><TABLE>");
for( var i=0; i<height_n; i++){
    document.write( "<TR>");
    for( var j=0;j<width_n; j++){
        document.write( "<TD><CENTER><INPUT TYPE='radio'></CENTER></TD>");
    }
    document.write( "</TR>");
}
document.write( "<TR>");
for( var j=0;j<width_n; j++){
    document.write( "<TD><INPUT TYPE='button' VALUE='-x-' onClick='fire("
        + j + ")'></TD>");
}
document.write( "</TR>");
document.write( "</TABLE>");
document.write( "<INPUT TYPE='button' VALUE='СТАРТ' onClick='game_start()'>");
document.write( "</FORM>");

// ----- game main timer event 
// -----     enemy come one step
function come(){
    var n = poor_rand();
    document.fm2.elements[ width_n * enemy[n+1] + n].checked = true;
    enemy[n+1]++;
    if( enemy[n+1] < height_n){
        setTimeout("come()", wtime);
    }else{
      gameover = true;
      document.fm1.message.value =  "ИГРА ОКОНЧЕНА: " + score ;
    }
}

// ----- Fire the n th beam
function fire( n){
    if( gameover ) return;
    for( var i=0; i<enemy[n+1]; i++){ // clear enemy
        document.fm2.elements[ width_n * i + n].checked = false;
    }
    score += enemy[ n+1];
    document.fm1.message.value = "ОЧКИ: " + score;
    enemy[ n+1] = 0;
    if( wtime > 100){ wtime -= 10};
}

// ---- initialize & start game
function game_start(){
   for( var n=0; n<width_n; n++){
        for( var i=0; i<enemy[n+1]; i++){
            document.fm2.elements[ width_n * i + n].checked = false;
        }
        enemy[n+1] = 0;
    }
    wtime = 400;
    score = 0;
    gameover = false;
    document.fm1.message.value = "ОЧКИ: " + score;
    setTimeout("come()", wtime);
}

// -->
</SCRIPT>

<!-- BODY END HERE -->



</body>
</html>

Лабиринт:

Код:
<body BGCOLOR=#333399 onLoad="fillBoard(document.board);update(document.board);">
<p align="center">
<script>

	var line = "";

	var x = 0;

	var y = 0;

	var fill="*";

	var blank = ".";

	var full = "*";



// Functions to create the board



function makeboard() {

	for (var i=1; i<= 10; i++)

this[i] = new makeRow();

return this;

}



function makeRow() {

	for (var i=1; i<= 10; i++)

this[i]=blank;

return this;

}



// Functions to fill & clear the board.



function clearBoard (form) {

	x = 0;

	y = 0;

	form.xval.value = 1;

	form.yval.value = 1;

	for (var i=1; i<= 10; i++)

for (var j=1; j<= 10; j++)

	theBoard[i][j]=blank;

	plot_maze();	

	fillBoard(form);

	return;

}



function fillBoard (form) {

	line = "";

	form.grid.value = "";

	for (var i=1; i<= 10; i++)

for (var j=1; j<= 10; j++)	

	line += theBoard[i][j];

	form.grid.value=line;

}



function update(form) {

	var horiz = eval(form.xval.value);

	var vert = eval(form.yval.value);

	theBoard[vert][horiz] = fill;

	fillBoard(form);

	return;

}



// Functions to handle the cross-hairs

function decx(form) {

	fill = blank;

	update(form);

	checkx = eval(form.xval.value - 1);

	checky = form.yval.value;

	if (form.xval.value > 1) {

if (theBoard[checky][checkx] != "#") {

	form.xval.value=eval(form.xval.value - 1);

}

	else {	

alert("БУМ!\nНе видишь? Стена!!.");	

//linebreak	

	}

	

	if (theBoard[checky][checkx] == "$") {

alert("ВЫ ВЫИГРАЛИ! Намухлевал?");



}	

	}	

	fill = full;

	update(form);

}



function incx(form) {

	fill = blank;

	update(form);

	checkx = eval(1 * form.xval.value + 1);

	checky = form.yval.value;

	if (form.xval.value < 10) {

if (theBoard[checky][checkx] != "#") {

	form.xval.value=eval(1 * form.xval.value + 1);

}

	else {

alert("БУМ!\nНе видишь? Стена.");

	}

	if (theBoard[checky][checkx] == "$") {

alert("ВЫ ВЫИГРАЛИ! Намухлевал?");

}

	}

	fill = full;

	update(form);

}



function decy(form) {

	fill = blank;

	update(form);

	checkx = form.xval.value;

	checky = eval(form.yval.value - 1);

	if (form.yval.value > 1) {

if (theBoard[checky][checkx] != "#") {

	form.yval.value=eval(form.yval.value - 1);

}

	else {

alert("БУМ!\nВы упёрлись в стену.");

}

	if (theBoard[checky][checkx] == "$") {

alert("ВЫ ВЫИГРАЛИ!");

}	

	}	

	fill = full;

	update(form);

}



function incy(form) {

	fill = blank;

	update(form);

	checkx = form.xval.value;

	checky = eval(1 * form.yval.value + 1);

	if (form.yval.value <= 9) {

if (theBoard[checky][checkx] != "#") {

	form.yval.value=eval(1 * form.yval.value + 1);

}

	else {

alert("БУМ!\nВы упёрлись в стену.");

}

	if (theBoard[checky][checkx] == "$") {

alert("ВЫ ВЫИГРАЛИ");

}

	}	

	fill = full;

	update(form);

}



// Various Functions



function no (form) {

	alert("Вы не можете изменить эту величину вручную.\nПожалуйста используйте кнопки.");

	clearBoard(form);

	update(form);

}



function plot_maze() {	

	theBoard[10][1] = "$";
	theBoard[1][2] = "#";
	theBoard[1][6] = "#";
	theBoard[2][2] = "#";
	theBoard[2][4] = "#";
	theBoard[2][6] = "#";
	theBoard[2][8] = "#";
	theBoard[2][9] = "#";
	theBoard[2][10] = "#";
	theBoard[3][4] = "#";
	theBoard[3][6] = "#";
	theBoard[3][8] = "#";
	theBoard[4][1] = "#";
	theBoard[4][3] = "#";
	theBoard[4][8] = "#";
	theBoard[4][10] = "#";
	theBoard[5][3] = "#";
	theBoard[5][5] = "#";
	theBoard[5][6] = "#";
	theBoard[5][7] = "#";
	theBoard[5][8] = "#";
	theBoard[5][10] = "#";
	theBoard[6][1] = "#";
	theBoard[6][2] = "#";
	theBoard[7][1] = "#";
	theBoard[7][2] = "#";
	theBoard[7][4] = "#";
	theBoard[7][5] = "#";
	theBoard[7][6] = "#";
	theBoard[7][7] = "#";
	theBoard[7][8] = "#";
	theBoard[7][9] = "#";
	theBoard[8][1] = "#";
	theBoard[8][4] = "#";
	theBoard[9][1] = "#";
	theBoard[9][2] = "#";
	theBoard[9][3] = "#";
	theBoard[9][4] = "#";
	theBoard[9][5] = "#";
	theBoard[9][7] = "#";
	theBoard[9][8] = "#";
	theBoard[9][9] = "#";
	theBoard[10][9] = "#";
}



// End of functions

theBoard = new makeboard();

plot_maze();

document.writeln('<center><font size=3 color=#fffccc face=verdana>"Лабиринт"</font>');

document.writeln('<p><font size=2 color=white face=verdana>\n<dd>Ваш игрок представлен "*" в верхнем левом углу. Используйте кнопки, чтобы переместить его вокруг лабиринта. В формах отображаются ваши координаты. ');

document.writeln(' Будте осторожным не касайтесь стен. Ваша цель состоит в том, чтобы добраться до символа "$". Нажмите "Восстановить", чтобы начать игру сначала.<p><b><font size=3 color=aqua face=verdana>Удачи!</b>\n<p>');

document.writeln('<form method="post" name="board">');

document.writeln('<textarea name="grid" rows="10" cols="10" wrap=virtual>');

document.writeln('</textarea>');

document.writeln('<br>');



document.writeln("<input type='button' value='ВВЕРХ' onClick='decy(this.form)'><br>");

document.writeln("<input type='button' value='ВЛЕВО' onClick='decx(this.form)'><input type='button' value='ВПРАВО' onClick='incx(this.form)'><br>");

document.writeln("<input type='button' value='ВНИЗ' onClick='incy(this.form)'><br>");

document.writeln("<input type='text' value='1' size=5 name='xval' onChange='no(this.form);'><input type='text' value='1' size=5 name='yval' onChange='no(this.form);'>");





//document.writeln("<br><input type='button' value='FIRE!' onClick='update(this.form);'>");





document.writeln("<br><input type='button' value='СНАЧАЛА' onClick='clearBoard(this.form);update(document.board);'>");

document.writeln('</form></center>');

document.writeln('</body>');

</script>

Отредактировано Tyzon (Чт, 21 Май 2009 16:38:11)

0

2

Куда это вставлять?

0

3

Суйгецу написал(а):

Куда это вставлять?

хоть куда))

0

4

студентка написал(а):

хоть куда))

Вы правы!

0

5

Хоть куда, а всё же куда?В форме ответа не хочет работать(((

0

6

Air
В ХТМЛ верх или неиз

0

7

ДОМИНИОН написал(а):

Air

в объяву, мона попробовать и  в Админка-Страницы

0

8

Air написал(а):

В форме ответа не хочет работать(((

Он и не должен там работать. :D

0

9

Добавленна игра, читать первый пост.

0

10

Добавленна еще одна игра в 1 пост!

0

11

явные излишества.. :D  тут обычные скрипты (разукрашки)  пытаешься сократить..

0

12

АЛЬБ написал(а):

скрипты (разукрашки)

При чем тут разукрашки если это игры???

0

13

АЛЬБ
Я к тебе обращаюсь!

0

14

Tyzon

Есть специальная тема для выкладывания скриптов в пабик от пользователей, выкладывай там Скрипты от пользователей
Закрыто!

0


Вы здесь » Единый форум поддержки » Корзина » Игры для форумов!