/*
Level 1
*/
#include <iostream>
#include <string>
#include <vector>
#include "Header.h"
PlayerOne(Inventory);// does not work but i want to acces the class inventory from PlayerOne
char userInput[50];
levelOne::levelOne()
{
while (true)
{
std::cout << "You're in a dark room\n>>";
std::cin >> userInput;
std::cin.ignore();
if (!strcmp(userInput, "look"))
{
std::cout << "you can see a barrel and a door" << std::endl;
Inventory.push_back("apple"); //example to add apple into Inventory
std::cin.clear();
std::cin.ignore();
}
if (!strcmp(userInput, "quit"))
{
system("cls");
std::cout << "Quitting" << std::endl;
std::cin.ignore();
break;
}
}
}
----------------------------------------------------------playerOne.cpp
#include <iostream>
#include <string>
#include <vector>
#include "Header.h"
PlayerOne::PlayerOne
{
class player
{
public:
std::vector<int> pos;
};
class Inventory
{
public:
std::vector<std::string> inv; //this is the vector i want to put all my items in.
};
class Life
{
public:
bool life = true;
};
}
---------------------------------------------------Header file(which everything is connected too)
#ifndef HEADER_H
#define HEADER_H
class PlayerOne
{
public:
PlayerOne();
};
class levelOne
{
public:
levelOne();
};
#endif //HEADER_H