Results 1 to 8 of 8

Thread: I need help with a game i wanna make

  1. #1

    Thread Starter
    Lively Member Lord Rayv3n's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    65

    I need help with a game i wanna make

    im including a pic. each one of the buttons are OptionButton, and what i need is way to get a random button to become true when the current button that is true is clicked.
    oh and also need a way to count how many buttons the player has clicked.
    i would be greatfull for any help i could get.

    Attached Images Attached Images  

  2. #2
    Member 110359's Avatar
    Join Date
    Jun 2002
    Location
    Melbourne, Australia
    Posts
    43
    The easy way to keep count of how many buttons has been pressed is to use a text box or label. I'll assume the label is called count and I'll just use button1.

    This code should be put into the buttons command:
    count.caption = count.caption + 1

    Just put that in for every button.
    Why is it that when you kill one man people call you a murderer and when you kill one thousand you are a conqueror?

  3. #3

  4. #4
    Member 110359's Avatar
    Join Date
    Jun 2002
    Location
    Melbourne, Australia
    Posts
    43
    Glad to be of asistance. I'm not 100% sure of how to get a random button selected, but it probably needs something like a control array.

    110359
    Why is it that when you kill one man people call you a murderer and when you kill one thousand you are a conqueror?

  5. #5

    Thread Starter
    Lively Member Lord Rayv3n's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    65
    well im not sure.
    and when i thought about this game i thought it would be an easy one. lol
    it was easier to make a mp3 player that doesnt s rely on the windowsmedia.ocx

  6. #6
    New Member
    Join Date
    Jun 2002
    Posts
    7
    to have that random stuff, cant you just give each button a number and then make the program make a random nunber and....yeah, see what i mean?

    or give each row a number, each coloumn a number and do the same thing?
    I have always wondered...what program did they use to make VB?

  7. #7
    Junior Member
    Join Date
    Jul 2002
    Location
    Montreal, Québec
    Posts
    20
    To keep track of how many clicks there are, you just need a variable. Let's suppose we call it n_Clicks. You'd do n_Clicks = n_Clicks + 1 every time a button is clicked.

    As for a random button being selected... It would be much easier to create a control array. Just create a single button in the upper-left corner and call it, say, ClickButton. Give it the index '0'. Next, using for... to...'s, spawn all your buttons in your Form_Load. They'll all have a unique number. Create a variable to hold the current button being clicked (like, say, CurrentButton). When the user clicks it, do the following...

    ClickButton(CurrentButton).value = vbunchecked
    CurrentButton = int(rnd * (max amount of buttons))
    ClickButton(CurrentButton).value = vbchecked

  8. #8
    Addicted Member CodeRonin's Avatar
    Join Date
    Jul 2002
    Location
    Vienna, Austria
    Posts
    233

    TIPP:

    Ok, as for the first question:
    I wouldn't use a variable, for you'd need a global one (or a static one) which kinda sucks. I'd use a hidden TB.

    For the second part I agree with Lancer, a ControlArray would be fine, and then just ControlArray.Add new OB's in a loop to build your form....

    You can then ControlArray(rnd(1)*whatever)=true.

    Hope this Helps,
    CodeRonin
    Code Ronin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width