-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameEngine.cpp
More file actions
68 lines (58 loc) · 1.69 KB
/
Copy pathGameEngine.cpp
File metadata and controls
68 lines (58 loc) · 1.69 KB
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
#include "../include/GameEngine.h"
#include "../include/SaveSystem.h" // ADD THIS LINE
#include <iostream>
#include <string>
using namespace std;
// ... the rest of your code ...
GameEngine::GameEngine() : player(nullptr) {}
GameEngine::~GameEngine() {
delete player;
}
void GameEngine::startGame() {
string heroName;
cout << "--- Create Your Character ---\n";
cout << "Enter Name: ";
cin >> heroName;
player = new Player(heroName);
bool inGame = true;
while (inGame) {
cout << "\n--- WORLD MAP ---\n";
cout << "1. Battle: Forest (Easy)\n";
cout << "2. Battle: Dungeon (Hard)\n";
cout << "3. Save Game\n";
cout << "4. Exit to Main Menu\n";
cout << "Choice: ";
int choice;
cin >> choice;
if (choice == 1) {
Enemy goblin("Forest Goblin", 60, 12, 4);
Battle battle;
battle.startBattle(player, &goblin);
}
else if (choice == 2) {
Enemy orc("Orc Warrior", 150, 25, 10);
Battle battle;
battle.startBattle(player, &orc);
}
else if (choice == 3) {
SaveSystem saver;
saver.save(*player);
cout << "Game Saved Successfully!\n";
}
else {
inGame = false;
cout<<"--------Executing The Program---------\n";
}
}
}
void GameEngine::mainMenu() {
cout << "\n=== BATTLE ARENA RPG ===\n";
cout << "1. New Adventure\n";
cout << "2. Exit\n";
cout << "Choice: ";
int choice;
cin >> choice;
if (choice == 1) {
startGame();
}
}