Entry 6: My Text RPG

Published January 02, 2009
Advertisement
I've finished programming everything I had before from the ground up all over again. It didn't take too long but the design is much better. Thanks to jjd for pointing out that I should just pass Player around instead of Gold, Hp, Name, Weapon, ect... I should of thought of this in the first place. I guess it's going to take a little bit before I really start taking advantage of OOP. Since OOP is still new to me and I haven't used it until now, messing up here and there will happen.

Here is my new Menu System:

http://members.gamedev.net/mrcpaw/Source/CPP/Menu.cpp

I know I could of made the Selling Shop neater and did the checks much neater but It works all the same.

Now I'm off to bed and hopefully when I start working in the morning I can finish up the rest of the Battle System. I hope I finish all of this before I gotta go back to work on Monday. I'm really looking forward to getting some graphic games done soon!

Thanks for the feedback and comments! Night!
Previous Entry Entry 5: My Text RPG
0 likes 4 comments

Comments

Swattkidd
Good work! Nice to see that you are taking the time to actually put thought into the design and really learn OOP!

Also, I am not sure but on this line

cout << "\n\nWeapon: " << PlayerOne.PlayerSetWeapon();

Shouldnt you call PlayerOne.PlayerGetWeapon()? Just thought I would point that out just in case. (also since its in the player class, it doesnt really need to be called PlayerGetWeapon etc, it could just be getWeapon())...

Oh, and for your message system where you say things like weapon sold, not enough gold, etc...

You could just have one function where you pass a string and print it out, that way in a situation where the player does not have enough gold you can just call
PrintMessage("Not enough gold");, rather then having a whole bunch of small functions.

Just some suggestions for things that I saw, I am no way a pro or anything so yea..haha, keep up the good work though i enjoy keeping up with this journal.
January 02, 2009 04:51 PM
MrCpaw
Thanks for giving me feedback on my code. :)

Not sure if I'm answering this right, but here I go. The reason why I have small functions to display messages would be to prevent any typos so I don't have to look at each part where I type cout << "Message" to see what I did wrong. The other reason would be, if I need to change that message in the future from "Not Enough Gold" to "You're Low On Gold" all I have to do is change that message in the function to change the display of my message anywhere it's called. It just makes it easier for me to keep track of typos and if I want to change my message to something else at a later time.

The part where I call PlayerOne.SetWeapon() was because it stores the current weapon equipped and also keeps track of change in weapons for showing the name. I'm going to be adding in a better Weapon class (Which isn't in use yet) to replace all those "weapon name" you see in the shop for buy and sell with functions that keep track of names, info and how much to give in damage bonus, ect... This will also prevent typos and misinformation from spreading around. It's not going to be a big issue now, but when I get some graphic games done you wouldn't want to have this really powerful weapon that didn't give any +Damage all because of a typo like Posion Axe instead of Poison Axe.

Thanks again for the feedback! :) Now I'm off to finish off the Battle System, fix up the new Weapon System, add new items and pretty much finish this game off. Once I'm done this, other then studying some general programming concepts I didn't go over yet I'm going to start looking at HGE to get started then SDL.
January 02, 2009 05:11 PM
Swattkidd
Ahh I see! One thing though, you could have constant strings put in place..for example

string LOW_GOLD = "You are low on gold"

that way you can just pass those and if you need to change them, then its right there for you to change.

And also I see that you released it, great work!!!
January 03, 2009 12:21 AM
MrCpaw
Ahhh I forgot about doing that. Every time I read up on C++ it's always been said to use const for anything that never changes even if you plan on keeping it the same anyhow. I guess it's just to make it more clear and make it impossible to modify it by mistake. I better keep that in mind for next time.
January 03, 2009 03:50 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement