0% found this document useful (0 votes)
304 views

CGR Micro Complete Project

The document describes a micro project on an Archery shooting game created by 4 students. It includes an introduction to computer graphics and OpenGL, a description of the archery game, the algorithm used, and the programming code for the game. The game has 10 targets and allows the player 15 arrows to try and hit all the targets. It tracks the number of targets hit and displays if the player wins or loses.

Uploaded by

Aditya Birla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
304 views

CGR Micro Complete Project

The document describes a micro project on an Archery shooting game created by 4 students. It includes an introduction to computer graphics and OpenGL, a description of the archery game, the algorithm used, and the programming code for the game. The game has 10 targets and allows the player 15 arrows to try and hit all the targets. It tracks the number of targets hit and displays if the player wins or loses.

Uploaded by

Aditya Birla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 35

A

MICRO PROJECT

ON

Archery shooting Game

SUBMITTED BY -

Sr.no Roll.n Name of stduent


o
1 3254 Harshvardhan D. Patil
2 3258 Venkatesh A. Tashildar
3 3259 Harsh M.Takade
4 3237 Akib A. Mestri

UNDER THE GUIDANCE OF


Mrs.S.T.Patil

1
DEPARTMENT OF COMPUTER ENGINEERING
SHREE DATTA POLYTECHNIC COLLEGE, DATTANAGAR.

ACADEMIC YEAR: 2022-23

Certificate
This is to certify that the Micro project work entitled

Archery shooting Game


Has been successfully completed by

Sr.no Roll.no Name 0f student


1 3254 Harshvardhan D. Patil
2 3258 Venkatesh A. Tashildar
3 3259 Harsh M. Takade
4 3237 Akib A. Mestri

In fulfillment for the

DIPLOMA IN COMPUTER ENGINEERING

Maharashtra State Board of Technical Education

During the academic year 2022-23 under the guidance of

Mrs. S.T.Patil Mr. S.P.Chavan Mr. P.R Patil


Project Guide H.O.D Principal

2
DEPARTMENT OF COMPUTER ENGINEERING
ACKNOWLEDGEMENT

During the selection of topic entitled as


“…………………………………..’’, the help we received from our
professors, family, and friends is invaluable and we are forever indebted
to them.

We would first like to express our gratitude to our Principal:


P.R Patil Our HOD: S.P.chavan and our Project Guide Mrs.
S.T.Patil for their immense support, suggestion, encouragement and
interest in our micro project work. Without their invaluable suggestions
our project selection would be incomplete.

Last but not least, we would like to thank our friends, parents and
group members for their belief and patience in our endeavor.

Index
SR.NO TITLE PAGE NO.

1 Abstract 5

2 Introduction 6

3 Algorithm 8
3
4 Flowchart 9

5 Program 10

6 Output 30

7 Advantages 33

8 Conclusion 34

9 Bibliography 35

Abstract

C is a powerful general purpose and most popular computer programminglanguage. C is popularly


known as the programmers language, since it was created,influenced and field tested by real working
programmers.In 1970 a system engineer Mr. Dennis Ritche, invented and first implementedthis
programming language C. Besides its features like portability, fast execution it provides a feature called
‘C graphics‘. Using C graphics we wrote the game program.C is a high level language which supports
graphics in it. Archery game tests our concentration power.

4
Introduction
1.1 Introduction to the graphics:

Computer graphics is one of the most exciting and rapidly growing computer field and computer. It is
also an extremely effective medium for communication between men.

The human can understand the information content of a displayed diagram or perceptive view much
faster than it can understand a table of numbers.

5
There is a lot of development in hardware and software required to generate images, and now-a-days
the cost of such hardware and software is also dropping rapidly. Due to this the interactive computer
graphics is becoming available to more and more people.

Computer graphics today is largely interactive. The user controls the contents, structure and appearance
of the objects and of their displayed images by using input devices, such as keyboard, mouse or touch
sensitive panel on the screen. Because of the close relationship between the input devices and display,
the handling of such devices is included in the study of computer graphics.

1.2 OpenGL

