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

Entry 1: My Text RPG

Sign in to follow this  

92 views

So I've started off on my text rpg and I must say it's a lot of work for something that only consists of text! I drew up my to do list so I can keep track of my progress. This game wont be huge but it will contain rpg elements.

Just a little history on myself before I go any further. I've been programming for about 6 years now, my main languages were Visual Basic and just BASIC which I used with darkBASIC. I had used C# with XNA for awhile but never really like .NET and have strayed away from using it so I could use C++ to make my own engine. I've been learning C++ for awhile now, on and off for a year now and I must say I enjoy the language! I'm getting use to OOP however since I never used this part of programming until now. I've learned basic C++ along with pointers and references. I also know how to pass pointers, use new and delete. I also know a lot more, however right now I'm currently a bit new to classes so I'm going to be using them in this game.

Now back onto this game. So far I've been working on the Player class and I've setup some basics such as the Name, Min HP, Max HP, Current HP, ect... I've had a few slow downs because I'm still getting use to OOP and I'm trying to get out of using my variables in a global scope and use them under Private then call them through functions.

Player.h


#include
#include

using namespace std;

class Player
{
private:

string sPlayerName; // Player Name
int iPlayerHP_MIN; // Min Health
int iPlayerHP_MAX; // Max Health
int iPlayerHP; // Current Health
int iPlayerAttack; // Player Attack
int iPlayerGold; // Player Gold Drop
int iPlayerItem; // Player Item Drop
int iPlayerExp; // Player EXP Given

public:

// Constructor
Player(string sPlayerName_TEMP, int iPlayerHP_MIN_TEMP,
int iPlayerHP_MAX_TEMP, int iPlayerHP_TEMP,
int iPlayerAttack_TEMP, int iPlayerGold_TEMP,
int iPlayerItem_TEMP, int iPlayerExp_TEMP);

// Player HP Min Set To 0
void SetPlayerHP_MIN();

// Player HP Max - Read Only
int ShowPlayerHP_MAX();

// Player HP - Read Only
int ShowPlayerHP();

// Player Current Health
int SetPlayerHP(int SetDamagePlayerHP_TEMP);

// Player Attack Power - Read Only
int ShowPlayerAttack();

// Player - Gold Dropped
// TO DO . . .

// Player - Item Drop
// TO DO . . .

// Player - EXP Given
// TO DO . . .
};







Player.cpp


#include "Player.h"

// Constructor
Player::Player(string sPlayerName_TEMP, int iPlayerHP_MIN_TEMP,
int iPlayerHP_MAX_TEMP,int iPlayerHP_TEMP, int iPlayerAttack_TEMP,
int iPlayerGold_TEMP, int iPlayerItem_TEMP, int iPlayerExp_TEMP):
sPlayerName(sPlayerName_TEMP),
iPlayerHP_MIN(iPlayerHP_MIN_TEMP),
iPlayerHP_MAX(iPlayerHP_MAX_TEMP),
iPlayerHP(iPlayerHP_TEMP),
iPlayerAttack(iPlayerAttack_TEMP),
iPlayerGold(iPlayerGold_TEMP),
iPlayerItem(iPlayerItem_TEMP),
iPlayerExp(iPlayerExp_TEMP)
{

}

// Player HP Min Set To 0
void Player::SetPlayerHP_MIN()
{
iPlayerHP_MIN = 0;
}

// Player HP Max - Read Only
int Player::ShowPlayerHP_MAX()
{
return iPlayerHP_MAX;
}

// Player HP - Read Only
int Player::ShowPlayerHP()
{
if (iPlayerHP < 0)
{
iPlayerHP = 0;
}
else
{
return iPlayerHP;
}

}

// Player Current Health
int Player::SetPlayerHP(int SetDamagePlayerHP_TEMP)
{
iPlayerHP = iPlayerHP - SetDamagePlayerHP_TEMP;
return iPlayerHP;
}

// Player Attack Power - Read Only
int Player::ShowPlayerAttack()
{
return iPlayerAttack;
}

// Player - Gold Dropped
// TO DO . . .

// Player - Item Drop
// TO DO . . .

// Player - EXP Given
// TO DO . . .







I've been toying around with the HP with a quick battle system I made and it works perfect. Anything under 0 will stay at 0 for the HP and I have set within my loops to consider the Player dead.

Now there is a lot I need to do here and I wont be worrying about Gold, Items or Exp until I get the monsters working. I will be adding a lot more to Player, but for now I'm just adding a one thing the testing it insure it works perfect, then I'll add another thing to work on.

I have made a test game with a dummy monster and so far so good! I'm glad I'll be working on something like this because it's going to be a great learning experience, plus it will also allow me to get into SDL easier if I have a better idea on how to Game Program, even if it's just in text.
Sign in to follow this  


3 Comments


Recommended Comments

Thanks! :)

I always find it easier to use a to do list when working on a project.

I see you also use a to do list on your journal too. I hope your project is going good.

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