Friday, February 21, 2014

Archery - A Game

This is a project submitted by Priyanka R and Mamatha H of VI semester of 2012 pass-out batch.

This is a snapshot of the game in action:


You can download the source from here.

15 comments:

  1. where is source code?? how to get it

    ReplyDelete
  2. Click on download from =>here<= this link

    ReplyDelete
  3. can u please tell me how to restart this game

    ReplyDelete
  4. because each time we loose we have to debug it again

    ReplyDelete
    Replies
    1. I check the comments section everyday and disappointed to find comments asking for report. Finally some sensible comment.
      The count of arrows fired becomes >15 and in counting function this is detected like this:
      else if(count>=15)
      {
      sprintf(str,"NO of arrows:%d,NO OF ARROWS OVER GAME LOST",count);
      bitmap_output(5,300,str,GLUT_BITMAP_TIMES_ROMAN_24);
      glutIdleFunc(NULL);
      }

      If you observe the game lost message is displayed and idle function is made NULL. This stops the game loop. So you should reinitialize all variables in this piece of code. The flip side is the game will never end. You have to keep on playing. Is it OK?

      Delete
  5. or else can we use mouse call back and restart?

    ReplyDelete
  6. void restart(int id)
    {
    switch(id)
    {
    case 1: glutIdleFunc(id);

    break;

    break;
    case 2 : exit(0);
    break;

    }
    glutPostRedisplay();
    }
    will it work?

    ReplyDelete
    Replies
    1. I didn't get why you defined restart? If you meant to use it as a mouse call back not advisable since you are using menu which is attached to right mouse button.
      So think what you want to do...

      If you want after loosing to ask user wanna play again make him press 'R'(for restart)
      else if(count>=15)
      {
      sprintf(str,"NO of arrows:%d,NO OF ARROWS OVER GAME LOST",count);
      bitmap_output(5,300,str,GLUT_BITMAP_TIMES_ROMAN_24);
      strcpy(str,"To Restart playing press R");
      bitmap_output(5,300,str,GLUT_BITMAP_TIMES_ROMAN_24);
      glutIdleFunc(NULL);
      }

      You can try to initialize all the variables like this in the keyboard function inside if k=='R' like this
      void keys(unsigned char k,int r,int q)
      {
      if(k=='r')
      glutIdleFunc(id1);
      if(k=='R')
      {
      maxy=600; count=0; maxx=500; n=3; m=3;
      count1=0;count2=0;count3=0;count4=0;count5=0;count6=0;count7=0;count8=0;count9=0;count10=0;
      x=25;y=50;
      glutIdleFunc(id);// move the arrow up
      }
      if(k=='q')
      exit(0);
      }

      Delete
  7. All the best for (exams)your and everyone who visited this blog... EXAMS

    ReplyDelete
  8. how to increase the speed of arrow......
    if i increase value of m,n....speed increases,but it doesnt hits all target...need help

    ReplyDelete
  9. how to make arrows hit the targets . please explain the commands

    ReplyDelete
  10. Can u tell me frequency of sound during shooting ...

    ReplyDelete