OpenGL (open graphic library) is a standard specification defining a cross language cross platform API for
writing application that produces 2D and 3D computer graphics. The interface consists of over 250
different function calls which can be used to draw complex 3D scenes from simple primitives. OpenGL
was developed by Silicon Graphics Inc. (SGI) in 1992 and is widely used in CAD, virtual reality, scientific
visualization, information visualization and flight simulation. It is also used in video games, where it
competes with direct 3D on Microsoft Windows Platforms, OpenGL is managed by the nonprofit
technology consortium, the Khronos group Inc.

1.3 About archery Game

Archery game is a precision sport where the competitors aim and shoot at the target using the arrow.

Every arrow is made of 3 parts:

Tip

Shaft

Nock

Tip of the arrow is used to hit the target. Tip is drawn using a triangle. Shaft of arrow is drawn using
lines. Nock is drawn using quads.

6
The target used is a block which is drawn using point and enclosing the point within lone loop to
create boundary for the target such that only the point hit by the player disappears the target.
Disappearing is highlighted by drawing the target hit by the player using white color which appears as a
hole. This game needs good vision and good concentration.

Algorithm
Step 1: start

Step 2: Initialize the graphics windows and its size using GLUT functions.

Step 3 : Register the keyboard and display call backs in main function.

Step 4 : Game contains of 10 Blocks and 15 Arrows.

7
Step 5 : Arrows starts moving upwards as soon as we enter the output screen.

Step 6 : When the arrow starts moving the key ‘r’ is pressed, which moves towards right in order to hit
the block.

Step 7 : If the key ‘r’ is pressed at the correct position it hit the block or else it fails to hit the block.

Step 8 : If the player fails to hit the ‘10’ blocks using ‘15’ arrows then it will display a message as “no
arrows game over you lost”.

Step 9 : else

Step 10 : Congratulation you won.

Step 11 : By pressing a key ‘n’ the player can start new game.

Step 12: By pressing a key ‘q’ the player can quit/exit the game at any point of the stage.

Step 13: stop

Flowchart

8
Program
#include<stdio.h>

9
#include<GL/glut.h>

#include<string.h>

int maxy=600;

int count=0;

int maxx=500;

int view=0;

int n=3;

int m=3;

int
count1=0,count2=0,count3=0,count4=0,count5=0,count6=0,count7=0,count8=0,count9=0,count10=0;

int x=25, y=50;

char str [10];

void id1();

void id();

void draw_target();

/*based on count display no of arrows and result of game*/

void counting()

sprintf(str,"No of Arrows:%d",count);

display_string(40,40,str,2);

if(count1==1&&count2==1&&count3==1&&count4==1&&count5==1&&count6==1&&count7==1&&cou
nt8==1&&count9==1&&count10==1)

display_string(5,300,"CONGRATULATION U WON",1);

display_string(5,100,"PRESS n TO PLAY AGAIN",2);

display_string(5,80,"PRESS q TO EXIT",2);

10
glutIdleFunc(NULL);

else if(count>=15)

display_string(5,300," GAME OVER YOU LOSE",1);

display_string(5,100,"PRESS n TO PLAY AGAIN",2);

display_string(5,80,"PRESS q TO EXIT",2);

glutIdleFunc(NULL);

/*TO CHECK WHETHER ARROW HITS TARGET*/

void disa()

if((x+110==300)&&(y>=435&&y<=465)&&(!count1))

count1=1;

x=25;

y=0;

count++;

glutIdleFunc(id);

else if ((x+110==375)&&(y>=385&&y<=415)&&(!count2))

