Skip to content
Permalink
Browse files
player.h and main.cpp files
  • Loading branch information
sabatierb committed Feb 16, 2021
1 parent 8dc3abc commit 5d65b0a40e1b9a2b6cb840d67efffaeb318f8a08
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 0 deletions.
@@ -0,0 +1,28 @@
#include "player.h"


int main() {

int choice;

//While loop to chose your player class
while (!std::cin >> choice || choice > 3 || choice < 1) {
std::cout << "Choose your character class. \n[1] Superman [2] Spider-Man [3] Batman; " << std::endl;
std::cin >> choice;
}
//Initalise instance "character" of player Class
player character(choice);

std::cout << "\nWelcome " << character.printClass() << ". Let's begin your adventure. " << std::endl;

//Print out player stats BS
std::cout << "Your starting stats:" << std::endl;
character.printStats();//END BS

while()


std::cin.ignore();
std::cin.get();
return 0;
}
@@ -0,0 +1,84 @@
#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*/
};

0 comments on commit 5d65b0a

Please sign in to comment.