Bagi yang jurusan komputer segala bidang...hoho!
kalau agan-agan dapet tugas membuat game..nie gua ada 1,
bekas kemarin ujian praktek

game ini sudah di edit sedemikian rupa...
jangan salah, kebanyakan truktur dan pemakaian kode
emang hampir sama dengan yg anda cari di mbah google..tpi ini beda!
haah..liat aja hasil run ny...!
membuat game itu tidak gampang...
jdi tetap gua hargain yg memikirkan algoritma game sperti ini!
nie dia...copas aja!



#include <iostream.h>
#include <conio.h>
#define xmap 20
#define ymap 20
int main()
{
int x,y,posisix,posisiy,batas;
char input;
char *arah[4];
batas=0;
*arah="G0!";
int map[xmap][ymap]= {
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,3,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,1,1,1,1,0,3,1,0,0,1,1,1,1,0,0,3,1,
1,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,1,
1,0,0,1,1,1,1,0,0,1,0,0,1,1,1,1,0,0,0,1,
1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1,0,0,0,1,
1,0,0,1,1,1,1,0,0,1,0,0,1,1,1,1,0,0,0,1,
1,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,1,0,0,1,0,1,1,1,1,0,1,0,0,0,1,0,1,
1,0,0,1,3,1,0,0,1,0,0,1,0,1,1,0,1,1,0,1,
1,3,0,1,1,0,0,0,1,0,0,1,0,1,0,1,0,1,0,1,
1,0,0,1,0,1,0,0,1,0,0,1,0,1,0,0,0,1,0,1,
1,0,0,1,0,0,1,0,1,1,1,1,0,1,0,0,0,1,0,1,
1,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,3,0,0,0,3,0,0,0,0,0,0,3,0,0,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
};
while(1){
cout<<"(pesawat MIPA bersihin TAMAN SISKOM)";


cout<<endl<<"   (SUPRIYADI | K12111012)\n";
for (x=0;x<xmap;x++){
for (y=0;y<ymap;y++){
if (map[x][y]==1){
if (x==0){
cout<<"ZZZ";
}
else if (x==xmap-1){
cout<<"ZZZ";
}
else {cout<<"[|]";}
}
else if (map[x][y]==2){
cout<<*arah;
posisix=x;
posisiy=y;
}
else if (map[x][y]==3){
cout<<"'@,";
}
else {cout<<"   ";}
}
cout<<" "<<endl;
}
cout<<"\n\"w\" \"a\" \"s\" \"d\" untuk menggerakkan]  ['@, = SAMPAH]   [Caps Lock = PAUSE] ";
cout<<endl<<"posisi x = "<<posisix<<endl<<"posisi y = "<<posisiy;
input=getch();
if(input=='s'){
if (map[posisix+1][posisiy]==0 || map[posisix+1][posisiy]==3){
map[posisix][posisiy]=0;
map[posisix+1][posisiy]=2;
*arah=",v,";
}
}
else if(input=='d'){
if (map[posisix][posisiy+1]==0 || map[posisix][posisiy+1]==3){
map[posisix][posisiy]=0;
map[posisix][posisiy+1]=2;
*arah=" >;";
}
}
else if(input=='a'){
if (map[posisix][posisiy-1]==0 || map[posisix][posisiy-1]==3){
map[posisix][posisiy]=0;
map[posisix][posisiy-1]=2;
*arah=";< ";
}
}
else if(input=='w'){
if (map[posisix-1][posisiy]==0 || map[posisix-1][posisiy]==3){
map[posisix][posisiy]=0;
map[posisix-1][posisiy]=2;
*arah="'^'";
}
}
clrscr();
}
}




Setelah di jalankan akan muncul seperti DI BAWAH ini, ^_^ v


























Tampilannya harus maximize....agar gamenya dapat dijalankan dengan BAIK!

plajari benar-benar ya.....!!
jangan asal copas!
Share To:

5hufree

Post A Comment: