Rapid roll game project in C language in Hindi | with source code

 हेलो दोस्तों !

आज की इस Rapid roll game project in C language in Hindi पोस्ट में हम rapid roll game का project C language की मदद से बनाना सीखेंगे। तो दोस्तों अगर रैपिड रोल गेम का प्रोजेक्ट C प्रोग्रामिंग की मदद से बनाना सीखना चाहते है तो इस पोस्ट को अंत तक जरूर पढ़े। 


इस पोस्ट के मुख्य टॉपिक्स निन्म है :-

  1. project overview . 
  2. project coding steps . 
  3. project source code . 
  4. project explanation video . 

1.project overview :- 

तो दोस्तों सबसे पहले हम rapid roll game project का overview देख लेते है की कौन सा फंक्शन क्या करेगा ?



rapid roll game project in c language in hindi


दोस्तों हमने इस प्रोजेक्ट में main फंक्शन के आलावा तीन और यूजर डिफाइन फंक्शन्स को बनाया है जो इस प्रोजेक्ट में किसी विशेष काम को करने के लिए बनाये गए है इसलिए सबसे पहले हम इन्हीं को जान लेते है की ये फंक्शन्स क्या करेंगे। 

main function :-

दोस्तों हमने main फंक्शन के अंदर ग्राफ़िक्स को इनेबल और डिसएबल करने,कुछ मैसेजेस को प्रिंट करने,गेम साउंड को produce करने और गेम को continue रखने ले लिए सभी यूजर डिफाइन फंक्शन्स को एक एक करके कॉल करने से रिलेटेड कोडिंग की है। 

drawBody function :-

दोस्तों इस गेम में जितनी भी चीज़े ड्रा की गई है उसकी कोडिंग इसी फंक्शन के अंदर की गई है फिर चाहे वह रैपिड रोल हो या प्ले ग्राउंड हो सभी की कोडिंग इसी के अंदर की गई है। 

moveLine function :-

दोस्तों हमने सबसे ज्यादा कोडिंग इसी फंक्शन के अंदर की है जैसे गेम में लगातार निकलने वाली लाइन ,बॉल का खुद से नीचे और ऊपर की ओर मूव करना ,स्कोर को बढ़ाना और गेम के नियम के अनुसार चांस को कम करने से रिलेटेड कोडिंग इस फंक्शन के अंदर की गई है। 

moveBall function :-

दोस्तों इस फंक्शन के अंदर बॉल को लेफ्ट राइट एरो key की मदद से मूव करने और गेम को exit करने से रिलेटेड कोडिंग की गई है। 

2.project coding steps :- 

दोस्तों अब हम rapid roll game project को बनाने के कुछ स्टेप्स को जान लेते है किस प्रकार हमने इस प्रोजेक्ट की कोडिंग की है। 

दोस्तों हमने इस प्रोजेक्ट की कोडिंग स्टेप बाई स्टेप की है जिन स्टेप्स को जानना बहुत जरुरी है तभी आपको आईडिया होगा की किस प्रकार किसी प्रोजेक्ट की कोडिंग स्टेप बाई स्टेप की जाती है। तो ये है वो स्टेप्स जिनकी हम बात कर रहे है -

step 1 :- दोस्तों सबसे पहले स्टेप में हमने केवल गेम की बॉडी या स्ट्रक्चर बनाने के लिए कोडिंग की है जैसे बॉल ,लाइन ,बॉक्स जिसमें गेम खेला जायेगा ,स्कोर ,चांस और गेम एग्जिट मैसेज इन सभी को ड्रा करने से रिलेटेड कोडिंग की है। 

step 2 :- दूसरे स्टेप में हमने केवल लाइन को मूव करने से रिलेटेड कोडिंग की है की कैसे लाइन्स को मूव और फिर से generate करना है। 

step 3 :- तीसरे स्टेप में हमने बॉल को मूव करने से रिलेटेड कोडिंग की है की कैसे बॉल को मूव करना है। 

step 4 :- चौथे स्टेप में हमने स्कोर को कैलकुलेट करने से रिलेटेड कोडिंग की है। 

step 5 :- पांचवे स्टेप में हमने चांस को गेम के नियम के आधार पर कम करने से रिलेटेड कोडिंग की है। 

