Advertisement

Help with a text based Arena style game!!!!

Started by October 26, 2001 04:59 PM
4 comments, last by Alereon 23 years, 1 month ago
hello, my name is chris and i was wondering whats the best way to start a text based arena style game its my first game and i was wondering how to accomplish this feat thanks, Chris ps. i use djgpp
quote: Original post by Alereon
hello, my name is chris and i was wondering whats the best way to start a text based arena style game its my first game and i was wondering how to accomplish this feat thanks,
Chris
ps. i use djgpp



  main(){return(0);}  


that might be a start :D

well, i made a text adventure engine, then got bored and never wrote the text files for the levels, the i made a text battle engine, which i guess would be the same as your arena type game..

but really, its just think about what you want it to do, i.e will it save your progress, how big will it be etc..

then basically you have this:
  _________________________________________|                                        ||               |-- weapons/armour ------|                      |     |--- shop-|-- extra life/whatever--|                      |     |                                                         |     |             |--- attack --take life/winner/increase levelmenu--|---- arena --|                                           ||     |             |--- run -                                  ||     |____ quit              |                                 ||                             |                                 ||_____________________________|                                 ||_______________________________________________________________|  


(that ascii diagram looks nifty, but might get messed up when i post it )

but yeh, thats kinda basically it, you can make it more advance, but thats the flow.

alan
Advertisement
thanks, i jus need to know a couple more things, what can u use for the code to save the stuff to a file, how do you do a random integer in c++, and how can you make a program that when it links back to the main menu it doesnt skip down dos lines like i use goto''s thanks again,
Chris
quote: Original post by Alereon
thanks, i jus need to know a couple more things, what can u use for the code to save the stuff to a file, how do you do a random integer in c++, and how can you make a program that when it links back to the main menu it doesnt skip down dos lines like i use goto''s thanks again,
Chris


you wanna look up fstream for file io (take a look here and an example for loading numbers from a file, will work the same for strings)LINK.

no need for gotos

if you have something like this (this is what the main function of my text adventure looked like)

  #incude blah blahmain(){/*************************HEADER*************************///fancy looking title thingy/*************************HEADER*************************/ReadData("Data/data.dat");  // read data file, if it exists,MAP[PLAYER.X][PLAYER.Y]=1;  //set current position to 1LoadArea();		    //load players current areado{//game loopGetCommand();		    //grab command Process();		    //process command}while(1);/***************************************************/getch(); // i hate when it just exits real fast, so i use getch!return(0);}  


for a random number you want to include math.h and time.h then you wanna put this:

srand(time(0)); //seed random number generator

in your the main, not in yor game loop though

then to get a random number you call for example

int num;

num = rand() % MAX_NUMBER

// MAX_NUMBER being what you want the number to be between, 0 and MAX_NUMBER

alan
thanks again now whats the read data function for again sorry im trying over here hehe.
quote: Original post by Alereon
thanks again now whats the read data function for again sorry im trying over here hehe.


take a look here that works with numbers in a loop, get rid of the loop and just read it in string by string, feeding the data into a varible....

This topic is closed to new replies.

Advertisement