Need help with linked list game program!

Hi I'm obviously somewhat new to programming and I'm at a lost in this particular chapter. We have to essentially create a game using linked lists using a Map, Hero, and Room class. Ever since I started this chapter I don't really know what to do. I'm trying to make a dorky little game where you go through rooms and face vegetable monsters to get to a goal of three different steaks at the end which would be received by defeating the top vegetable bosses of each room. But I'm not even sure how to create the battle sequence or make the character move to each room. During the chapter we only really used a switch function and it wasn't this broad where I would have to make a function for each room I guess? I was hoping someone could give me some examples or pointers about where to go next because I have no idea and when I try to find the next step on the internet people are doing the codes in completely different ways. This is what I've got so far with what little help my teacher has provided for the program. I don't even know if I should keep what I have for enemies in the main. I also don't know really how to create the battle scenario for entering a new room. Any help would be appreciated.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#include <iostream>
#include <string>
#include <vector>

using namespace std;

class Rooms
{
public:
	Rooms(const string& name = "");
	Rooms*GetNorth();
	Rooms*GetSouth();
	Rooms*GetEast();
	Rooms*GetWest();
	void SetNorth(Rooms*next);
	void SetSouth(Rooms*next);
	void SetEast(Rooms*next);
	void SetWest(Rooms*next);

private:
	Rooms* m_pNorth;
	Rooms* m_pSouth;
	Rooms* m_pWest;
	Rooms* m_pEast;

	string m_Name;
	vector<string> RoomInv;

};

Rooms* Rooms::GetNorth()
{
	return m_pNorth;
}
void Rooms::SetNorth(Rooms*next)
{
	m_pNorth = next;
}
void Rooms::SetSouth(Rooms*next)
{
	m_pSouth = next;
}
void Rooms::SetEast(Rooms*next)
{
	m_pEast = next;
}
void Rooms::SetWest(Rooms*next)
{
	m_pWest = next;
}
class Map
{
public:
	Map();
	~Map();
	void RoomInfo();
	
private:
	Rooms* m_pHead;
};
Map::Map()
{
	Rooms* pNewRoom = new Rooms("Lobby");
	Rooms* pNewRoom2 = new Rooms("Squash Room");
	Rooms* pNewRoom3 = new Rooms("Celery Room");
	Rooms* pNewRoom4 = new Rooms("Broccoli King Room");
	Rooms* pNewRoom5 = new Rooms("Lettuce Room");
	Rooms* pNewRoom6 = new Rooms("Onion Room");
	Rooms* pNewRoom7 = new Rooms("Spinach the Warmonger Room");
	Rooms* pNewRoom8 = new Rooms("Pea Room");
	Rooms* pNewRoom9 = new Rooms("Olive Room");
	Rooms* pNewRoom10 = new Rooms("Green Bean Queen Room");


	pNewRoom->SetNorth(pNewRoom5);
	pNewRoom->SetEast(pNewRoom2);
	pNewRoom->SetWest(pNewRoom8);
	pNewRoom2->SetEast(pNewRoom);
	pNewRoom2->SetNorth(pNewRoom3);
	pNewRoom3->SetSouth(pNewRoom2);
	pNewRoom3->SetEast(pNewRoom5);
	pNewRoom3->SetNorth(pNewRoom4);
	pNewRoom4->SetSouth(pNewRoom3);
	pNewRoom4->SetEast(pNewRoom6);
	pNewRoom5->SetSouth(pNewRoom);
	pNewRoom5->SetEast(pNewRoom3);
	pNewRoom5->SetWest(pNewRoom9);
	pNewRoom5->SetNorth(pNewRoom6);
	pNewRoom6->SetSouth(pNewRoom5);
	pNewRoom6->SetEast(pNewRoom4);
	pNewRoom6->SetWest(pNewRoom10);
	pNewRoom6->SetNorth(pNewRoom7);
	pNewRoom7->SetSouth(pNewRoom6);
	pNewRoom8->SetEast(pNewRoom);
	pNewRoom8->SetNorth(pNewRoom9);
	pNewRoom9->SetSouth(pNewRoom8);
	pNewRoom9->SetEast(pNewRoom5);
	pNewRoom9->SetNorth(pNewRoom10);
	pNewRoom10->SetSouth(pNewRoom9);
	pNewRoom10->SetEast(pNewRoom6);
}
class Hero
{
public:
	void SetCurRoom(Rooms* next);

private:
	vector<string> inventory;
	Rooms*CurrRoom;
};
class Enemy
{
public:
	int m_Damage;

	Enemy();
	void Attack() const;
};

Enemy::Enemy();
m_Damage(10)
{}

void Enemy::Attack() const
{
	cout << "Attack inflicts" << m_Damage << "damage points.";
}

class Boss : public Enemy
{
public:
	int m_DamageMultiplier;

	Boss();
	void SpecialAttack() const;
};

Boss::Boss() :
m_DamageMultiplier(2)
{}

void Boss::SpecialAttack() const
{
	cout << "Special Attack inflicts" << (m_DamageMultiplier * m_Damage);
	cout << "damage points!\n";
}
void Hero::SetCurRoom(Rooms*next)
{
	CurrRoom = 0;
}
int main()
{
	Map GameMap;
	Hero Steak Hunter;

	cout << "Creating an enemy.\n";
	Enemy enemy1;
	enemy1.Attack();
	
	cout << "\nCreating a boss.\n";
	Boss boss1;
	boss1.Attack();
	boss1.SpecialAttack();


	system("pause");
	return 0;
}
You might have better luck asking this question on gamedev or allegro.cc or some other gamer site. Your question is way too broad.

best.
Topic archived. No new replies allowed.