11
{

count2=1;

x=25;

y=0;

count++;

glutIdleFunc(id);

else if ((x+110==399) &&(y>=465&&y<=495) &&(!count3))

count3=1;

x=25;

y=0;

count++;

glutIdleFunc(id);

else if((x+110==249)&&(y>=355&&y<=385)&&(!count4))

count4=1;

x=25;

y=0;

count++;

glutIdleFunc(id);

else if((x+110==351)&&(y>=315&&y<=345)&&(!count5))

count5=1;

x=25;

y=0;

count++;

12
glutIdleFunc(id);

else if((x+110==450)&&(y>=275&&y<=305)&&(!count6))

count6=1;

x=25;

y=0;

count++;

glutIdleFunc(id);

else if((x+110==330)&&(y>=230&&y<=260)&&(!count7))

count7=1;

x=25;

y=0;

count++;

glutIdleFunc (id);

else if((x+110==201)&&(y>=185&&y<=215)&&(!count8))

count8=1;

x=25;

y=0;

count++;

glutIdleFunc(id);

else if((x+110==399)&&(y>=135&&y<=165)&&(!count9))

count9=1;

13
x=25;

y=0;

count++;

glutIdleFunc(id);

else if((x+110==300)&&(y>=85&&y<=115)&&(!count10))

count10=1;

x=25;

y=0;

count++;

glutIdleFunc(id);

/*to move arrow up*/

void id()

if(view==1)

y+=n;

disa();

if(y>maxy)

y=0;

count++;

14
}

glutPostRedisplay();

/*to display bitmap char (strings)*/

void display_string(int x, int y, char *string, int font)

int len,i;

glColor3f(0.8,0.52,1.0);

glRasterPos2f(x, y);

len = (int) strlen(string);

for (i = 0; i < len; i++) {

if(font==1)

glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,string[i]);

if(font==2)

glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,string[i]);

if(font==3)

glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12,string[i]);

if(font==4)

glutBitmapCharacter(GLUT_BITMAP_HELVETICA_10,string[i]);

void display1(void)

glClearColor(0.0,0.5,0.5,1.0);

display_string(180,350,"CITY ENGINEERING COLLEGE",1);

15
display_string(215,300,"ARCHERY GAME",1);

display_string(100,250,"MOUSE",2);

display_string(150,230,"PRESS RIGHT BUTTON FOR MENU",3);

display_string(100,210,"KEYBOARD",2);

display_string(150,190,"PRESS 'r' TO RELEASE ARROWS",3);

display_string(150,180," PRESS 'q' TO EXIT",3);

display_string(100,150,"PRESS SPACE BAR TO START GAME",2);

glutPostRedisplay();

glutSwapBuffers();

/*to clear screen & set projection mode*/

void init()

glClearColor(0,0.5,0.5,1);

glColor3f(1,0,0);

glMatrixMode(GL_PROJECTION);

glLoadIdentity();

gluOrtho2D(0,500,0,500);

glMatrixMode(GL_MODELVIEW);

/*to draw the arrow*/

void disp()

glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

16
if(view==0)

init();

display1();

else

glLoadIdentity();

glColor3f(1,1,0);

display_string(150,450,"ARCHERY GAME",1);

counting();

// Drawing of arrow

glColor3f(0,1,1);

glBegin(GL_LINES);

glVertex2d(x,y);

glVertex2d(x+100,y);

glEnd();

glLineWidth(2);

glBegin(GL_LINES);

glVertex2d(x,y+2);

glVertex2d(x+100,y+2);

glEnd();

glBegin(GL_LINES);

glVertex2d(x,y-2);

glVertex2d(x+100,y-2);

glEnd();

glBegin(GL_TRIANGLES);

glColor3f(1,0,0);//color of tip

17
glVertex2d(x+100,y+3);

glVertex2d(x+110,y);

glVertex2d(x+100,y-3);

glEnd();

glBegin(GL_QUADS);

glVertex2d(x,y+3);

glVertex2d(x,y-3);

glVertex2d(x-10,y-5);

glVertex2d(x-10,y+5);

glEnd();

draw_target();

// Drawing of target

glFlush();

glutSwapBuffers();

/*to draw the target inside line loop*/

void draw_target()

if(count1==0)

glColor3f(1,0,1);

glPointSize(30);

glBegin(GL_POINTS);

glVertex2d(300,450);

glEnd();

glBegin(GL_LINE_LOOP);

18
glVertex2d(285,465);

glVertex2d(315,465);

glVertex2d(315,435);

glVertex2d(285,435);

glEnd();

else

glColor3f(1,1,1);

glPointSize(20);

glBegin(GL_POINTS);

glVertex2d(300,450);

glEnd();

if(count2==0)

