borland dos game [Archive] - C Board

PDA

View Full Version : borland dos game


pode
05-29-2002, 03:45 PM
can someone give me a small code for a simple dos game
so i can see what functions and modes there are and how to use them
i'm not a beginner but i think i'm stuck, and i need help to improve myself
any help would be apriciated, thanks in advance!

Vicious
05-29-2002, 03:49 PM
If you are tryin to use graphic.h

GOOD LUCK!!

pode
05-29-2002, 04:00 PM
lol what's the problem

cna u show me some codes that u have perhaps we can help eachother

Vicious
05-29-2002, 04:12 PM
#include <iostream.h>
#include <graphics.h>

int GraphicsDriver;
int GraphicsMode;

int main()
{
initgraph ( &GraphicsDriver, &GraphicsMode, "" )

circle (5, 5, 10 )

cin.get();
return 0;
}


I cant even get that to work... It says make failed and gives no reason

:(

pode
05-29-2002, 04:38 PM
in this case i see u have forgot to put ;
after your functions

but i also looked at your previous code
and found that it gave u errors with the ;
i think your problem is when u open a new file u should just choose BGI nothing else i dont know how it looks like in yor borland but in my u can choose one thing called no exceptions
dont choose that one just choose BGI!

Vicious
05-29-2002, 04:41 PM
oops. i just forgot the ";" on my post

:rolleyes:

Any who I pick Dos(Standard) and pick the BGI Library.. nothing else.

pode
05-29-2002, 04:48 PM
do u save your files as "ide"?
example file1.ide

pode
05-29-2002, 05:31 PM
what is the Red Dragon Syndicate?

Vicious
05-29-2002, 05:34 PM
Yah.. ide is what i always use...

Must not have seen Cowboy Bebop... Red Dragon Syndycate is off of an anime :rolleyes:

lambs4
05-29-2002, 06:20 PM
see if this works:

#include <iostream.h>
#include <graphics.h>

int GraphicsDriver = VGA;
int GraphicsMode = VGAHI;

int main()
{
initgraph ( &GraphicsDriver, &GraphicsMode, "" )

circle (5, 5, 10 )

cin.get();
return 0;
}

Vicious
05-29-2002, 06:23 PM
Error:
Line 11,11 Statement Missing ;

:(

Vicious
05-29-2002, 06:25 PM
Even if I put ; on the end it runs and says

BGI Error: Graphics not initialized use 'initgraph'

:confused:

lambs4
05-29-2002, 06:41 PM
I've tried this with your example and got to work.

initgraph ( &GraphicsDriver, &GraphicsMode, "<path to bgi directory>" )


initgraph ( &GraphicsDriver, &GraphicsMode, "c:\\bc45\\bgi" );

Vicious
05-29-2002, 06:46 PM
Lamb.. I love you...


You have solved the problem I have had for a month...

THANK YOU SOOO MUCH!!!

So you know any thing about graphics.h? Like how to change the background or make game items.. like make a circle and make it move?

lambs4
05-29-2002, 07:29 PM
I know a little about graphics.h, but thats about it. By background do you mean the color? Cause that's all I know and that's by using setbkcolor().

Here's some code that modes a circle


#include <graphics.h>
#include <stdio.h>
#include <conio.h>

int main()
{
int gdriver = VGA, gmode = VGAHI; /* sets graphic mode in VGA 640 x 480 */
int x = 20, y = 20, quit = 0, move;
char coord[10]; /* coordinates */
initgraph(&gdriver,&gmode, "c:\\bc45\\bgi");

while(!quit)
{
sprintf(coord,"x: %d y: %d", x,y);
outtextxy(1,1,coord); /* outputs coordinates */
move = getch(); /* gets input */
switch(move)
{ case 'd' : x++; break;
case 'a' : x--; break;
case 'w' : y--; break;
case 's' : y++; break;
case 'q' : quit = 1; break;
}
cleardevice();
circle(x,y,10);

}

closegraph();
}

Invincible
05-29-2002, 11:30 PM
Hey Pode, check out Vasanth's snake game. He has the source posted. There should be some stuff in there for you.

pode
05-30-2002, 09:21 AM
were???

Invincible
05-30-2002, 10:53 AM
Use the force Luke.

geekfrog
05-30-2002, 10:55 AM
pode, you have to learn not to ask people to write your programs for you

geez....it says so right in the faq.

pode
05-30-2002, 11:49 AM
who the **** are you
when did i ask someone to do the program for me
i just asked if they had anycode to share so that i could learn from them

pode
05-30-2002, 11:50 AM
seriously Invincible were is his code i've searched the entire board

lambs4
05-30-2002, 11:57 AM
Vasanth's snake game (http://www.cprogramming.com/cboard/showthread.php?s=&threadid=18524)