Enjoy =)
This is a discussion on for those who checked out the first one heres the new one within the C++ Programming forums, part of the General Programming Boards category; Enjoy =)...
Enjoy =)
Hooked On Phonics Didn't Work For Me!
You still left your goto statements in there
Take them out, and use functions.
I posted the end function code in the other thread. You should be able to work out the battle function. But if you've never used functions before, check the tutorials on this site![]()
IDE: Dev C++ 5
Lib: Allegro
OS: Windows 2000
A suggestion... you could try replacing some of those if statement sections with a switch. If you don't know how to use one, I posted a simple example here just a few minutes ago.
>>p = minumum + (int)(rand()%maximum); // Generates Random Number
What's p for? I can't see it being used anywhere (I don't think).
>>srand(time(NULL));
You only need to srand() once in a program.
And seconding fry's comments, get rid of the gotos and create some functions!
Happy coding![]()
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
good battle engine... only thing is when you drink a potion with 100 health you end up with 130 or something like that... you should set it up something like this:
Code:if(health!=maxhealth) { health=health+30; if(health>maxhealth) { int subtract=health-maxhealth; health=health-subtract; } }