Advertisement

RPG Problems

Started by March 24, 2002 07:47 PM
41 comments, last by Quantrizi 22 years, 8 months ago
No, that isn''t what I''m saying. You don''t type ''void'' in front of the function when you call it. You call it the same way you''d call any other function.

Also, change iostream.h to iostream, and fstream.h to fstream. You can also include standard C headers by dropping the extension and adding a ''c'' in front of them (such as cstdlib for stdlib.h). The way you are doing it now is not the correct way (even if that''s what your book says). Don''t forget that everything in the new headers is included in the std namespace, so you need to specify that namespace when using them.
Ok, thanks. I''ll do all of that right now and see what happens.
Advertisement
a void pointer can be any data type, but it can''t be changed without typecasting.

For example:

void* pi
pi=3/27

(int)pi=3.14
---START GEEK CODE BLOCK---GCS/M/S dpu s:+ a---- C++ UL(+) P(++) L+(+) E--- W++ N+ o K w(--) !O !M !V PS- PE+Y+ PGP+ t 5 X-- R tv+ b+ DI+ D G e* h! r-- !x ---END GEEK CODE BLOCK---
Ok, I got the void problem fixed, but now onto my class. My class is set up like this:

  class Player{ public:       int name;    int hp;	int maxhp;	int mp;	int maxmp;	int money;	int armor;	int str;	int speed;	int exp;	int magic;	int magicresist;	int lvl;	int potionsplayerhas;	int ethersplayerhas;	const int prof;	int randspeed;	int magicrand;	int totalskillsused;	int strrand;	int inbattle;	int poisontoken;	int antidotesplayerhas;};class Enemy{    public:    int hp;	int maxhp;	int mp;	int maxmp;	int money;	int armor;	int str;	int speed;	int exp;	int magic;	int magicresist;	int lvl;	int potionsplayerhas;	int ethersplayerhas;	int prof;	int randspeed;	int magicrand;	int totalskillsused;	int strrand;	int inbattle;	int poisontoken;};class Boss{    public:    int hp;	int maxhp;	int mp;	int maxmp;	int money;	int armor;	int str;	int speed;	int exp;	int magic;	int magicresist;	int lvl;	int potionsplayerhas;	int ethersplayerhas;	int prof;	int randspeed;	int magicrand;	int totalskillsused;	int strrand;	int inbattle;	int poisontoken;};  

but I want to change the PLAYER stuff, would I do it like any other time using int armor=10, or is it another stressed out way
First, you would have to make a player. Objects are just real life models. To make a player, you would put in: Player One
To make 2 players, you would type: Player Two
Each player is different, and has it''s own set of variables. To access a Player variable, you would use One.maxhealth = 1;
You would do the same for the players, enimies, or any other class you create.
HibikiWheres the any key?www.geocities.com/dragongames123/home.html
find your elementat mutedfaith.com.<º>
Don''t forget your semicolons in Player One; and Player Two;
HibikiWheres the any key?www.geocities.com/dragongames123/home.html
find your elementat mutedfaith.com.<º>
Advertisement
Heres a note, use structs when your data is only variable not functions
---START GEEK CODE BLOCK---GCS/M/S dpu s:+ a---- C++ UL(+) P(++) L+(+) E--- W++ N+ o K w(--) !O !M !V PS- PE+Y+ PGP+ t 5 X-- R tv+ b+ DI+ D G e* h! r-- !x ---END GEEK CODE BLOCK---
Ok, thanks. So I take it I have to use pointers in this....don''t get me wrong, I know about pointers and stuff, just ain''t my greatest friend for programming.
Ok, can anyone point me in the right direction for using those??
You need to think about your design a little bit. This isn''t OOP at all.

Also, I don''t think the book you''re using is a very good one. You may want to consider buying a different one.

This topic is closed to new replies.

Advertisement