Mengenai Saya

Foto saya
Kediri, java_script, Indonesia
Selamat datang di dalam situs q,postingan tentang c++, java dan html script serta masih banyak lagi akan nimbrung semua disini

Sabtu, April 18, 2009

Game Snake by J3

Game ini hanyalah game sederhana yang menggunakan arah pada keyboar untuk menggerakkannya. Disini Pointer akan bergerak bila tombol terus ditekan.
Berikut adalah sourecode nya,dengan menggunakan C++ BUILDER


#include bivbx.h
//#include
#include iostream.h
#include conio.h

void main()
{
long skor;
char nama[20];
cout<<"=SNAKE POINTER BY JEFRY !!!\n\n\n";

cout<<"=PETUNJUK PENGGUNAAN !!!\n\n";
cout<<"=TANDA ``*`` ADALAH POINTER SNAKE\n\n";
cout<<"=PERGUNAKANLAH TANDA PANAH PADA KEYBOARD ANDA UNTUK MENGGERAKKAN ``*``\n\n";
cout<<"=ESC = UNTUK MENGAKHIRI GAME\n\n";
cout<<"=SELAMAT MENIKMATI !!!\n\n";
cout<<"``ENTER`` PLEASE !!!\n\n";
getche();
cout<<"MASUKAN NAMA ANDA= ";cin>>nama;

{
clrscr();
int x,y;
x=40;
y=12;
randomize();
int x1,y1;
x1=random(78)+1;
y1=random(24)+1;
//long skor;
skor=0;

int tombol;
do
{
clrscr();
gotoxy(x1,y1);
cprintf("$");
gotoxy(1,24);
cout<<"Skor : "<< skor << " $" << "\t\tESC to Quit"<<"\t\t\x18 \x19 \x10 \x11 to Move";
gotoxy(x,y);
cprintf("*");
tombol=getch();
if(tombol==0)
{
tombol=getch();
if(tombol==72)
{
if(y>1)
y=y-1;
else
y=23;
}
else if(tombol==80)
{
if(y<23)
y=y+1;
else
y=1;
}
else if(tombol==75)
{
if(x>1)
x=x-1;
else
x=79;
}
else if(tombol==77)
{
if(x<79)
x=x+1;
else
x=1;
}
}
if(x==x1 && y==y1)
{
skor=skor+100;
x1=random(78)+1;
y1=random(23)+1;
}
}while(tombol!=27);
}
clrscr();
cout<< "\t\t\tNILAI ANDA ADALAH\n\n";

cout<< "\t\t\t";

cout << nama << " " << skor << " $\n\n";

if(skor = 1 && skor < 1000)

{cout << "\t\t\tANDA PADA LEVEL * (BINTANG SATU)";goto bawah;}

if(skor = 1001 && skor < 2000)

{cout << "\t\t\tANDA PADA LEVEL ** (BINTANG DUA)";goto bawah;}

if(skor = 2002 && skor < 3000)

{cout << "\t\t\tANDA PADA LEVEL *** (BINTANG TIGA)";goto bawah;}

bawah:

getche();}