Skip to content
Permalink
5d65b0a40e
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
84 lines (77 sloc) 1.77 KB
#include <iostream>
#include <string>
class player
{
std::string playerClass;
int level, attack, location;
public:
int hp, experience;
player(int choice)
{
location = "";
if (choice ==1)
{
playerClass = "Superman";
level = 1;
attack = 60;
hp = 100;
experience = 0;
}
if (choice == 2)
{
playerClass = "Spider-Man";
level = 1;
attack = 20;
hp = 100;
experience = 0;
}
if (choice == 3)
{
playerClass = "BatMan";
level = 1;
attack = 40;
hp = 100;
experience = 0;
}
}
std::string printClass()
{
return playerClass;
}
/*BS*/
//Method to output the player stats to the console
void printStats()
{
std::cout << "Player Class: " << playerClass << std::endl;
std::cout << "Player Level: " << level << std::endl;
std::cout << "Player Attack/Strength Level: " << attack << std::endl;
std::cout << "Player HP: " << hp << std::endl;
std::cout << "Player Exp: " << experience << std::endl;
}
//Method to return the player level
int playerLevel()
{
return level;
}
//Method to return the player attack/strength level
int playerAttack()
{
return attack;
}
//Method to return the players hp
int playerHp()
{
return hp;
}
//Method to return the players experience
int playerExp()
{
return experience;
}
//Method to return player location
std::string playerLocation()
{
return location;
}
/*END BS*/
};