Bilginler Forum
bir kac c++ kodu yilan oyunu kodu Uye_ol
| Bilginler Forum | En Bilgili Forum Sitesi |
Bilginler Forum
bir kac c++ kodu yilan oyunu kodu Uye_ol
| Bilginler Forum | En Bilgili Forum Sitesi |
Bilginler Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Bilginler Forum

Bilginler Forum | Yetkin Forum Güvencesiyle Sizlerle
 
AnasayfaAnasayfa  Latest imagesLatest images  Kayıt OlKayıt Ol  Giriş yap  

 

 bir kac c++ kodu yilan oyunu kodu

Aşağa gitmek 
YazarMesaj
Admin
Bilginler Forum'un Yeni Admini BéRK
Bilginler Forum'un Yeni Admini BéRK
Admin


Mesaj Sayısı : 215
Kayıt tarihi : 10/04/10
Yaş : 33
Nerden : Bilginler Forum'dan

bir kac c++ kodu yilan oyunu kodu Empty
MesajKonu: bir kac c++ kodu yilan oyunu kodu   bir kac c++ kodu yilan oyunu kodu EmptyPerş. Nis. 29, 2010 8:26 am

YILAN OYUNU


# include <stdio.h>
# include <conio.h>
# include <dos.h>
# include <string.h>
# include <stdlib.h>

int yilan[100][2];
int yemx,yemy,yb;
int tus;
int i,j;
int puan,hiz,toppuan;
int secim;
int durum=0;

acilis()
{
clrscr();
textcolor(4);
gotoxy(23,5); cprintf("Ú");
gotoxy(51,5); cprintf("¿");
gotoxy(23,16); cprintf("À");
gotoxy(51,16); cprintf("Ù");

textcolor(10); gotoxy(26,Cool; cprintf("[1] Yavas Puan(5)");
textcolor(10); gotoxy(26,9); cprintf("[2] Normal Puan(10)");
textcolor(10); gotoxy(26,10); cprintf("[3] Hizli Puan(15)");
textcolor(10); gotoxy(26,11); cprintf("[4] Cok Hizli Puan(20)");
textcolor(10); gotoxy(26,12); cprintf("[5] Cikis");
textcolor(2); gotoxy(26,14); cprintf("Seciminiz...: ");
textcolor(7);
secim=getch();
switch(secim)
{
case '1': puan=5; hiz=200; break;
case '2': puan=10; hiz=150; break;
case '3': puan=15; hiz=100; break;
case '4': puan=20; hiz=50; break;
case '5': return 0; break;
default : puan=5; hiz=200; break;
}

clrscr();
textcolor(9); gotoxy(30,1); cprintf("441 EMRAH SIMSEK YILAN OYUNU");
textcolor(4);
gotoxy(5,2); cprintf("Ú");
gotoxy(75,2); cprintf("¿");
gotoxy(5,22); cprintf("À");
gotoxy(75,22); cprintf("Ù");
textcolor(7);
for (i=6;i<=74;i++)
{
gotoxy(i,2); cprintf("Ä");
gotoxy(i,22); cprintf("Ä");
}
for (i=3;i<=21;i++)
{
gotoxy(5,i);cprintf("³");
gotoxy(75,i);cprintf("³");
}
yb=3;
yilan[0][0]=10;
yilan[1][0]=9;
yilan[2][0]=8;

yilan[0][1]=10;
yilan[1][1]=10;
yilan[2][1]=10;

randomize();
yemx=(rand()%50)+5;
yemy=(rand()%10)+5;

textcolor(7);
for (i=0;i<yb;i++)
{
gotoxy(yilan[i][0],yilan[i][1]); cprintf("");
}
textcolor(2); gotoxy(yemx,yemy); cprintf("*");
gotoxy(yilan[yb-1][0],yilan[yb-1][1]); printf(" ");
}

yem()
{
randomize();
j=0;
while(j==0)
{
yemx=(rand()%67)+6;
yemy=(rand()%17)+3;
for (i=0;i<yb;i++)
{
if (yemx!=yilan[i][0] && yemy!=yilan[i][1])
j=1;
textcolor(2); gotoxy(yemx,yemy); cprintf("*");
}
}
}


yilanciz()
{
textcolor(7);
for (i=0;i<yb;i++)
{
gotoxy(yilan[i][0],yilan[i][1]); printf("");
}
gotoxy((yilan[yb-1][0]),(yilan[yb-1][1])); printf(" ");

if (yilan[0][0]==yemx && yilan[0][1]==yemy)
{
yb=yb+1;
toppuan=toppuan+puan;
gotoxy(30,24); printf("PUAN...: %d ",toppuan);
gotoxy((yilan[yb-1][0]),(yilan[yb-1][1])); printf("");
gotoxy(30,24); printf("PUAN...: %d ",toppuan);
yem();
}
if (yilan[0][1]==2 || yilan[0][1]==22 || yilan[0][0]==5 || yilan[0][0]==75)
{
gotoxy(30,25); printf("Oyun Bitti!"); durum=1;
return 0;
}

for (i=1;i<yb;i++)
{
if(yilan[0][0]==yilan[i][0] && yilan[0][1]==yilan[i][1])
{
gotoxy(30,25); printf("Oyun Bitti!"); durum =1; return 0;
}
}
}


main()
{
acilis();
tus=getch();
while(tus!=27)
{
while(!kbhit() && durum==0)
{
if(tus==77) //sag
{
for (i=yb-1;i>0;i--)
{
yilan[i][0]=yilan[i-1][0];
yilan[i][1]=yilan[i-1][1];
}
yilan[0][0]=yilan[0][0]+1;
yilanciz();
}

if (tus==80) //asagi
{
for (i=yb-1;i>0;i--)
{
yilan[i][0]=yilan[i-1][0];
yilan[i][1]=yilan[i-1][1];
}
yilan[0][1]=yilan[0][1]+1;
yilanciz();
}

if (tus==72) //yukari
{
for (i=yb-1;i>0;i--)
{
yilan[i][0]=yilan[i-1][0];
yilan[i][1]=yilan[i-1][1];
}
yilan[0][1]=yilan[0][1]-1;
yilanciz();
}

if (tus==75) //sol
{
for (i=yb-1;i>0;i--)
{
yilan[i][0]=yilan[i-1][0];
yilan[i][1]=yilan[i-1][1];
}
yilan[0][0]=yilan[0][0]-1;
yilanciz();
}
if (durum==1)
{
getch();
return 0;
}
delay(hiz);
}
tus=getch();
}

getch();
}
Sayfa başına dön Aşağa gitmek
http://bilginler.hareketforum.com
 
bir kac c++ kodu yilan oyunu kodu
Sayfa başına dön 
1 sayfadaki 1 sayfası

Bu forumun müsaadesi var:Bu forumdaki mesajlara cevap veremezsiniz
Bilginler Forum :: Web Master Programlama ve Tasarım :: Programlama :: C | C++ | C#-
Buraya geçin: