for those who checked out the first one heres the new one

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 =)...

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    77

    for those who checked out the first one heres the new one

    Enjoy =)
    Attached Files Attached Files
    Hooked On Phonics Didn't Work For Me!

  2. #2
    fry
    fry is offline
    Registered User fry's Avatar
    Join Date
    Mar 2002
    Posts
    128
    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

  3. #3
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    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]

  4. #4
    Student drdroid's Avatar
    Join Date
    Feb 2002
    Location
    Montreal, Quebec
    Posts
    669

    ...

    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;
         }
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can a menu POPUP be set to CHECKED?
    By Viper187 in forum Windows Programming
    Replies: 7
    Last Post: 06-22-2008, 09:26 PM
  2. Interpreter.c
    By moussa in forum C Programming
    Replies: 4
    Last Post: 05-28-2008, 06:59 PM
  3. class vars checked b4 object needs them?
    By krygen in forum C++ Programming
    Replies: 1
    Last Post: 04-16-2005, 11:58 AM
  4. Radio button is it checked?
    By Bajanine in forum Windows Programming
    Replies: 2
    Last Post: 11-21-2002, 07:08 PM
  5. Running a EXE -Don't Yell! I checked The FAQ...
    By johnc in forum C Programming
    Replies: 14
    Last Post: 07-11-2002, 04:28 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21