Need help with game code
Im writing a text based game. The first time someone enter an area of the game (while playing it), it tells them where they are and what is in the room. I want to write some code that when someone enters the same area again, it only tells them where they are (kind of like the ZORK series).
Well the easiest way to do that would be to use a text based game specific language like Inform.
Quote:
Original post by SiCrane
Well the easiest way to do that would be to use a text based game specific language like Inform.
well, the thing is im using blitz plus and im wanting to first create the text based version of the game, and then expand it to a graphics game.
Well how I would do it (wich may or may not the best way) is to have a struct (blitz uses structs right?) that represents each room. Add a variable called times_visited or sumthing and set it to zero. Every time the player enters the room increment the variable. check to see if the variable is 0 (room hasnt been visited) and if it is display the discription.
Simplicity is the ultimate sophistication. – Leonardo da Vinci
Quote:
Original post by ForeverNoobie
Well how I would do it (wich may or may not the best way) is to have a struct (blitz uses structs right?) that represents each room. Add a variable called times_visited or sumthing and set it to zero. Every time the player enters the room increment the variable. check to see if the variable is 0 (room hasnt been visited) and if it is display the discription.
I don't think blitz uses struct (because i never heard of them), but i do like the variable idea. Tnx.
Quote:
Well how I would do it (wich may or may not the best way) is to have a struct (blitz uses structs right?) that represents each room. Add a variable called times_visited or sumthing and set it to zero. Every time the player enters the room increment the variable. check to see if the variable is 0 (room hasnt been visited) and if it is display the discription.
A boolean could be as helpful, false when never visited, set to true once visited.
woops my bad. Blitz uses types. structs are a c version of types. If you've never heard of types check this out:
http://www.blitzbasic.com/bpdocs/command.php?name=Type&ref=2d_cat
http://www.blitzbasic.com/bpdocs/command.php?name=Type&ref=2d_cat
Simplicity is the ultimate sophistication. – Leonardo da Vinci
Quote:
Original post by ForeverNoobie
woops my bad. Blitz uses types. structs are a c version of types. If you've never heard of types check this out:
http://www.blitzbasic.com/bpdocs/command.php?name=Type&ref=2d_cat
ok. yeah, ive heard of types. never thought of using them cause i thought they were a graphics game thing. tnx.
You might want to check out sites such as Brass Lantern to get some general information on how adventures are made.
It would also help if you read the documentation for some of the existing specialised adventures languages and creators. Trying a couple out would also give you insight into the mechanics behind them.
One method of keeping track of the attributes for each location (such as whether visited and where each exit is) is to use multi-dimensional arrays.
This is more of a programming issue than a design-related one, so you would probably get more/better responses if you asked this question in one of the programming forums (or if it was moved to one).
It would also help if you read the documentation for some of the existing specialised adventures languages and creators. Trying a couple out would also give you insight into the mechanics behind them.
One method of keeping track of the attributes for each location (such as whether visited and where each exit is) is to use multi-dimensional arrays.
This is more of a programming issue than a design-related one, so you would probably get more/better responses if you asked this question in one of the programming forums (or if it was moved to one).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement