rpg

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#include<iostream>
#include<cstdlib>
using namespace std;

int chars[]={};


class character
{
    private:
    int m_friends;
    int m_enemies;
    int m_health;
    int m_damage;
    int m_power;
    int m_life;
    public:
    void sethealth(int h);
    void friends();
    void enemies();
    virtual void addhealth(int &ah);
    virtual void adddamage(int &d);
    virtual void damageopponent(int daop);
};

void character::sethealth(int h)
{
    m_health=h;
}
void character::adddamage(int &d)
{
    m_health-=d;
}
void character::addhealth(int &ah)
{
    m_health+=ah;
}



class dog : public character
{
    int doglife;
    public:
    virtual void addhealth(int &ah)
    {
        ah=4;
        cout<<"You healed about "<<ah<<" life.";
    }
    virtual void damageopponent(int daop);
    void setdoglife(int dl)
    {
        doglife=dl;
    }

};

class teammate : public character
{
    int teammatelife;
    public:
    virtual void addhealth(int &ah)
    {
        ah=4;
        cout<<"You healed about "<<ah<<" life.";
    }
    virtual void damageopponent(int daop);
    void setteammatelife(int tl)
    {
        teammatelife=tl;
    }

};


class ninja : public character
{
  int ninjalife;
    public:
      virtual void adddamage(int &d)
    {
        d=-4;
        cout<<"You hurt about "<<d<<" life.";
    }
    virtual void damageopponent(int daop);
    void setninjalife(int nl)
    {
        ninjalife=nl;
    }
};

class snake : public character
{
     int snakelife;
    public:
     virtual void adddamage(int &d)
    {
      d=-4;
      cout<<"You hurt about "<<d<<" life.";
    }
    virtual void damageopponent(int daop);
    void setsnakelife(int sl)
    {
        snakelife=sl;
    }

};




int main()
{
system("title RPG GAME");

}


this is my rpg game,it isnt finished like you see but i wanna tell me if it is good until now?
also can help me ,so what should make later?
No, it's not good.

You're using an abstract baseclass for common member variables, but you're not using them. You have m_health, so why does each leaf class still get a separate "snakelife" or "ninjalife"?

I'm getting the feeling that you copied the base class from a tutorial somewhere, but didn't read beyond that.
NONO man,i am just programming 1,5 months and c++ is my first and i am 15-16
i am trying to make a big game which other make it in 4 months.I created alone i tell the truth.What should change?
Gaminic made the point here. It seems you are using c++ without the proper understanding of OOD programming.

Learning c++, ood thinking and techniques -> creating larger projects to gain practical experience.
Not the opposite.

Finish some free tutorials/books online and then move to harder projects.

ps. when you will learn basic OOD and you will still aim to create "big game" start with base concept, game mechanics, etc. before writing any code.
Topic archived. No new replies allowed.