0

Project C++: A player engine for RPG fighting

Hello everyone,

I'm beginner programmer and got a task to finish but I'm lost. Please help me to start the project:

An engine is needed to create a player and non-playable character objects. Players will require an inventory of Weapons, Armor, and potions. Each fighter can equip armor and a weapon. Characters will start at a level one. At this will give them an attack power of 1, and a defense of 1.

Health is the number of health points player has.

Attack is the damage done to an enemy

Defense is how well you defend when attacked. The enemy must roll better than this to hit you.

Experience is the minimum needed to reach a specified level.

player stats level 1 level 2 level 3 level 4 level 5 level 6 level 7 level 8 level 9

Health 10 15 20 25 30 35 40 45 50

Attack Power 1 2 3 4 5 6 7 8 9

Defense 1 2 3 4 5 6 7 8 9

Experience 0 20 40 80 160 220 440 880 1760

Weapons tell how well you can attack. The weapon must be equipped to use. Power bonus is added to players attack power during attack. This determines how much damage is dealt with an enemy if hit.

Weapon Sword Axe Dagger of Striking

Roll min 0 1 5

Roll max 10 10 15

Power bonus 0 1 3

Armor, when equipped, adds to defense, making player harder to hit during an attack.

Armor None Leather Chainmail

Defense bonus 0 1 3

Potions can be part of inventory and are needed for healing. (restoring health points of player).

For part one create player objects and inventory objects. Use test driver function calls to test that they are being created and that accessors and mutators work.

(Driver functions are functions used for testing and debugging.)

After creating your objects, the game needs to have a controller (or engine) to run. This is a recommended model of how to manage the game flow. (note if you have a different method that is ok as long as requirements are met.)

The structure of your main should be like the following:

int main()
{
       int choice = RUN;
       Game_Engine game;
       do
       {
             game.ShowTitle();//Shows title Screen enter to go to main menu;
             choice=game.mainMenu();//shows menu at least 2 options; 1 play, 2 quit.
             if (choice == RUN)
                     game.run();//runs game
              else if (choice == TEST)
                     game.test();//runs debugger not displayed in main menu as choice
       } while (choice != QUIT);
       cout << "Till next time" << endl;
              return EXIT_SUCCESS;
}

This will run the game till I choose to quit. The bulk of the code will actually occur in the Game_Engine function run().

Note that I have a separate function called test that will allow me to run test code. I have made the choice value for this 99 (const int TEST = 99). I did this so I can call the test without the user knowing the debug option.

When the game starts, you should have a display similar to this:

Text Fighter v0.1
(((Press Enter)))

1: Play Game
2: Quit

Playing the game will then run the actual game. Thus generate the player character set the level, health, beginning armor.

A scenario should output; something like “An enemy comes into view ready to attack you. What do you do?” At this point a menu of options can show with options to attack, take potion (this is usually to heal), or run.

Attack will commence player to run an attack function against the enemy. Something like player.Attack(enemy);

After the player attack, the program should check if the enemy has health remaining. If not battle is over and rewards can be issued to the player. The player should have the option to equip and new weapons or armor (this can be done automatically if that’s simpler.) experience should be rewarded. And then the player goes to next battle.

If the enemy does not die (enemy.currentHealth!=0 ) then enemy should attack; enemy.Attack(player);

If player health falls below 0 then player dies and the current game run should end. This should send the game back to the main menu.

Requirements for Grade:

These need to be present:

Player Object Class

Weapon Object class

Armor Object Class

Title Screen

Test Function

Used to test object creation and unit test functions

Game Engine

In game menu (or help display with control options)

Battle logic

Reward logic

Header file structure

These standards need to be met:

Program runs (no syntax errors)

Code is readable

Logic is clean (clean of most logical errors)

3
Contributors
4
Replies
22
Views
1 Week
Discussion Span
Last Post by Sam David
3

You might as well have said "I have the following code:"

int main() {

}

"I just need a little help with the middle."

Please read this thread for suggestions on how to post meaningful questions. You might get some ideas as to what is expected of you before you post.

Edited by Reverend Jim

Votes + Comments
+1 for seasoned advice and a link on how to prepare and pose questions.
Good advice from one of our most experienced members
-2

I asked to help me start it...
If you don't have an answer or can't help, keep your words for yourself and let the experts help me if it's over your skills...

Edited by Sam David

Votes + Comments
Yep, being rude to people is the way to get help. Nice one...
2

Sam:
You have not asked a sensible question. We have no idea of what you already know or what help you need. Please read the link RJ gave you and then try again. We do help people, but only those who show some effort and ask answerable questions.

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.