Thread: holding a reel in my prog

  1. #1
    Registered User
    Join Date
    May 2002
    Posts
    84

    holding a reel in my prog

    can someone help, i have my prog running but the hold reel function won't work. this is the spin reel function.

    game::play()
    {
    cout<<"Welcome to the Vegas Fruit Machine\n";

    reel1.spin();
    winningline[1] = reel1.getcurrsymbl();

    reel2.spin();
    winningline[2] = reel2.getcurrsymbl();

    reel3.spin();
    winningline[3] = reel3.getcurrsymbl();

    cout<<"Reel 1 Reel 2 Reel 3"<<endl;

    cout<<winningline[1]<<" "<<winningline[2]<<" "<<winningline[3]<<" "<<endl;

    cout<<"After spin your credit is:- "<<credit<<endl;
    credit--;
    i have a hold reel variable set as a bool, and the player is asked whether they want to hold the reel. trouble is if answer is yes the reels will still spin. how can i program them to hold if the holdreel1 value is true, after asking the player and their answer is converted to a true or false answer.

  2. #2
    Just a Member ammar's Avatar
    Join Date
    Jun 2002
    Posts
    953
    I'm not sur if I understood your question, but I think you should add an if statement before calling the spin() function, so that the reel doesn't spin unless the user says so...
    Is this what you mean?!
    none...

  3. #3
    Registered User
    Join Date
    May 2002
    Posts
    84
    so say for e.g.

    if (reel1hold = true)
    {
    don't spin
    }
    else
    {
    reel1.spin();
    winningline[1] = reel1.getcurrsymbl();
    }?

  4. #4
    Just a Member ammar's Avatar
    Join Date
    Jun 2002
    Posts
    953
    Yes you can write that, or you can write it this way:
    Code:
    if ( !reel1hold )
    {
         reel1.spin();
         winningline[1] = reel1.getcurrsymbl();
    }
    and the result is the same
    none...

  5. #5
    Registered User
    Join Date
    May 2002
    Posts
    84
    thanks for your help

  6. #6
    Registered User
    Join Date
    May 2002
    Posts
    84
    this generates a problem though. if i hold the last reel only, the the first 2 reels give out the same value each time.

  7. #7
    Just a Member ammar's Avatar
    Join Date
    Jun 2002
    Posts
    953
    Why?!
    Each time you spin() the reel, you are supposed to generate a random number, isn't it?
    Then you shouldn't have any problem, you should check your program, there must be something else that's wrong, because if you didn't generate a random number for reel 3 you can still generate random numbers for reels 1 and 2.
    none...

  8. #8
    Registered User
    Join Date
    May 2002
    Posts
    84
    will have to have a look at it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. need help making a dot bounce up and down y axis in this prog
    By redwing26 in forum Game Programming
    Replies: 10
    Last Post: 08-05-2006, 12:48 PM
  2. YangHui triangle print test prog?
    By toysoldier in forum C++ Programming
    Replies: 8
    Last Post: 08-20-2004, 08:46 AM
  3. an option at the end of this prog to ask if I want to run again
    By bandito9111 in forum C++ Programming
    Replies: 2
    Last Post: 03-31-2003, 02:30 PM
  4. Idea: Elevator Prog
    By gamer4life687 in forum Contests Board
    Replies: 0
    Last Post: 11-15-2002, 10:01 PM
  5. Try my prog...
    By Commander in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 05-09-2002, 07:43 AM