Hi and welcome to my article, this article is a small game using graphics in c++(DOS Based).I programmed this game and all of the graphics design is imagined by my friend Amit Mehta.
here is little description of game
"This is a simple game for new programmers. It will help them to get a clear view of 2D Graphics The output is a game where the player catches eggs droped by a egg thrower and goes on to various levels "
---- By my Friend Amit
Here i explain some of the class I created and some of my logic.
Here is main Class that move the egg catcher using keyboard
int strx,stry,endx,endy; //coordinate of the moving box
void *buff;////for handlling the box image
#define UP 72
#define DOWN 80
#define RIGHT 77
#define LEFT 75
#define ENTER 28
#define END 28
#define ESC 1
case RIGHT: Box.CatcherMove(ch);
Here it Class (it is defined and declared in second.cpp)
void* DrawImage(bitmap &bit,int x,int y);
void* BITMAP::DrawImage(bitmap &bit,int x,int y)
first create a bitmap bits using thisà
const short W=15;//white
const short Y=14;//yellow
const short S=10;
const short E=11;
void * eggbuff=bit.DrawImage(egg,40,40);
//and to show
The Logic Behind It:-
I am just using random function to generate the egg and at any given time all the egg move downward on the board matrix that is defined in start and if at end it found the catcher the score is incremented by one or you lose the chance.
Let me explain it more, I have a board according to which graphics displayed on the screen if the board matrix element is 0 is doesn’t display anything, same case for egg and egg catcher
Logic behind moving of eggs->every time thrower want to drop egg he put egg value in top of matrix, since every 100 msec the matrix is reviewed and screen is redrawn the egg can be shown on the screen, now for moving action each time top row is copied in it lower row and soon that and last row is discarded this is the logic of moving multiple egg in screen.
Note--> due limitation of size i can't able to upload the Executable File.now you have to compile the same