Sign in to follow this  
  • entries
    78
  • comments
    138
  • views
    35518

Entry 4: My Text RPG

Sign in to follow this  

75 views

I cannot believe it's almost 6pm already! The New Year is approaching, so happy New Year to everyone! I finished up my Menu System at last, but ran into a problem with displaying the Weapon Name right which is fixed now. My Menu System may be complete, however I still need to add all of the items I plan to have in the game under the Sell Menu, which can be added at any time with no effort really.

For anyone who would like to see my "very horrible" code you can view it any time by clicking the link below. Be warned, those who are experienced in OOP and C++ all together might go blind.

- OLD SOURCE CODE

I'm going to work on the Battle System now and fix up the drop system. I did add a poison feature just as something new to add. Once I've finished all of that my Sell Menu will be updated. For now I'm not going to have a five inventory space feature and just keep it at one. However when you defeat any enemy and if you get an item drop you have the option of either selling (Using my Auto Sell feature) or selling your current weapon and equipping the new one on the spot. Now I know it's not realistic, but it would be better then just asking to drop your 6000 Gold weapon to pick up the new one and loose the sell value. There's a lot I'm wanting to do, but I'm not going to over kill this game because I've been looking at using HGE for awhile to get started on getting some graphics on the screen before I use SDL. If I can make a Text RPG, I don't see why I cannot program one with graphics soon after, excluding the fact that you need to keep track of collisions, ect...)

Well I'm going to program as much as I can before the New Year fun begins! I'm glad everything is working good so far.
Sign in to follow this  


2 Comments


Recommended Comments

Hi MrCpaw,

Congratulations on getting as far as you have!

Since you posted a copy of your code, I'm assuming you'd like a little feedback. I'm sure you know that there is a lot that could be improved, but I'm just going to suggest a few small changes that I hope will make things easier.


(1) Try to use a consistent naming convention. You have member function names like MenuSystem() and ALREADY_HAVE_A_WEAPON(). Pick one convention and stick to it.


(2) Passing lots of parameters into functions is not easy to read. Try to use a few as possible. In particular, if some data are always getting pass around together consider grouping them in a struct or class, i.e. in void Menu::MenuSystem(int& MS_PlayerGold_TEMP, int& MS_PlayerHP_TEMP, int& MS_PlayerHPMAX_TEMP, string& MS_PlayerWeaponName_TEMP, int& MS_PlayerWeaponNumber_TEMP, int& MS_PlayerExp_TEMP) you are passing a whole lot of data that seems to be related to the player, so why not put that data into a player class and just pass the player around?


class Player
{
// player stuff...
};

void Menu::MenuSystem( Player& player )
{
// menu stuff...
}




(3) If you find yourself writing pretty much the same thing over and over again, ask yourself whether it can be handled more generally.


// A specific case
void Menu::DONT_HAVE_A_WEAPON()
{
std::cout << "\n\nYou Don't Have A Weapon To Sell!";
std::cin.get();
}

// A more general solution
void Menu::PrintErrorMessage( const std::string& message )
{
cout << "\n\n" << message << "\n";
std::cin.get();
}




Anyway, good work!

Share this comment


Link to comment
Thanks for the feedback!

I'm going to redo some code so I have have everything grouped together as much as possible. I had a feeling that it was going to be a lot to deal with later on. With my Battle System it would help a lot because I'll be keeping track of a lot of things.

Thanks again for your input. :)

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now