Untitled
raw download clone
CPP
views 77
,
size 3105 b
///////////////Player.cpp

#include "player.h"
#include "enemies.h"
#include <iostream>
using namespace std;


//Methods



//Functions
void Player::nickname()
	{
		cout << "Type your PlayerName: \n";
		cin >> name;
	}
void Player::showStats()
{
   cout << " | Name: " << name << "\n"
		<< " | HP: " << hp << " / " << hpMax << " | "
		<< " Damage: " << damage 
		<< " | Energy: " << energy << " / " << energyMax << " | "
		<< " Armor: " << armor << " | " << "\n"
		<< " | Level: " << level << " | " << " EXP: " << exp << " / " << expMax << " | "
		<< " Gold:  " << gold << " | " <<  "\n"
		<< " | Stat points: " << statpoints << " | " << "\n\n";
}

//Abbilites
void Player::firstAbb()
{


}

//Set attributes
void Player::setExp()
{


}

void Player::setGold()
{
	gold += 50;
}

//Constructors and Destructors
Player::Player(string n, int hpp, int hpmx, int dmg, int eng, int engmx,
	int ar, int lvl, int ex, int exmx, int gld, int stsp, int crit)
{
	name = n;
	hp = hpp;
	hpMax = hpmx;
	damage = dmg;
	energy = eng; 
	energyMax = engmx;
	armor = ar;
	level = lvl;
	exp = ex;
	expMax = exmx;
	gold = gld; 
	statpoints = stsp;
	critChance = crit;

}
Player::~Player() //DESTRUCTOR
{
}

/////////////Player.h

#pragma once
#include<iostream>
using namespace std;

class Player
{
private:

	//Stats
	string name;
	int hp;
	int hpMax;
	int damage;
	int energy;
	int energyMax;
	int armor;
	int level;
	int exp;
	int expMax;
	int gold;
	int statpoints;
	int critChance;

public:

	//Methods
	void nickname(); //tworzenie gracza
	void showStats(); //statystki hud
	void setGold();
	void setExp();

	//Abbilites
	void firstAbb();
	


	//Constructors and Destructors
								
	Player(string = "PlayerName", int =100, int =100, int = 65, int=100, int =100, int = 0, 
		int = 1, int = 0, int =100, int =0, int =0, int = 0); //constructor

	~Player(); //destructor
};

//////////////////////AdventureMenu.cpp

#include "AdventureMenu.h"


// Functions

void AdventureMenu::showMenu()
{
	showStats();
	cout << " --- ADVENTURE MENU --- " << "\n\n"
		<< " (0) Exit to main menu " << "\n"
		<< " (1) Go an Adventure! " << "\n\n";
	getChoice();
}
void AdventureMenu::getChoice()
{
	cout << " Enter your choice: ";
	cin >> choice;
	switch (choice)
	{
	case 0:
	{
		MainMenu Main;
		Main.showMenu();
		break;
	}
	case 1:
	{
		adventure();
		system("pause");
		break;
	}
	default:
		cout << " Not a valid option!";
	}
}
void AdventureMenu::adventure() 
{
	int timer = 10;
	Sleep(1000);
	while (timer >= 0)
	{
		showStats();
		cout << " --- ON ADVENTURE --- " << "\n\n";
		cout << " | Time remaining: " << timer << " | " << "\n\n";
		Sleep(1000);
		timer--;
	}
	
	Player P1;
	P1.setGold();
	cout << "DROP: " << "\n";
	system("pause");
	showMenu();
}
void AdventureMenu::showStats()
{
	system("cls");
	Player P1;
	P1.showStats();

}










//Cons/Destructor
AdventureMenu::AdventureMenu()
{
}
AdventureMenu::~AdventureMenu(){}
close fullscreen
Login or Register to edit or fork this paste. It's free.