Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


simple text maze game

This topic is 5459 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a programming project that i need help on. I have to create a text maze game using function calling. Following the code that I have written so far: The problem is that I dont know how to connect the room together using function. can any one please help me with this. Thank You CODE: #include <iostream> using namespace std; float room1(int answer); float room2(int answer); float room3(int answer); float room4(int answer); float room5(int answer); float room6(int answer); float room7(int answer); float room8(int answer); int main(void) { char answer; int treasure = 0; cout <<"You have Enter the Maze.\n" <<"You are in the first room.\n" <<"There are 3 exits: West, East, and South.\n" <<"Have Fun " <> answer; if(answer == ''W'') { cout << room5(answer); } if(answer == ''S'') { cout << room2(answer); } if(answer == ''E'') { cout << room1(answer); } return 0; } float room1(int answer) { cout <<"You have enter the first room of the maze!!!" << endl; cout <<"There are 2 exits in this room: West and South." <

Share this post

Link to post
Share on other sites
u are doing it all wrong...
You will never finish it that way!

create a map.


struct MapInfo {
int eastConnection
int westConnection
int northConnection
int southConnection

MapInfo Map(100);

Basically you store all your variables of the map , including connections etc in an array.

Then depending on your position you look at the array.
and see if there are any connecting rooms
like if there arnt any other rooms, make them equal null or something

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!