Pokemon classes

I want to try and make a Pokemon fan game from scratch with my friend.He will do the graphics,so i need to make class that will hold Pokemon and their info.I figured it will look something like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
class Pokemon{
public:
      void getPokemonInfo(string Name,int Attack,int Defense){
           switch(Name){
                       case "Charizard":Attack=attack.Charizard;
                                        Defense=defense.Charizard;break;
                       case "Blastoise":Attack=attack.Blastoise;
                                        Defense=defense.Blastoise;break;
            }
      }
private:
        enum Charizard{
                       int attack=100;
                       int defense=100;
        }
        enum Blasotise{
                       int attack=100;
                       int defense=100;
        }
};

Is there any other way to do this or this is the best?
Last edited on
Is it a Console application or a WinAPI application or a 2D application?

Edit : Where is Pikachu?
Last edited on
It will probably be a 3D game(something like XY and ORAS games).

Edit : Does anyone know to do this better or my way is fine(Note i should do that for all 721 Pokemon so i am not sure is that an effective way to do stuff).
Last edited on
I would use your Pokemon class as a base class and make each pokemon derive from it. Something like:
1
2
3
4
5
6
7
8
9
10
class Pokemon {
public:
    Pokemon() : attack(100), defense(100) { }
    virtual void getPokemonInfo();
protected:
    unsigned int attack,
                    defense;
    string name;
    // Other common attributes/data.
};


With the popularity of Pokemon I'm sure you can find some text file that has all the pokemon and their relevent attributes in it. Then, on starting the program, you could parse that file and initialize all the Pokemon (or initialize them as needed, as I'm sure all 721 are not going to be in play at the same time).

EDIT: Found something that might be useful: http://pokemondb.net/pokedex/all You could parse the HTML using an external library to make it easier or write it yourself.
Last edited on
I'm still learning the basics of C++ but I'm pretty sure you can't switch on a string
Topic archived. No new replies allowed.