term paper final (group d)
TRANSCRIPT
Department of Information and Communication Technology
Comilla University
Term Paper On
“DX-BALL GAME DEVELOPMENT PROJECT”
Course leader: Khondokar Fida Hasan Email: [email protected]
Lecturer Dept. of Information and Communication Technology Comilla University , Comilla-3503 Bangladesh
Submitted by:
Group - D
Name ID Position Email
Alauddin 0909003 Group Leader [email protected]
Azmul l Hossain 0909020 Group Member [email protected]
Zarin Tasnim 0909027 Group Member [email protected]
Sharmin Akter 0909030 Group Member
Date of Submission : 14th April, 2012
1
Table of Contents
1.1 Introducton…………………………………………………………................................2
1.1(a) Objective……………………………………………………….. ………………..2
1.1(b) Motivation…………………………………………………...... ………………..3
1.1(c) About DX-BALL………………………… . ……………………………………4
1.1(d) Stratgy se fort the game……………………………………… . ……………….4
1.2 Literatuare Review………………………………………………….... ……………….5
1.3 Methodology………………………………………………………… ……………….8
1.4 Results………………………………………………………............... ……………….20
1.5 Sample Input ………………………………………………………….............................22
1.6 Sample output ………………………………………………………… ………………..22
1.7Discussion………………………………………………………….… ………………….23
1.7a) Limitations………………………………………………............. ……………………23
1.7b) Future Plan………………………………………………...... ………………………24
1.8Conclusion…………………………………………………………. ……………………25
1.9a) Recommendation…………………………………………….. ……………………….25
1.10Biography........................................................................................ …………………….26
1.11 Appendix................................................................................. …………………………26
2
1.1 Introduction :
1.1(a) Objective :
After reading this paper you will be able to know –
What is Dx-ball game?
How to can it possible to run the computer?
How to play the game in the computer?
1.1(b) Motivation:
This paper must be motivation that playing Dx
ball game in the computer and motivate that how
to run the game computer.
This paper inspire & motivate of a reader how to
run and play the game into the computer .
.
3
1.1 (c) About Dx-Ball games:
DX-Ball is a freeware computer game. The game is basically
a Breakout clone: you bounce a ball off a paddle at the bottom
hitting different color blocks on the top of the screen. Hitting all
the blocks results in completing the level and going to the next.
There are 50 levels to complete. Unlike Breakout, however, is
the inclusion of powerups other than extra balls. When you hit a
brick, there is a chance that a powerup will float downwards
towards the paddle, and can be picked up by touching it with
the paddle. Certain powerups have positive effects, while others
have.
1.1 (d) Strategy use of the game :
Mainly the games are breaking the box by ball. If
there is some box in a area and a ball moving randomly in this area. A
horizontal bar which is receives the ball when ball falling down and the
horizontal bar will control by the players using mouse interrupt.
Strategy use -1:
When the ball move in a fixed area then in
this area some box are create in this area . If the ball hit the boxes then
the box is break. Then box reduce in this area and score will increase.
4
Strategy use -2:
After break the boxes the ball back to down
then the horizontal bar will receive the ball and again start move.
Strategy use –3:
If the Horizontal bar is not able to receive the
ball then chance will reduce and. The level Start newly. The horizontal
scroll by mouse interrupts.
1.2 Literature Review :
1. 2 (a) Research area :
Now a Days computer games is most popular of young
generation for entertainment. So, we research in Dhaka
Mirpur -1 in a school. Some students of the school are
regularly play different types of computer game. Then
clearly decision that we are developing a game which
name is Dx-Ball .
5
1.2 (b ) Review & Data collection for DX-BALL :
DX-Ball is a freeware computer game for the PC
first released in 1996 by Michael P. Welch. The game, an updated version
of an earlier series of Amiga games known as Megaball, is patterned after
classic ball-and-paddle arcade games such as Breakout and Arkanoid. It
became a massive cult classic in the Windows freeware gaming
community during the late 1990s. A level editor was made available as well.
DX-Ball
Developer(s)Michael P.
Welch
Designer(s)Seumas
McNally
Version
1.09
(December
1998)
Platform(s) Windows
Release date(s) 1996
Genre(s) Arcade
Mode(s)Single
player
We find code of break box from the in book of “Shober Jonno C” , by
Kamrujjaman Niton.6
Then we can prepared devoloped this project .
1.2 (c) Problem found & solve :
When we prepare to developed the DX-BALL GAMES projects
Then face some problem Such as graphics use , module combining ,
Object createing etc.
We solve this problem by help of Honorable teacher’s and my senior
brother of another university .
We read some books for solve our problem.
1.3 Methodology :
7
1.3 (a) Algorithm (Using natural language ):
DX-BALL (Ball, Area , H_Bar , Box , Chance, Score , level)
1. chance = 0;
2. while chance<= maximum number of chance .
3. then random _ball_move(Area).
4. then create boxes of level 1.
5. then move by user with the horizental Bar under the area .
6. if the ball hit the box then break this box .
7. then box is decrease for this chance .
8. then increase score board .
9. if the H_bar tached the ball then goto Step – 3,5,6,7.
10. else the H_ bar is not able receive the ball then
chance reduce .
11. if box = 0 level increase .
12. return Score board .
1.3(b) Sourec code :
8
/****************************************************DX-BALL Game devopment of Grop –D */
/******************************************* header file declaration **************************************/
#include<iostream.h>
#include<stdio.h>
#include<graphics.h>
#include<stdlib.h>
#include<dos.h>
#include<time.h>
#include<conio.h>
/******************************************* function prototype declation **********************************/
void scorepanel();
void putbricks(int);
int initmouse();
int chgx(int);
int chgy(int);
void restrictmouseptr();
/****************************************** global variables ******************************************/
union REGS ii,oo;
9
int maxx,maxy,barx,bary,flag[1000],n,level,chance=3,ballsize=7;
int button,x,y,xchg,ychg,xnum=0,ynum=0,padx=30,pady=8;
int hits,num,brickx[1000];bricky[1000],gd=DETECT,gm,i=0;
unsigned long points=0,temp=0;float speed=10,xcor,ycor;
/****************************************** main function declartion ***********************************/
void main()
{
initgraph(&gd,&gm,"C:\\TC\\bgi");
outtextxy(10,400,"Press any key to proceed");
randomize();
do
{
settextstyle(2,0,10);
for(i=0;i<12;i++)
{
setcolor(i);
outtextxy(50,200,"Developed By- Group-D");
delay(200);
}
}
while(!kbhit());
10
begin:
clearviewport();
settextstyle(2,0,5);
printf("Enter the level you want to play 1-15 and press enter");
scanf("%d",&level);
if(level>15 || level<1){level=1;}
initmouse();
restrictmouseptr();
/************************************** Calculation for number of bricks ****************************************/
newlevel:
if(chance<=0){goto end;}
clearviewport();
gotoxy(2,10);
printf("Entering Level No.->%d",level);
delay(1500);
clearviewport();
if(level==1 || level==2 || level==3 || level==4){xnum=2;ynum=2;}
if(level==5 || level==7 || level==7 || level==8){xnum=3;ynum=3;}
if(level==9 || level==10 || level==11 ||level==12){xnum=4;ynum=4;}
if(level==13 || level==14 || level>=15){xnum=5;ynum=5;}
speed=speed-(level * 0.10);
11
n=level * 35; //To count total number of bricks
hits=0; //Number of bricks by ball
putbricks(n);
start:
xcor=random(580)+10; //When the chance decreases or new level
ycor=600;
do
{scorepanel();
ycor=ycor-1;
ii.x.ax=3;
int86(0x33,&ii,&oo);
barx=oo.x.cx;
bary=oo.x.dx;
setcolor(RED);
circle(xcor,ycor,ballsize);
setfillstyle(SOLID_FILL,YELLOW);
floodfill(xcor,ycor,RED);
bar3d(barx-padx,bary-pady,barx+padx,bary+pady,3,2);
delay(speed);
setcolor(BLACK);
circle(xcor,ycor,ballsize);
setfillstyle(SOLID_FILL,BLACK);
floodfill(xcor,ycor,BLACK);
bar3d(barx-padx,bary-pady,barx+padx,bary+pady,3,2);
}while(ycor!=250);
while(chance>0)
12
{
scorepanel();
ii.x.ax=3;
int86(0x33,&ii,&oo);
barx=oo.x.cx;
bary=oo.x.dx;
/******************************************** Ball bounces on walls *************************************/
if(xcor>=620 || xcor<=14){xchg=chgx(xcor);}
if(ycor<=70){ychg=chgy(ycor);}
if(xchg==1){xcor=xcor+xnum;}else{xcor=xcor-xnum;}
if(ychg==1){ycor=ycor+xnum;}else{ycor=ycor-xnum;}
setcolor(RED);
circle(xcor,ycor,ballsize);
setfillstyle(SOLID_FILL,YELLOW);
floodfill(xcor,ycor,RED);
bar3d(barx-padx,bary-pady,barx+padx,bary+pady,3,2);
delay(speed);
setcolor(BLACK);
circle(xcor,ycor,ballsize);
setfillstyle(SOLID_FILL,BLACK);
floodfill(xcor,ycor,BLACK);
bar3d(barx-padx,bary-pady,barx+padx,bary+pady,3,2);
if(ycor>=bary-pady){chance--;delay(3000);goto start;}
13
/********************************************* Explode Brick and internal rebounce ***************************/
for(i=0;i<n;i++)
{ if(xcor>=brickx[i]-27 && xcor<=brickx[i]+27)
{ if(ycor>=bricky[i]-15 && ycor<=bricky[i]+15)
{
hits++;sound(1500);points=points+50;
//5 is the speed factor.Actually value of xnum and ynum.Max is 5 so 5 is chosen for range of ball to hit the brick
if(ycor<=bricky[i]+(8+ballsize) && ycor>=bricky[i]-(8+ballsize)){
if(xcor<=brickx[i]-(19+ballsize-5) && xcor>=brickx[i]-(21+ballsize)){if(ychg==1){ychg=1;xchg=0;}else{ychg=0;xchg=0;}}} //Left of Brick
if(ycor<=bricky[i]+(8+ballsize) && ycor>=bricky[i]-(8+ballsize)){
if(xcor>=brickx[i]+(19+ballsize-5) && xcor<=brickx[i]+(21+ballsize)){if(ychg==1){ychg=1;xchg=1;}else{ychg=0;xchg=1;}}} //RIght of Brick
if(xcor<=brickx[i]+(20+ballsize) && xcor>=brickx[i]-(20+ballsize)){
if(ycor<=bricky[i]-(7+ballsize-5) && ycor>=bricky[i]-(9+ballsize)){if(xchg==1){ychg=0;xchg=1;}else{xchg=0;ychg=0;}}} //Top of Brick
if(xcor<=brickx[i]+(20+ballsize) && xcor>=brickx[i]-(20+ballsize)){
if(ycor<=bricky[i]+(9+ballsize) && ycor>=bricky[i]+(7+ballsize-5)){if(xchg==1){ychg=1;xchg=1;}else{xchg=0;ychg=1;}}} //Bottom of Brick
setcolor(BLACK);
setfillstyle(SOLID_FILL,BLACK);
floodfill(xcor,ycor,BLACK);
bar3d(brickx[i]-20,bricky[i]-8,brickx[i]+20,bricky[i]+8,2,0);
14
/***************************** For pattern bricks bonus points ****************************/
if(flag[i]==2){sound(4000);delay(1000);points=points+2000;}
brickx[i]=0;bricky[i]=0;nosound();
}
}
}
//To rebound ball from Paddle
if(xcor>=barx-30 && xcor<=barx+30)
{if(ycor+ballsize>=bary-8 && ycor<=bary-6)
{sound(4000);ychg=0;points=points+10;nosound();}}
if(hits>=num)
{
level++;
if(level>15) //Last level of the DX-BALL
{ clearviewport();
outtextxy(10,10,"CONGRATULATIONS");
outtextxy(10,15,"GAME COMPLETED");
outtextxy(10,20,"Your total score");
printf("%f",points+temp);
delay(3000);
chance=0;
}
15
goto newlevel;
}
} //End of While Loop
restorecrtmode();
end:
gotoxy(10,10);
printf("GAME OVER");
gotoxy(10,11);
printf("Your Score %lu",points+temp);
getch();
closegraph();
}
/********************************************************** end of main ***********************************************/
/*************************************************Function to rebounce ball from sides***************************************/
int chgx(int xcor)
{
int xchg;
if(xcor>=620)xchg=0;
if(xcor<=14) xchg=1;
16
return xchg;
}
/************************************************************* chgy(int ycor) declaration ***************************************/
int chgy(int ycor)
{
int ychg;
// if(ycor>=456) ychg=0;
if(ycor<=70) ychg=1;
return ychg;
}
/************************************************************ Determine position of bricks randomly **********************************/
void putbricks(int n)
{
char pattern[8] = {0x00, 0x70, 0x20, 0x27, 0x25, 0x27, 0x04, 0x04};
clearviewport();
setcolor(LIGHTBLUE);
rectangle(0,0,637,49);
setcolor(LIGHTGREEN);
rectangle(0,51,637,470);
for(i=0;i<n;i++){brickx[i]=0;bricky[i]=0;}
17
for(i=0;i<n;i++)
{
brickx[i]=42 * random(15);
bricky[i]=18 * random(12);
}
setlinestyle(0,0,1);setcolor(WHITE);num=0;
for(i=0;i<=n;i++)
{
if(brickx[i]<60 || brickx[i]>600 || bricky[i]<100 || bricky[i]>200)
{brickx[i]=0; bricky[i]=0;}
if(brickx[i]>=60 && brickx[i]<=600 && bricky[i]>=100 && bricky[i]<=200)
{flag[i]=1;sound(10*i);
if(brickx[i]%bricky[i]==0) { flag[i]=2;}
if(i%12==0) {setfillstyle(SOLID_FILL,YELLOW);}
else {setfillstyle(SOLID_FILL,i);}
if(flag[i]==2){setfillpattern(pattern,getmaxcolor());}
bar3d(brickx[i]-20,bricky[i]-8,brickx[i]+20,bricky[i]+8,0,0);
num++;delay(10);nosound();
}
}
}
/***********************************************Initialises mouse and various other functions************************/
int initmouse()
{
18
ii.x.ax=0;
int86(0x33,&ii,&oo);
return oo.x.ax;
}
/************************************************ restrictmouseptr() declaration **********************************************/
void restrictmouseptr()
{
ii.x.ax=7;
ii.x.cx=32;
ii.x.dx=600;
int86(0x33,&ii,&oo);
ii.x.ax=8;
ii.x.cx=400;
ii.x.dx=400;
int86(0x33,&ii,&oo);
}
/*************************************************** Score bord declare ******************************/
void scorepanel()
19
{ gotoxy(40,2);
printf("LEVEL->%d",level);
/* gotoxy(2,3);
printf("Hits=%d",hits);
gotoxy(25,3);
printf("Num=%d",num);*/
gotoxy(20,2);
printf("SCORE->%lu",points+temp);
gotoxy(60,2);
printf("CHANCES->%d",chance);
gotoxy(13,4);
printf("DEVELOPED BY-Group B");
if(points>=25000)
{chance++;temp=temp+25000;points=points-25000;}
}
1.4 Results :
Using this algorithm a DX-Ball game is made . Which can be
played by only one player.
Control by only mouse . When the programe will run by turbo c Compiler
Then output will be –
20
H_ BAR Control by Mouse.
DX-BALL Control by upt
Score
Board
Specail
Box
Chance of a player.
Area
Level
21
Box
this the output of the DX_BALL PROGRAM.
If the Ball is falling down then Chance will be reduce.
After 3 Chance the game is over and Show the Score board .
Sample Input : Enter the level (1-15) : 10
Sample output :
22
Figure 1 sample output
1.6Discussion:
1.6a) Limitations:
1. Graphics is not so attractive.
2. Only mouse is used as default playing device, Keyboard is not used.
Keyboard interface is not implemented in the game.
3.Exception -13 Error4.
4. Menue option will be not Use .
23
1.6 Future plan:
1. We’ll have tried to give a keyboard interrupt.
2. We want to design more 3D graphics for the game at future.
3. We want to improve the graphics of the game at future.
4.We’ll try our best to give the shape of the board in a 3D manner.
5. Try to give menu option in next time .
6 . Exception 13 error will be remove in next time.
1.7Conclusion:
At the beginning of this project, we want to make a DX-BAll game and at the end of this
project we made this.
After preparing the papers, we got the answers of the following questions-
What is DX-BAll game? Is it possible to run the game into Computer?
But still we have some limitations such as-
Graphics is not so attractive.
Mouse interrupt is not used.
1.7(a) Recommendation:
Graphics quality should be improved.
Keyboard interrupt should be used.
GUI should be used more etc.
24
1.8Bibliography:1)DX-BALL From Wikipedia, the free encyclopedia Web: http://en.wikipedia.org/wiki/Tic_tac_toe
2)C++ Tutorial Web:http://www.cprogramming.com/tutorial/c++-tutorial.html
3) How to make a flowchart for DX-BALL Web:http://www.ehow.com/how_8556862_make-flowchart-tictactoe.html
4)DX-BALL Web: http://people.cs.uchicago.edu/~kathyg/cspp50101/project.html
5) C graphics tutorial Web: http://www.programmingsimplified.com/c-graphics-programming-tutorial
6) Graphics in C Language Web: http://programmerscafe.friendhood.net/t5-graphics-in-c-language
7)Turbo C++ graphics programmingWeb: http://onecore.net/turbo-c-graphics-programming.htm
8)Jeff Kent(2004), C++ Demystified,McGraw-Hill Publications,New York.
1.10 Appendix
After reading this Appendix ,you will be able to know and play DX-BALL
Rules: PRESS Enter button for start Enter Which level you want play (1-15). Now the Scroll bar is Control by mouse continuous play. Better Try to most better play.
25