glColor3f(1,0,1);

glPointSize(30);

glBegin(GL_POINTS);

glVertex2d(375,400);

glEnd();

glBegin(GL_LINE_LOOP);

glVertex2d(360,415);

glVertex2d(390,415);

glVertex2d(390,385);

glVertex2d(360,385);

glEnd();

else

19
{

glColor3f(1,1,1);

glPointSize(20);

glBegin(GL_POINTS);

glVertex2d(375,400);

glEnd();

if(count3==0)

glColor3f(1,0,1);

glPointSize(30);

glBegin(GL_POINTS);

glVertex2d(400,480);

glEnd();

glBegin(GL_LINE_LOOP);

glVertex2d(385,495);

glVertex2d(415,495);

glVertex2d(415,465);

glVertex2d(385,465);

glEnd();

}else

glColor3f(1,1,1);

glPointSize(20);

glBegin(GL_POINTS);

glVertex2d(400,480);

glEnd();

if(count4==0)

20
{

glColor3f(1,0,1);

glPointSize(30);

glBegin(GL_POINTS);

glVertex2d(250,370);

glEnd();

glBegin(GL_LINE_LOOP);

glVertex2d(235,385);

glVertex2d(265,385);

glVertex2d(265,355);

glVertex2d(235,355);

glEnd();

}else

glColor3f(1,1,1);

glPointSize(20);

glBegin(GL_POINTS);

glVertex2d(250,370);

glEnd();

if(count5==0)

glColor3f(1,0,1);

glPointSize(30);

glBegin(GL_POINTS);

glVertex2d(350,330);

glEnd();

glBegin(GL_LINE_LOOP);

glVertex2d(335,345);

21
glVertex2d(365,345);

glVertex2d(365,315);

glVertex2d(335,315);

glEnd();

}else

glColor3f(1,1,1);

glPointSize(20);

glBegin(GL_POINTS);

glVertex2d(350,330);

glEnd();

if(count6==0)

glColor3f(1,0,1);

glPointSize(30);

glBegin(GL_POINTS);

glVertex2d(450,290);

glEnd();

glBegin(GL_LINE_LOOP);

glVertex2d(435,305);

glVertex2d(465,305);

glVertex2d(465,275);

glVertex2d(435,275);

glEnd();

}else

glColor3f(1,1,1);

glPointSize(20);

22
glBegin(GL_POINTS);

glVertex2d(450,290);

glEnd();

if(count7==0)

glColor3f(1,0,1);

glPointSize(30);

glBegin(GL_POINTS);

glVertex2d(330,245);

glEnd();

glBegin(GL_LINE_LOOP);

glVertex2d(315,260);

glVertex2d(345,260);

glVertex2d(345,230);

glVertex2d(315,230);

glEnd();

else

glColor3f(1,1,1);

glPointSize(20);

glBegin(GL_POINTS);

glVertex2d(330,245);

glEnd();

if(count8==0)

glColor3f(1,0,1);

23
glPointSize(30);

glBegin(GL_POINTS);

glVertex2d(200,200);

glEnd();

glBegin(GL_LINE_LOOP);

glVertex2d(185,215);

glVertex2d(215,215);

glVertex2d(215,185);

glVertex2d(185,185);

glEnd();

