so here the thing im practicing c++ just started all this is in cmd :P and im making combat simulator as of a project on another forum that i guesed good practice so im doing it but i decided to make 3 classes :archer , mage , barb and i got mini intro now i need to figure out a way to chose wich class the player wants...and im stuck there you guys got tips for me? do i have to make 3 stories ? ore is there a way to juste do if ( i chose archer then im archer ) and forget about barb and mage im sorry if im not very clear im trying tho got ANY ideas? let me know?

Sawm <3

anything could help im going to try until i achieve !

Recommended Answers

All 3 Replies

You might be able to do it as a class array

I dont understand what you trying to do

so here the thing im practicing c++ just started all this is in cmd :P and im making combat simulator as of a project on another forum that i guesed good practice so im doing it but i decided to make 3 classes :archer , mage , barb and i got mini intro now i need to figure out a way to chose wich class the player wants...and im stuck there you guys got tips for me? do i have to make 3 stories ? ore is there a way to juste do if ( i chose archer then im archer ) and forget about barb and mage im sorry if im not very clear im trying tho got ANY ideas? let me know?

I'm not exactly sure what your trying to do either, however it would seem your aiming for a 'pick a class' kind of option after your 'intro' and are unsure how to continue.
Obviously without knowing some specifics it's hard to recommend a specific strategy but i'll outline your general options as I see them.
If your using a command line style program (text games are so last century!) then you'll want to ask the user what character type they desire and parse the string input to see if it contains any keywords or identifiers (IE: strcmp(InputString, "Barbarian")).
If your using some kind of window system interface a good old three buttons will do fine. For anything more advanced your looking at a graphics API and a discussion of GUI and HCI that you'll want team input on.
Once the player type is selected your further options depend somewhat on the use of that data. If they simply pick a class, have some kind of battle and quit then you may simply wish to have a basic 'PlayerType' (C++)class with barbarian, mage, etc inherited from it. You could then store a base pointer in the player information (strut?) and set it dependant on what kind of character the player chooses.
If your going to need any kind of permanent storage of the users character (saving the game, MMO, etc) then you'll want to have a player class with support for all classes that is parsed differently depending on an Enumerated value or alike. That way you can simply write the players information to a file and load it later without needing to worry about where things are stored or pointers.

anything could help im going to try until i achieve !

That's a great attitude to have! your sure to succeed, however the invaluable aid the oracle of us many internet people can only be summoned with detailed information.
Simply saying 'I'm making something what do I do' won't really cut it, we need to know what your doing, how your doing it, with what, when and what you have so far. Then we can comment on the many paths that lie before you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.