Programalama > C++

Etiketler: yilan, oyunu, -(yeni, version)

Ort. 0
Puan ver:
// bu bir deneme surumudur 
//yakinda daha genis bir vesiyonu cikacaktir
//~~~  have enjoy  ...... ~~~

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

void sound_go();
void sound();
void ext();
void DuvarBariyerGoruntule ();
void key_yon();
void fun();
void DuvarBariyerBelirle ();
void KalpGoruntule ();
void Kalpolus();
void check_all();
void sound_kyeme();
void ref();
void ylan_gor();
void PuanYaz ();
void cerceve(int x1,int y1,int x2,int y2);
void select();
void menu();
void new_level();
void PuanYaz ();


int x,y,i,j,kX,kY,kalp_say=5,ss,rr,kalp_cnt=0,bnns=0,bns=0;
int x1,x2,y1,y2;
char key;
int one[81][51];
int yln[100][2];
int ys[100];
char buffer[4096];

int  main(void)
{
//textmode(C80);
clrscr();
kalp_cnt=0;
DuvarBariyerBelirle ();
Kalpolus();
randomize();
x1=x = random (78)+2 ;
y1=y = random (43)+2 ;

do{

fun();

if(kbhit())
{
key=getch();
x2=x;
y2=y;
key_yon();

}




}while(int(key)!=27);

return 0;
}




void fun()
{
//gotoxy(2,49); printf("                             ");
//gotoxy(2,50); printf("                             ");

check_all();  // kontrol merkezi

if(!kbhit ()) key_yon();

}


void key_yon()
{
key;
switch (key)
{
case 72:{--y; fun(); }break; //yukar
case 80:{++y; fun(); }break; //asag
case 75:{--x; fun(); };break;//sola
case 77:{++x; fun(); }break;//saga
case 'p':{gotoxy(2,49);
cprintf("pause");
gotoxy(2,50);
cprintf("( press any key to continue )");getch();}break;//durdurma--genelde blnen:pause
case 27:{clrscr(); key=getch();}
}}// end of the function

void DuvarBariyerBelirle ()
{
int a,b;

randomize();
//Rastgele duvarlarn belrlenmes
for ( i = 1; i <= 80;  i++)
for (j = 1; j <= 45; j ++)
if ((random (3) + i * j) % 14 == 1 && random (5) == 1)
one [i][j] = 13;
else
one [i][j] = 0; //0
//Ekrann kenarlarnn (baryerlern) belrlenmes
for (i = 1; i <= 80;  i++)
one [i][1] = 13;        // st yatay
for (i =1; i<= 80;  i++)
one [i][45] = 13;       //alt yatay
for (i = 1; i <= 45;  i++)
one [1][i] = 13;         //sol dikey
for (i = 1; i <= 45;  i++)
one [80][i] = 13;        //sag dikey
//DuvarBaryerGoruntule ();
//textcolor(RED);
int i=1;
for ( a = 1; a <= 80;  a++)
for ( b = 1; b <= 45; b ++)
{//textcolor(one[a][b]+2);//yesil
 if(one[a][b]==0) textcolor(BLUE);
 textcolor(one[a][b]+1+i); //mavi
 gotoxy(a,b);
 cprintf("%c",219);
 if(one[a][b]==10 || one[a][b]==13) one[a][b]=1;
}
return;
}

int kt=0;
void Kalpolus ()
{

++kalp_cnt;
//Ylann yyerek buyudugu kalp karakterlernn hazrlanmas.
do{
++bns;
randomize();
ss=random(76)+2;
rr=random(41)+2;
kX=random(rr);
kY=random(ss);
if(bns>10) {
textcolor(x*y);
bns=0;bnns=50; gotoxy(50,48); cprintf("%c YOU GOT BONNUS %c",2,2);  }

}while(one[kX][kY]==1 || (kX==0) ||(kY==0) || (kX > 80) || (kY > 45));
textcolor(13-x);//krmz
gotoxy(kX,kY);
cprintf("%c",3);
one [kX][kY]=3 ;
}

int say=0;
void check_all()
{

for(i=1;i<kalp_cnt;i++)
{
if(yln[say-kalp_cnt-i][0]==x && yln[say-kalp_cnt-i][1]==y)
ext();
}





++say;
if(one[x][y]==1 ) { ext(); }
if((x==kX && y==kY)) {sound_kyeme();Kalpolus ();  }
else if(one[x][y]==3) { Kalpolus (); one[x][y]=1;  }
textbackground(BLUE);//mavi
yln[say][0]=x;
yln[say][1]=y;
textcolor(RED);
gotoxy(x,y);
textbackground(GREEN);//mavi

cprintf("%c",2);
delay(80);

gotoxy(x,y);
cprintf("%c",4);
textbackground(BLUE);//mavi

//sound_go();
gotoxy(yln[say-kalp_cnt*2][0],yln[say-kalp_cnt*2][1]);
textcolor(GREEN);//mavi
cprintf("%c",219);
PuanYaz ();
one[x][y]=0; // bekle
}



void sound_go()
{
sound (350);
delay (50);
nosound ();
}

void sound_kyeme()
{
sound (250);
delay (100);
nosound ();
}



void ext()
{
//textmode(BW40);
clrscr();
textbackground(GREEN);
textcolor(RED);
gotoxy(14,13);
cprintf("GAME OVER !!! ");
getch();
exit(0);
}

void PuanYaz ()
{
//textbackground(BLUE);
textcolor(10);
gotoxy(2,47);
cprintf("kalp sayisi : %d",kalp_cnt);
gotoxy(2,48);
cprintf("puan        : %d",kalp_cnt*3+bnns);
gotoxy(25,47);
cprintf("kalp [%d][%d]",kX,kY);
gotoxy(25,48);
cprintf("ylan [%d][%d]",x,y);
bnns=0;
}



Yorumlar                 Yorum Yaz
Bu hazır kod'a ilk yorumu siz yapın!
KATEGORİLER
ASP - 240
ASP.NET - 24
C# - 75
C++ - 174
CGI - 8
DELPHI - 247
FLASH - 49
HTML - 536
PASCAL - 246
PERL - 11
PHP - 160
WML - 9
XML - 2
Copyright © 2002 - 2024 Hazır Kod - Tüm Hakları Saklıdır.
Siteden yararlanırken gizlilik ilkelerini okumanızı tavsiye ederiz.
hazirkod.com bir İSOBİL projesidir.