Important alert: (current site time 7/15/2013 6:14:36 PM EDT)
 

winzip icon

Fantastic Battle Game

Email
Submitted on: 2/27/2009 9:33:12 AM
By: Uri2 
Level: Advanced
User Rating: By 8 Users
Compatibility: C, C++ (general)
Views: 9651
author picture
 
     A non-graphical RPG game with various functions- fighting, purchasing items, save \ load your character (Save.dat file), and more... ALL RIGHTS RESERVED.

 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 2 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
8/12/2006 1:43:54 PMBrenton Andrew Saunders

Nicely done! 5 out of 5 from me!
(If this comment was disrespectful, please report it.)

 
8/13/2006 8:10:16 AMnuclear_farner

I am a total noob and a cant get this code to work..... plzz its like 8 erorrs in the compilling for me....

(If this comment was disrespectful, please report it.)

 
8/13/2006 12:17:28 PMBrenton Andrew Saunders

Try adding:

#define or ||

at the top of the code.
(If this comment was disrespectful, please report it.)

 
8/13/2006 2:12:33 PMJose Pablo Islas

Very good job! If you would like, I will put an interface on it for you and send it back to you?
(If this comment was disrespectful, please report it.)

 
8/14/2006 1:23:11 PMnuclear_farner

yeah thanks it's just one thing that is wrong one error left invalid macro name whats that a have tried to fix it but as a said before I am a noob ;)
(If this comment was disrespectful, please report it.)

 
6/15/2007 8:59:14 AMyamini

hi good work

(If this comment was disrespectful, please report it.)

 
10/11/2007 6:27:38 AMAdam Ettenberger

just a word of advice, don't post Code if you want to keep all rights, it doesn't turn out very well. Also nice job.
(If this comment was disrespectful, please report it.)

 
10/16/2007 6:10:52 PMAdam Ettenberger

what I ment was if your posting code, thats what makes the program. You can't really expect most people to fallow that (C) if your telling them how to make it, where some people make it even better. Doesn't really matter, I was just pointing that out for you.

But i'm no law expert so I don't know exactly. Just wanted to point out my opinion.
(If this comment was disrespectful, please report it.)

 
2/28/2009 11:38:10 AMmilos chmel

// avoid globals
// use structures
struct Avatar {
double attack, deffense, hp;
int gold;//...
};

// C/Cpp stores constants 'uniquely'
// You can write
if ("mainmenu" == command)
// or
enum {
MAINMENU, OPTIONSMENU //...
};
if (MAINMENU == command)

// You can "abuse" scoping in blocks
if (1) {
int localvalue;
}



(If this comment was disrespectful, please report it.)

 
2/28/2009 11:38:47 AMmilos chmel

// sometimes You can "abuse" structures, arrays, lists
// array
int minuslevel={200,500,100, }; //...
int leveloffset = level-1;
switch (level) {
case 1: case 2: case 3: { cout << minuslevel[leveloffset - 1]; } break;
default: { cout <}
// array, strucutres, scoping
Arena(Avatar a) {
// ...
if (a.chpl <= 0) {
struct Drain { int strdrain, condrain, dexdrain; };
Drain by = {0,0,0};
// scoping
{
// array
Drain draintable[] = { {2, 2, 2}, {4,4,4} };
if (0 < a.level && a.level < 3) {
int offset = a.level - 1;
by = draintable[offset];
}
}
a.str -= by.strdain;
a.con -= by.condain;
a.dex -= by.dexdain;
}


(If this comment was disrespectful, please report it.)

 
2/28/2009 11:39:07 AMmilos chmel

// by "abusing" array You can refactor this
if((Level==1 && Xp1>=200) or (Level==2 && Xp1>=500) or (Level==3 && Xp1>=1000) or
(Level==4 && Xp1>=2400) or (Level==5 && Xp1>=4000) or (Level==6 && Xp1>=8000) or
(Level==7 && Xp1>=16000) or (Level==8 && Xp1>=24000) or (Level==9 && Xp1>=40000) )
{LevelUp();}
// to
int xptolevelup[] = {200,500,1000,2400,4000,8000,16000,24000,40000};
int offset = a.level - 1;
if (xptolevelup[offset] <= a.xpl) {LevelUp }


(If this comment was disrespectful, please report it.)

 
2/28/2009 5:47:47 PMmilos chmel

also You will "rape" stack very hard because sysMenu invokes main and vice versa
(If this comment was disrespectful, please report it.)

 
3/6/2009 9:48:17 AMC++ Guru

calling main() is illegal even if your compiler allows it. Learn to use loops and functions better to avoid calling main().
(If this comment was disrespectful, please report it.)

 
3/11/2009 11:38:13 AMmilos chmel

I don't think it is "illegal" to call main(). It will lead to "void main(void)" in C++ which is not same as "int main(void)" in C.
(If this comment was disrespectful, please report it.)

 
3/11/2009 1:59:58 PMUri2

thanks to all of you
more comments are welcomed..
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.