Animasi Game Pesawat Dengan Dev C++
Langkah - Langkah Membuatnya:
1. Buka Dev C++ > New Project
2. Project Options > Pilih Compiler > Base Compiler Set: TDM-GCC 4.9.2 32-bit Release
3. Pilih Parameter > Masukkan Linker Berikut:
-lbgi
-lgdi32
-luser32
Didalam Kolom Linker > Klik Ok
4. Silahkan Copy-Paste Script Program Dibawah Ini Ke Project Baru Anda:
6. Sekian Dan Terima Kasih
#include <graphics.h>
#include
using namespace std;
main(){
initwindow(1000,600);
int x,x2,y2,x3,x4,x5,x6,y6,x7;//deklarasi variable
for(x=0;x<=100;x++){//maju
//pesawat
int badan[]={87+x,550,50+x,550,50+x,500,200+x,500,200+x,550,130+x,550};
drawpoly(6,badan);//badan
for(int j=0;j<=100;j+=20){//loop jendela
int jendela[]={70+x+j,500,70+x+j,520,90+x+j,520,90+x+j,500};
drawpoly(4,jendela);
}//end loop jendela
int ekor[]={50+x,500,0+x,490,50+x,550};
drawpoly(3,ekor);//ekor
ellipse(200+x,525,270,90,50,25);//kepala
line(200+x,520,248+x,520);//jendela kepala pesawat
int sayap[]={100+x,535,70+x,575,170+x,535};
drawpoly(3,sayap);//sayap
arc(135+x,628,70,110,100);//sayap
delay(20);
cleardevice();
}
for(x2=0,y2=0;x2<=400,y2<=400;x2++,y2++){//naik
//pesawat
int badan[]={87+x+x2,550-y2,50+x+x2,550-y2,50+x+x2,500-y2,200+x+x2,500-y2,200+x+x2,550-y2,130+x+x2,550-y2};
drawpoly(6,badan);//badan
for(int j=0;j<=100;j+=20){//loop jendela
int jendela[]={70+x+x2+j,500-y2,70+x+x2+j,520-y2,90+x+x2+j,520-y2,90+x+x2+j,500-y2};
drawpoly(4,jendela);
}//end loop jendela
int ekor[]={50+x+x2,500-y2,0+x+x2,490-y2,50+x+x2,550-y2};
drawpoly(3,ekor);//ekor
ellipse(200+x+x2,525-y2,270,90,50,25);//kepala
line(200+x+x2,520-y2,248+x+x2,520-y2);//jendela kepala pesawat
int sayap[]={100+x+x2,535-y2,70+x+x2,575-y2,170+x+x2,535-y2};
drawpoly(3,sayap);//sayap
arc(135+x+x2,628-y2,70,110,100);//sayap
delay(10);
cleardevice();
}
for(x3=0;x3<=500;x3++){//maju terbang
//pesawat
int badan[]={87+x+x2+x3,550-y2,50+x+x2+x3,550-y2,50+x+x2+x3,500-y2,200+x+x2+x3,500-y2,200+x+x2+x3,550-y2,130+x+x2+x3,550-y2};
drawpoly(6,badan);//badan
for(int j=0;j<=100;j+=20){//loop jendela
int jendela[]={70+x+x2+x3+j,500-y2,70+x+x2+x3+j,520-y2,90+x+x2+x3+j,520-y2,90+x+x2+x3+j,500-y2};
drawpoly(4,jendela);
}//end loop jendela
int ekor[]={50+x+x2+x3,500-y2,0+x+x2+x3,490-y2,50+x+x2+x3,550-y2};
drawpoly(3,ekor);//ekor
ellipse(200+x+x2+x3,525-y2,270,90,50,25);//kepala
line(200+x+x2+x3,520-y2,248+x+x2+x3,520-y2);//jendela kepala pesawat
int sayap[]={100+x+x2+x3,535-y2,70+x+x2+x3,575-y2,170+x+x2+x3,535-y2};
drawpoly(3,sayap);//sayap
arc(135+x+x2+x3,628-y2,70,110,100);//sayap
delay(5);
cleardevice();
}
for(x4=0;x4<=1000;x4++){//maju terbang dari 0
//pesawat
int badan[]={87+x4,550-y2,50+x4,550-y2,50+x4,500-y2,200+x4,500-y2,200+x4,550-y2,130+x4,550-y2};
drawpoly(6,badan);//badan
for(int j=0;j<=100;j+=20){//loop jendela
int jendela[]={70+x4+j,500-y2,70+x4+j,520-y2,90+x4+j,520-y2,90+x4+j,500-y2};
drawpoly(4,jendela);
}//end loop jendela
int ekor[]={50+x4,500-y2,0+x4,490-y2,50+x4,550-y2};
drawpoly(3,ekor);//ekor
ellipse(200+x4,525-y2,270,90,50,25);//kepala
line(200+x4,520-y2,248+x4,520-y2);//jendela kepala pesawat
int sayap[]={100+x4,535-y2,70+x4,575-y2,170+x4,535-y2};
drawpoly(3,sayap);//sayap
arc(135+x4,628-y2,70,110,100);//sayap
delay(5);
cleardevice();
}
for(x5=0;x5<=100;x5++){//maju mau mendarat
//pesawat
int badan[]={87+x5,550-y2,50+x5,550-y2,50+x5,500-y2,200+x5,500-y2,200+x5,550-y2,130+x5,550-y2};
drawpoly(6,badan);//badan
for(int j=0;j<=100;j+=20){//loop jendela
int jendela[]={70+x5+j,500-y2,70+x5+j,520-y2,90+x5+j,520-y2,90+x5+j,500-y2};
drawpoly(4,jendela);
}//end loop jendela
int ekor[]={50+x5,500-y2,0+x5,490-y2,50+x5,550-y2};
drawpoly(3,ekor);//ekor
ellipse(200+x5,525-y2,270,90,50,25);//kepala
line(200+x5,520-y2,248+x5,520-y2);//jendela kepala pesawat
int sayap[]={100+x5,535-y2,70+x5,575-y2,170+x5,535-y2};
drawpoly(3,sayap);//sayap
arc(135+x5,628-y2,70,110,100);//sayap
delay(5);
cleardevice();
}
for(x6=0,y6=0;x6<=400,y6<=400;x6++,y6++){//mendarat
//pesawat
int badan[]={87+x5+x6,550-y2+y6,50+x5+x6,550-y2+y6,50+x5+x6,500-y2+y6,200+x5+x6,500-y2+y6,200+x5+x6,550-y2+y6,130+x5+x6,550-y2+y6};
drawpoly(6,badan);//badan
for(int j=0;j<=100;j+=20){//loop jendela
int jendela[]={70+x5+x6+j,500-y2+y6,70+x5+x6+j,520-y2+y6,90+x5+x6+j,520-y2+y6,90+x5+x6+j,500-y2+y6};
drawpoly(4,jendela);
}//end loop jendela
int ekor[]={50+x5+x6,500-y2+y6,0+x5+x6,490-y2+y6,50+x5+x6,550-y2+y6};
drawpoly(3,ekor);//ekor
ellipse(200+x5+x6,525-y2+y6,270,90,50,25);//kepala
line(200+x5+x6,520-y2+y6,248+x5+x6,520-y2+y6);//jendela kepala pesawat
int sayap[]={100+x5+x6,535-y2+y6,70+x5+x6,575-y2+y6,170+x5+x6,535-y2+y6};
drawpoly(3,sayap);//sayap
arc(135+x5+x6,628-y2+y6,70,110,100);//sayap
delay(10);
cleardevice();
}
for(x7=0;x7<=220;x7++){//maju habis mendarat
//pesawat
int badan[]={87+x5+x6+x7,550-y2+y6,50+x5+x6+x7,550-y2+y6,50+x5+x6+x7,500-y2+y6,200+x5+x6+x7,500-y2+y6,200+x5+x6+x7,550-y2+y6,130+x5+x6+x7,550-y2+y6};
drawpoly(6,badan);//badan
for(int j=0;j<=100;j+=20){//loop jendela
int jendela[]={70+x5+x6+x7+j,500-y2+y6,70+x5+x6+x7+j,520-y2+y6,90+x5+x6+x7+j,520-y2+y6,90+x5+x6+x7+j,500-y2+y6};
drawpoly(4,jendela);
}//end loop jendela
int ekor[]={50+x5+x6+x7,500-y2+y6,0+x5+x6+x7,490-y2+y6,50+x5+x6+x7,550-y2+y6};
drawpoly(3,ekor);//ekor
ellipse(200+x5+x6+x7,525-y2+y6,270,90,50,25);//kepala
line(200+x5+x6+x7,520-y2+y6,248+x5+x6+x7,520-y2+y6);//jendela kepala pesawat
int sayap[]={100+x5+x6+x7,535-y2+y6,70+x5+x6+x7,575-y2+y6,170+x5+x6+x7,535-y2+y6};
drawpoly(3,sayap);//sayap
arc(135+x5+x6+x7,628-y2+y6,70,110,100);//sayap
delay(20);
cleardevice();
}
//pesawat
int badan[]={87+x5+x6+x7,550-y2+y6,50+x5+x6+x7,550-y2+y6,50+x5+x6+x7,500-y2+y6,200+x5+x6+x7,500-y2+y6,200+x5+x6+x7,550-y2+y6,130+x5+x6+x7,550-y2+y6};
drawpoly(6,badan);//badan
for(int j=0;j<=100;j+=20){//loop jendela
int jendela[]={70+x5+x6+x7+j,500-y2+y6,70+x5+x6+x7+j,520-y2+y6,90+x5+x6+x7+j,520-y2+y6,90+x5+x6+x7+j,500-y2+y6};
drawpoly(4,jendela);
}//end loop jendela
int ekor[]={50+x5+x6+x7,500-y2+y6,0+x5+x6+x7,490-y2+y6,50+x5+x6+x7,550-y2+y6};
drawpoly(3,ekor);//ekor
ellipse(200+x5+x6+x7,525-y2+y6,270,90,50,25);//kepala
line(200+x5+x6+x7,520-y2+y6,248+x5+x6+x7,520-y2+y6);//jendela kepala pesawat
int sayap[]={100+x5+x6+x7,535-y2+y6,70+x5+x6+x7,575-y2+y6,170+x5+x6+x7,535-y2+y6};
drawpoly(3,sayap);//sayap
arc(135+x5+x6+x7,628-y2+y6,70,110,100);//sayap
getch();
closegraph();
return 0;
}
5. Kemudian Save Dan Tekan F116. Sekian Dan Terima Kasih
Related Posts
Subscribe Our Newsletter
Belum ada Komentar untuk "Animasi Game Pesawat Dengan Dev C++"
Posting Komentar