step 6 :- छठवें स्टेप में हमने गेम को कभी भी एग्जिट करने या बंद करने से रिलेटेड कोडिंग की है।

step 7 :- सातवें स्टेप में हमने गेम के साउंड को produce करने से रिलेटेड कोडिंग की है। 

3.project source code :-

तो दोस्तों अब हम rapid roll game project का source code देख लेते है ताकि आपको पता चल सके की इसकी कोडिंग कैसे की गई है। 

दोस्तों ये है इस प्रोजेक्ट का source code जिसे हमने टर्बो IDE पर बनाया है और इसे टर्बो C कम्पाइलर से compile किया है। इसलिए अगर आप इस प्रोजेक्ट को किसी दूसरे कम्पाइलर से compile करेंगे तो शायद आपको कुछ एरर देखने को मिल सकती है। 

project source code :-


#include< stdio.h >
#include< conio.h >
#include< graphics.h >
#include< dos.h >
int count=0,temp=0,temp2=0,score=0,chance=5,radius=15;
int count1=0,count2=0,count3=0,count4=0,count5=0;
int count6=0,count7=0,count8=0,count9=0,count10=0;
int leftLine1=350,leftLine2=350,leftLine3=350,leftLine4=350;
int rightLine1=350,rightLine2=350,rightLine3=350,rightLine4=350;
int redLine1=350,redLine2=350,moveBubble1=190,moveBubble2=330;
char str[10];
int moveBall()
{
  char check;
  if(kbhit())
  {
    check=getch();
    if(check==27)
    {
      clrscr();
      setcolor(1);
      settextstyle(1,0,3);
      outtextxy(250,200,"YOUR SCORE");
      sprintf(str,"%d",score);
      outtextxy(295,235,str);
      return 1;
    }else if(check==75)
    {
      if(radius==-1&&moveBubble1==-1&&moveBubble2==-1)
      {
      }else if(moveBubble1>=110&&moveBubble1<=490)
      {
	moveBubble1-=5;
      }
    }else if(check==77)
    {
      if(radius==-1&&moveBubble1==-1&&moveBubble2==-1)
      {
      }else if(moveBubble1>=110&&moveBubble1<=490)
      {
	moveBubble1+=5;
      }
    }else if(check==72)
    {
      if(radius==-1&&moveBubble1==-1&&moveBubble2==-1)
      {
      }else
      {
	moveBubble2-=5;
      }
    }else if(check==80)
    {
      if(radius==-1&&moveBubble1==-1&&moveBubble2==-1)
      {
      }else
      {
	moveBubble2+=5;
      }
    }
  }
  if(chance==0)
  {
    clrscr();
    setcolor(1);
    settextstyle(1,0,3);
    outtextxy(250,200,"YOUR SCORE");
    sprintf(str,"%d",score);
    outtextxy(295,235,str);
    return 1;
  }
  return 2;
}
void moveLine()
{
  setcolor(2);
  setlinestyle(0,0,3);
  /*for move left side line*/
  if(leftLine1>=60)
  {
    if(temp==0)
    {
      line(160,leftLine1,210,leftLine1);
      leftLine1--;
    }else
    {
      if(count1==50)
      {
	line(160,leftLine1,210,leftLine1);
	leftLine1--;
      }
    }
    if(leftLine1==300)
    {
      count2=100;
    }
    if(leftLine1==60)
    {
      leftLine1=350;
      score=score+5;
    }
  }
  if(leftLine2>=60)
  {
    if(count2==100)
    {
      line(130,leftLine2,180,leftLine2);
      leftLine2--;
    }
    if(leftLine2==300)
    {
      count3=150;
    }
    if(leftLine2==60)
    {
      leftLine2=350;
      score=score+5;
    }
  }
  if(leftLine3>=60)
  {
     if(count3==150)
     {
       line(210,leftLine3,260,leftLine3);
       leftLine3--;
     }
     if(leftLine3==300)
     {
       count4=200;
     }
     if(leftLine3==60)
     {
       leftLine3=350;
       score=score+5;
     }
  }
  if(leftLine4>=60)
  {
    if(count4==200)
    {
      line(180,leftLine4,230,leftLine4);
      leftLine4--;
    }
    if(leftLine4==300)
    {
      count1=50;
      temp=5;
    }else if(leftLine4==280)
    {
      count=5;
    }else if(leftLine4==290)
    {
      count9=50;
    }
    if(leftLine4==60)
    {
      leftLine4=350;
      score=score+5;
    }
  }
  /*for move right side line*/
  if(rightLine1>=60&&count==5)
  {
    if(temp2==0)
    {
      line(370,rightLine1,420,rightLine1);
      rightLine1--;
    }else
    {
       if(count5==50)
       {
	 line(370,rightLine1,420,rightLine1);
	 rightLine1--;
       }
    }
    if(rightLine1==300)
    {
      count6=100;
    }
    if(rightLine1==60)
    {
      rightLine1=350;
      score=score+5;
    }
  }
  if(rightLine2>=60)
  {
    if(count6==100)
    {
      line(320,rightLine2,370,rightLine2);
      rightLine2--;
    }
    if(rightLine2==300)
    {
      count7=150;
    }
    if(rightLine2==60)
    {
      rightLine2=350;
      score=score+5;
    }
  }
  if(rightLine3>=60)
  {
    if(count7==150)
    {
      line(420,rightLine3,470,rightLine3);
      rightLine3--;
    }
    if(rightLine3==300)
    {
      count8=200;
    }
    if(rightLine3==60)
    {
      rightLine3=350;
      score=score+5;
    }
  }
  if(rightLine4>=60)
  {
    if(count8==200)
    {
      line(390,rightLine4,440,rightLine4);
      rightLine4--;
    }
    if(rightLine4==300)
    {
      temp2=5;
      count5=50;
    }else if(rightLine4==290)
    {
      count10=100;
    }
    if(rightLine4==60)
    {
      rightLine4=350;
      score=score+5;
    }
  }
  /*for move red line*/
  if(redLine1>=60)
  {
    if(count9==50)
    {
      setcolor(4);
      line(200,redLine1,250,redLine1);
      redLine1--;
    }
    if(redLine1==60)
    {
      redLine1=350;
      score=score+10;
    }
  }
  if(redLine2>=60)
  {
    if(count10==100)
    {
      setcolor(4);
      line(400,redLine2,450,redLine2);
      redLine2--;
    }
    if(redLine2==60)
    {
      redLine2=350;
      score=score+10;
    }
  }
  //for ball movemenet
  if((moveBubble1>=150&&moveBubble1<=220)&&(leftLine1>=moveBubble2&&leftLine1-20<=moveBubble2))
  {
    moveBubble2--;
  }else if((moveBubble1>=130&&moveBubble1<=190)&&(leftLine2>=moveBubble2&&leftLine2-20<=moveBubble2))
  {
    moveBubble2--;
  }else if((moveBubble1>=200&&moveBubble1<=270)&&(leftLine3>=moveBubble2&&leftLine3-20<=moveBubble2))
  {
    moveBubble2--;
  }else if((moveBubble1>=170&&moveBubble1<=240)&&(leftLine4>=moveBubble2&&leftLine4-20<=moveBubble2))
  {
    moveBubble2--;
  }else if((moveBubble1>=360&&moveBubble1<=430)&&(rightLine1>=moveBubble2&&rightLine1-20<=moveBubble2))
  {
    moveBubble2--;
  }else if((moveBubble1>=310&&moveBubble1<=380)&&(rightLine2>=moveBubble2&&rightLine2-20<=moveBubble2))
  {
    moveBubble2--;
  }else if((moveBubble1>=410&&moveBubble1<=480)&&(rightLine3>=moveBubble2&&rightLine3-20<=moveBubble2))
  {
    moveBubble2--;
  }else if((moveBubble1>=380&&moveBubble1<=450)&&(rightLine4>=moveBubble2&&rightLine4-20<=moveBubble2))
  {
    moveBubble2--;
  }else if((moveBubble1>=190&&moveBubble1<=260)&&(redLine1>=moveBubble2&&redLine1-20<=moveBubble2))
  {
    radius=-1;
    moveBubble1=-1;
    moveBubble2=-1;
    chance=chance-1;
  }else if((moveBubble1 >= 390&&moveBubble1 <= 460)&&(redLine2 >= moveBubble2&&redLine2-20 <= moveBubble2))
  {
    radius=-1;
    moveBubble1=-1;
    moveBubble2=-1;
    chance=chance-1;
  }
  else if(moveBubble2 >= 70)
  {
    moveBubble2++;
  }
  if((radius==-1&&moveBubble1==-1&&moveBubble2==-1)&&(leftLine1 <= 330&&leftLine1 >= 150))
  {
    radius=15;
    moveBubble1=180;
    moveBubble2=leftLine1-20;
  }else if((radius==-1&&moveBubble1==-1&&moveBubble2==-1)&&(leftLine2 <= 330&&leftLine2 >= 150))
  {
    radius=15;
    moveBubble1=150;
    moveBubble2=leftLine2-20;
  }else if((radius==-1&&moveBubble1==-1&&moveBubble2==-1)&&(leftLine3 <= 330&&leftLine3 >= 150))
  {
    radius=15;
    moveBubble1=230;
    moveBubble2=leftLine3-20;
  }else if((radius==-1&&moveBubble1==-1&&moveBubble2==-1)&&(leftLine4 <= 330&&leftLine4 >= 150))
  {
    radius=15;
    moveBubble1=200;
    moveBubble2=leftLine4-20;
  }
  if(moveBubble2==70)
  {
    radius=-1;
    moveBubble1=-1;
    moveBubble2=-1;
    chance=chance-1;
  }else if(moveBubble2==340)
  {
    radius=-1;
    moveBubble1=-1;
    moveBubble2=-1;
    chance=chance-1;
  }
}
void drawBody()
{
  clrscr();
  setcolor(1);
  rectangle(100,50,500,360);
  line(500,50,640,50);
  line(500,200,640,200);
  line(500,360,640,360);
  line(1,50,100,50);
  line(1,360,100,360);
  outtextxy(5,170,"Press Esc");
  outtextxy(10,200,"To Exit");
  outtextxy(540,100,"SCORE");
  outtextxy(530,230,"CHANCE");
  setcolor(4);
  sprintf(str,"%d",score);
  outtextxy(560,150,str);
  sprintf(str,"%d",chance);
  outtextxy(560,280,str);
  setcolor(5);
  circle(moveBubble1,moveBubble2,radius);
}
void main()
{
  int gd=DETECT,gm;
  char check;
  int end=0,friquency=0;
  clrscr();
  initgraph(&gd,&gm,"");
  setcolor(14);
  settextstyle(1,0,3);
  outtextxy(130,210,"WELCOME TO RAPID ROLL GAME");
  settextstyle(1,0,2);
  outtextxy(150,240,"Press enter key to start game");
  again:
  if(!kbhit())
  {
    check=getch();
    if(check==13)
    {
      while(end!=1)
      {
	drawBody();
	moveLine();
	end=moveBall();
	sound(friquency);
	friquency+=50;
	if(friquency >= 1000)
	{
	  friquency=0;
	}
	delay(40);
      }
    }else
    {
      clrscr();
      setcolor(1);
      settextstyle(1,0,3);
      outtextxy(150,180,"INVALID KEY PRESS ENTER KEY");
      goto again;
    }
  }
  nosound();
  getch();
  closegraph();
}

