Problem! C Programming Begginer Soooo Confused :(
i am trying to create a basic text based game which will simply navigate between rooms when u press the corresponding letter. eg. n = north.
i have a basic code here which i have been given to work with and i keep getting errors where i am trying to define the rooms, in lines 21 - 32. i jus want two rooms for now that i can move back and forth between, the later version should have 13 rooms but once i know how to do the first two i assume the others will be easy to add in. if you have any ideas how to help it would be greatly appreciated. i am new at c and have a very limited knowledge, so i do not understand much which does not help. sorry. here is the code i have so far with annotations of what i am trying to do:
Code:
//Required System Files
#include <stdio.h>
#include <stdlib.h>
//Global Definitions
#define North= 0
#define East= 1
#define South= 2
#define West= 3
//Global Structure Type Definition
typedef struct{ //Define new Structure Type
char Description[200]; //Use upto 200 characters for description string
unsigned int Exit[4]; //Use 4 possible different values for Exit array
}Location; //Call this structure type: Location
//Global Location Type Variable Definition
Location Room[13]; //Create 13 Location type Global structures called Room’s
//MY ROOM 1 DEFINITION
strcpy(Room[1].Description, "Entrance");
Room[1].Exit[North]=2; //Going north takes you to Room 2
Room[1].Exit[East]=0; //Use zero to indicate no exit East
Room[1].Exit[South]=0;
Room[1].Exit[West]=0;
//MY ROOM 2 DEFINITION
strcpy(Room[2].Description, "Lower South Corridor");
Room[2].Exit[North]=4;
Room[2].Exit[East]=3;
Room[2].Exit[South]=1;
Room[2].Exit[West]=0;.
//Main Function
void main(){
unsigned int RoomNumber = 1; //Setup starting room number as 1
unsigned int Direction;
SetupRooms(); //Setup Room structures
while(1){
system("cls"); //Clear Screen
DescribeRoom(RoomNumber); //Describe current Room
DescribeExits(RoomNumber); //Describe current Room Exits
Direction = GetDirection(RoomNumber); //Get direction to go in
if(Direction == 99) exit(0); //Exit prog if 99 is returned
if(Direction > 0) RoomNumber = Direction;//Set current Room number
}
}
i think i need more functions and stuff but i do not know how to do it, or what really to do. in short i am baffled. like i said before, any help would be greatly appreciated.