Game character creator using classes

Viewed 53

I need help with a character creator program for a video game using classes where I can choose the class of the character and aspects such as hair color, eye color, and body type. Here's what I have so far:

.cpp file:

#include <iostream>
#include <string>
#include <sstream>

#include "OtherFiles.h"

using namespace std;
string skintone, bodytype;

int main()
{
    myClass aRef;
    aRef.bFunction();

    cout << "Welcome to the character creator!";
    cout << "\n\n";
    system("pause");
}

void myClass::cFunction()
{
}

void myClass::bFunction()
{
    cout << "\Hello from B function\nWrite a number - ";
    getline(cin, check);

    num = inputCheck(check);

    if (num > 10)
        cout << "\nOther than 10";

    cFunction();
}

int myClass::inputCheck(string input)
{
    if (input == "")
    {
        input = "a";
    }

    while (input.find_first_not_of(nums) != string::npos)
    {
        cout << "\nInvalid input, Try again - ";
        getline(cin, input);
    }
    stringstream(input) >> output;
    return output;
}

header file:

#pragma once

using namespace std;
class myClass
{
    void cFunction();


    string nums = "1234567890";
    int output = 0;

public:
    string check;
    int num = 5;

    void bFunction();

    string selectedHair;
    string hairChoices[5] = { "long", "wavy", "braids", "spiky", "short" };
    string selectedSkinColor;
    string skinColorChoices[5] = { "white", "peach", "lightskin", "brown", "black" };
    string selectedBodyType;
    string BodyTypeChoices[5] = { "lanky", "burly", "compact", "built", "hoganesque" };
    string selectedEyeColor;
    string EyeColorChoices[5] = { "black", "brown", "blue", "green", "red" };
    string selectedClass;
    string ClassChoices[5] = { "Brawler", "Agent", "Hustler", "Soldier", "Enforcer" };
    string selectedStartingWeapon;
    string StartingWeaponChoices[5] = { "M16A4", "DesertEagle", "BrassKnuckles", "RPG", "MP5"};
    string selectedPerk;
    string PerkChoices[5] = { "Marksman", "Carnage", "Ninja", "Driver", "Matrix" };
    int inputCheck(string input);
};

All I need to know is how to use the two functions available to create the program I need.

Also the program should look and function similar to the one in this folder https://drive.google.com/drive/folders/1nPvI7CIRDawMswRGDnH7wDXKF6-jEx3B?usp=sharing

I would appreciate any help on this.

0 Answers
Related