project output :-

दोस्तों कुछ परेशानी के कारण हमने इस प्रोजेक्ट का आउटपुट यहाँ पर नहीं दिया है। लेकिन फिर भी अगर आप इस प्रोजेक्ट का आउटपुट देखना चाहते है तो आप हमारी वीडियो देख सकते है जिसका लिंक आपको नीचे मिल जायेगा। 

4.project explanation video :-

दोस्तों अगर आपको अभी भी यह प्रोजेक्ट अच्छी तरह समझ नहीं आया है तो आप हमारी यह वीडियो देख सकते है। हमने इस वीडियो में इस प्रोजेक्ट को अच्छी तरह से समझया है तो अगर आप इस वीडियो को you tube पर देखना चाहते हैं तो यहाँ पर क्लिक करें।


rapid roll game project in c language video



इन पोस्ट को भी पढ़े :-


Author :- तो दोस्तों हम आशा करते है की आपको हमारी यह Rapid roll game project in C language in Hindi पोस्ट जरूर पसंद आई होगी और आप C programming की मदद से rapid roll game का project बनाना सीख गए होंगे। तो दोस्तों आज के लिए बस इतना ही फिर मिलेंगे ऐसी ही किसी और मज़ेदार पोस्ट में तब तक के लिए अलविदा !

 

Post a Comment

0 Comments