سورس برای ساخت بازی در c++ البته خیلی سادس
کد:#include<iostream.h> #include<string.h> #include<windows.h> using namespace std; int PlayerLVL=1; int PlayerHP=100*PlayerLVL; int PlayerDamage=PlayerLVL*3+10; int GoblinHP=50; int GoblinDamage=10; int end=0; void play(); void Death(); int sel; int dead=0; int act=0; int main() { while(end==0) { cout<<"\n\n THE ALLAERTS RPG"; cout<<"\n\n By Christiaan Rakowski"; dead=0; act=0; cout<<"\n\n 1 to play or 2 to quit: "; cin>>sel; if(sel==1) { play(); } if(sel==2) { end=1; } } return 0; } int action; int combat; void play() { while(dead==0) { int PlayerHP=100*PlayerLVL; int PlayerDamage=PlayerLVL*3+10; cout << "\n 1-train, More funtions later:"; cin >> action; switch(action) { case 1: //Train { while(act==0) { cout<<"\n You encounter a goblin!"; cout<<"\n Health:"<<PlayerHP<<" Goblin Health:"<<GoblinHP; cout<<"\n 1-melee,2-magic,3-range,4-newtonpower: "; cin>>combat; if(combat==1)//Melee { cout<<"\n You hit the goblin with your PHYSICS BOOK"; cout<<"\n The goblin doesn't look too happy"; GoblinHP-=PlayerDamage; } if(combat==2)//Magic { cout<<"\n You hit the goblin with your SINUS BEAM"; cout<<"\n The goblin looks confused by your calculations"; GoblinHP-=PlayerDamage; } if(combat==3)//Range { cout<<"\n You throw your GEO TRIANGLE at the goblin"; cout<<"\n The goblin now has a GEO TRIANGLE sticking out his forehead"; GoblinHP-=PlayerDamage; } if(combat==4)//Newton Power { cout<<"\n You cast Newton Power at the goblin!!"; cout<<"\n A giant apple hits the goblin!!"; GoblinHP-=PlayerDamage; } if(combat==9)//NUKE, CHEAT { cout<<"\n You found an easter egg!!"; cout<<"\n You drop a nuke on the goblin!!"; cout<<"\n The goblin sh*ts his pants!!"; GoblinHP=0; } if(PlayerHP<=0) { cout<<"\n YOU DIED!!"; dead=1; act=1; } if(GoblinHP<=0) { cout<<"\n YOU WIN!!"; PlayerLVL++; GoblinHP=50; cout<<"\n You leveled up, new LVL is: "<< PlayerLVL; dead=1; act=1; } cout<<"\n The goblin attacks you!!"; cout<<"\n He hits you with his stick!!"; PlayerHP-=GoblinDamage; if(PlayerHP<=0) { cout<<"\n YOU DIED!!"; PlayerLVL=1; dead=1; act=1; } if(GoblinHP<=0) { cout<<"\n YOU WIN!!"; PlayerLVL++; GoblinHP=50; cout<<"\n You leveled up, new LVL is: "<< PlayerLVL; dead=1; act=1; } cout<<"\n Health:"<<PlayerHP<<" Goblin Health:"<<GoblinHP; } } } } }


LinkBack URL
About LinkBacks




پاسخ با نقل قول
