Permalink
Cannot retrieve contributors at this time
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?
adventure-game/player.h
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
84 lines (77 sloc)
1.77 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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*/ | |
}; |