test..

i need to make a txt based RPG not a whole game...
but their's an enemy... with health and an attack... and after we kill one... another one must appear...and it must register a hit detection and have a pause/sleep mode.... can any1 help out???
Sleep mode? I don't get it. Also any game this simple in C++ will be turn based so a pause button is kind of useless. As for another enemy appearing that's called an outerloop. What exactly is your skill level? This is a 10 minute project if you skip the whole story line thing.
What's up with all the ellipses where periods are supposed to be in a grammatically correct sentence?
You can define classes for the enemy and player containing their statistics. (You could derive them from the same base if only a few methods are different or even make them the same class if you have two identical systems and stats. In fact, I'd advise that you make them from the same class unless you plan on making them polymorphic, and if you don't recognize that term it is probably not a better place to start than any other.) Each "unit"'s attack function is passed an object to target - an enemy for the player, the player for an enemy. It calculates damage and inflicts it to the target's health (whatever your damage formula is, that's your problem). You may want to make the classes friends of each other to accomplish this, which means you'll need to declare one, define the second one, and then define the first one (this will allow you to declare the first one as a friend in the second one). Every time an enemy's health hits zero, you'd reset the enemy so that it's, effectively, a new foe. You could perform this management in main or create a check method to handle it. You would probably just keep going until the player's health hits zero. (at which point they are presumably dead)
If this is turn based it shouldn't be too rough. If it's real time you're going to be quite utterly screwed unless your skill level is fairly high.
And I don't see what you mean by hit detection. If it's a text based RPG, what exactly are you detecting?
Topic archived. No new replies allowed.