Classes

Pages: 1234
Just some more thoughts.

With your code, I should have said it was a pretty good effort - you did well.

About the GUI stuff - there is quite a bit we could do with a library called ncurses. I haven't even looked at it, but I think one could use it to make maps out of chars - eg walls could be = say, Enemies E and so on. It should be possible to have things move about by changing their position in the matrix, could have an update-able status area.

As far as the real GUI's go, I forgot to mention that Qt is free & version 5.0 is due very soon. If you come across a package you like, I could install it on my system (preferably linux rather than windows) while you could put Qt on your system - and we could compare. Or just look at their features on the web first.
SGM, I am having more discussions in this thread.

http://www.cplusplus.com/forum/general/78363/2/#msg426483


Just trying to get the interface right.
Rage function should be protected rather than public, and be called from the RecvAttack function.

I didn't think I could call a derived function into the base. Would I need a setter function to change the health for each enemy? A troll will have more health than say a goblin. I would like to add a "flee" function for a goblin. So would I put that in the recvattack function? Going to have a lot of code for control and checking.


I like QT. Looks promising. I don't know anything about GDKs. So it is hard for me to make an informed decision.

I'm assuming you think we should select a GDK so we have a better idea of how everything will need to be coded. I will download QT.
I had different thought about the rage function.

The simple idea we have at the moment is to achieve "Rage" by increasing the damage value of the weapon. That is fine for now, but I was thinking "Rage" is not really a function of the weapon, it is more an increase in the frequencies and number of strikes with the weapon. That fits into the fight sequence thing I mentioned earlier. As I said it is a more complicated thing - "A whole new kettle of krawldads" :)

I didn't think I could call a derived function into the base.


The Rage function would exist in the CEnemy base class & be inherited by any new Enemy. The Rage function can be called by any function that exists in any of the Enemy classes. If the Rage function is called by another function in the class, then there is no need for it to be public. The idea is to have few public things as possible, and no public variables at all, because these can be altered by any object at any time.

Would I need a setter function to change the health for each enemy? A troll will have more health than say a goblin.


No - setting the health initially is done by a constructor in each class that needs it. Changing the health to reflect damage done is done by the RecvAttack function, and the Weapon.Use() function to retrieve the damage. This function is virtual, so we can redefine it, if we want, to reflect different behaviour. The RecvAttack function is really a 'getter' in disguise, but we can get away with it because it takes an object (or pointer to obj, or reference to obj) as a parameter, and it is virtual, declared in the base class - so these thing make it an interface. interface is a Java keyword and it means to have a virtual or pure virtual functions in the base class, and these describe the way that other objects interact with the object.

I should mention that we are only going to create objects from some of the classes. We do not want to make objects from CActor, CWeapon, CCutting, because these are too general & / or it doesn't make sense to make an object out of them. If we just have 1 player (the hero) then we can make the Hero object from the CPlayer class. However if we had several different sorts of player's on our side like Heroine, Magician, Military, General, Soldier, - then we would derive these from CPlayer. We would make it impossible to create objects from CPlayer and CMililtary. We can do this by making all their constructors protected, and making sure there is a virtual function ( we already have some in CActor). Vlad & Doug4 explained this to me in another thread.

The Flee function could be called from the RecvAttack function.

The RecvAttack function is what controls what happens when something is attacked. Shall I Flee? If I fight, and my health is low, then Rage.

With Qt, did I mention to get Qt Creator? There are several different packages for Qt. The Qt SDK is mainly for phones, I think.

I am going to have a go with the info that has come up from the other threads - and get my version of the code posted.
I don't want it to be a game of chance. A mage will have different spells. The player should be able to use them during combat. As with a potion to heal or replenish mana.
This is really neat. I have watched it over and over again. I would like you to take a look at it. Maybe you can get more out of it.


C++ Programming Issue 1: Introduction to C++
C++ Programming Issue 2: Intermediate Techniques
C++ Programming Issue 3: Introduction to Game Development


The first 3 sets are available on the internet for free. I am assuming they are free, the other videos are not available for download, they put a personal watermark on the videos for copyright reasons. You only need "issue 3" because the other two teach programming and have nothing to do with games.

They make an enemy, character, level, and fireball class which are all inherit a sprite class.

I think we may run into problems designing the weapon, character, and enemy without a "draw engine" and game loop.

Won't be able to respond for a few days. Have to write some papers and have a unit test coming up.
Topic archived. No new replies allowed.
Pages: 1234