Making of a Pokemon game Day 2

To download the latest project file with the run file , Click Here


We cannot write the whole story of an rpg game in main function. I had to develop a method to put the story together using some kind of external file. I have developed a way to write a story through editing of a text file, main function will just read the text file and follow through the story. Of course, this design is still very rough, but it is just a prototype.


1. Dialogues reading from file



main.cpp: main program



-Special tokens in dialogue.txt:

<INPUT> --> sequence for getting user input

<USERNAME> --> runs user name input sequence

<HERO_INIT> --> initialize hero in the beginning

<MON_INIT> --> initialize monster in the beginning

<BATTLE> --> Start a battle sequence

<TRAINER_INIT> --> Start a battle sequence with a trainer.


-Main.cpp design:

#include <iostream>

#include <fstream>

using namespace std;


#include "monster.hpp"

#include "person.hpp"

#include "battleMenu.hpp"


int main()


    ifstream myfile; ("dialogue.txt");

    string output;

    string userInput;

    string userName;

    Hero* hero = new Hero;

    Monster* pMonster;


    while (!myfile.eof()) {


        if (output == "<INPUT>")


            cin >> userInput;


        else if (output == "<USERNAME>")


            cout << "What is your name young pokemon trainer? " << endl;

            cin >> userName;

            cout << "So your name is  " << userName << "?"<<endl;

            cin >> userInput;


        else if (output == "<HERO_INIT>")


            hero -> SetName(userName);

            cout << hero -> GetName()<< endl;


        else if (output == "<MON_INIT>")


            pMonster = new Pikachu;


        else if (output == "<BATTLE>")




        else if (output == "<TRAINER_INIT>")


            pMonster = createRandomMonster();

            Trainer* pTrainer = new Trainer;

            pTrainer -> addMonster(pMonster);

            pTrainer -> addMonster(pMonster);

            pTrainer -> addMonster(pMonster);

            pTrainer -> GetTrainerInfo();

            pTrainer -> itsTalk();




            cout << output << endl;



    return 0;



- dialogue.txt design:

Pokemon Game Created By: Seyong Cho

Command: (yes: proceed, no: cancel)


Hi, welcome to the world of pokemon.




Uh oh. It seems like a wild pokemon has appeared. Try to catch this monster.




Well done. Now you are ready for a long journey. Take the pikachu with you, and travel the world the pokemon.


You start you adventure, and you meet this trainer who is travelling alone.




-What has been done so far:

now, we can easily write a storyline by just editing the textfile instead of having to write a code.

-Next Step:

Create a map class, with a text file as well, and prepare for the graphical user interface.