else {

glColor3f(1,1,1);

glPointSize(20);

glBegin(GL_POINTS);

glVertex2d(200,200);

glEnd();

if(count9==0)

glColor3f(1,0,1);

glPointSize(30);

glBegin(GL_POINTS);

glVertex2d(400,150);

glEnd();

glBegin(GL_LINE_LOOP);

glVertex2d(385,165);

glVertex2d(415,165);

glVertex2d(415,135);

24
glVertex2d(385,135);

glEnd();

else

glColor3f(1,1,1);

glPointSize(20);

glBegin(GL_POINTS);

glVertex2d(400,150);

glEnd();

if(count10==0)

glColor3f(1,0,1);

glPointSize(30);

glBegin(GL_POINTS);

glVertex2d(300,100);

glEnd();

glBegin(GL_LINE_LOOP);

glVertex2d(285,115);

glVertex2d(315,115);

glVertex2d(315,85);

glVertex2d(285,85);

glEnd();

else

glColor3f(1,1,1);

glPointSize(20);

25
glBegin(GL_POINTS);

glVertex2d(300,100);

glEnd();

glFlush();

/* to move the arrow left when 'r' pressed*/

void id1()

x+=m;

disa();

if(x+110>maxx)

x=25;

y=0;

count++;

glutIdleFunc(id);

glutPostRedisplay();

/*set key to perform desired operation*/

void keys(unsigned char k,int x,int y)

switch(k){

case ' ':

disp();

view=1;

26
break;

case 'r': glutIdleFunc(id1);

break;

case 'n': /* new game */

maxy=600;

count=0;

maxx=500;

view=1;

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;

disp();

glutIdleFunc(id);

break;

case 'q': /* quit game */

exit(0);

/*sub menu to display instructions*/

void demo_menu(int i)

27
switch(i)

case 5:

case 6:

case 7:

case 8:break;

/*sub menu to display designer names*/

void demo(int i)

switch(i)

case 9:

case 10:

case 11:break;

void game(int id)

switch(id)

/*main to call display,keyboard and idle func*/

int main(int argc,char **argv)

int sub_menu,submenu;

28
glutInit(&argc,argv);

glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB|GLUT_DEPTH);

glutInitWindowSize(900,900);

glutCreateWindow("ARCHERY GAME");

sub_menu=glutCreateMenu(demo_menu);

glutAddMenuEntry("r to release arrow",5);

glutAddMenuEntry("15 arrows and 10 blocks present",6);

glutAddMenuEntry("lost if arrow count exceeds blocks",7);

glutAddMenuEntry("otherwise win",8);

submenu=glutCreateMenu(demo);

glutAddMenuEntry("AKASH",9);

glutAddMenuEntry("ZEESHAN",10);

glutCreateMenu(game);

glutAddSubMenu("INSTRUCTION",sub_menu);

glutAddSubMenu("ABOUT",submenu);

glutAddMenuEntry("QUIT",2);

glutAttachMenu(GLUT_RIGHT_BUTTON);

glutDisplayFunc(disp);

glutIdleFunc(id);

glutKeyboardFunc(keys);

glEnable(GL_DEPTH_TEST);

glutMainLoop();

return 0;

Output

29
30
31
32
Advantages

Though the proposed game is an action game, it doesn’t involve direct violence. No zombie killing,anima
l killing, or human killing is performed in the game. So it can also be viewed as a non-violence game.Kids 
can also play this game, because the design of the game is very simple, controlling the gameis very easy
pressing some neighboring keys of the keyboard.

This Report describes all the requirements for the project. The purpose of this research is to providea
virtual image for the combination of both structured and unstructured information of our project

“Archery”. This is a single-
player strategy game on the Windows platform. The player willprogress through levels which require
precise manipulation of the environment, though the gameEncourages creativity and daring via branchi
ng pathways. The episodic structure of the gamefacilitates the pace of the story. I demonstrate the actio
n flow between inputs, script, display(output).We are working mainly with story, levels, object, animatio
n, graphics, scripts, gameengine facilities

33
Conclusion

We have tried out level best to build the project efficiently and correctly and have succeeded in
building a better project, but may not be a best project. We have implemented the required
functions which we had stated earlier. After all testing process, the game is now ready to be
played.

We strive to provide clear explanation and inter-subject continuity in our presentation illustrative
examples are used to substantiate discussion on abstract concepts while the primary mission is to
offer relative well-focused introduction to the fundamental theory and underlying technology,
significant variations in such matters as basic definitions and implementation protocols are
presented in order to have a reasonably broad coverage of the field. In addition, interesting
applications are introduced as early as possible to highlight the usefulness of the graphics
technology. However, user requirements tend to change and provision for change in design has
been allowed .if no major requirements, which are too complex for current design, are made then
the current design holds.

34
Bibliography
 https://www.google.com/
 https://www.vtuloop.com/
 https://github.com/
 https://cglabprojects.blogspot.com/2014/02/archery.html

35

You might also like