Results 1 to 2 of 2

Thread: Need expert VB6 help

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2005
    Posts
    43

    Need expert VB6 help

    I'm developing a nifty slot machine game but having trouble in specifying a winning hand on a combition of bar pictures
    and I need some expert help.

    The game has 3 payout lines across and 3 payout lines down with three images per line.
    I store 11 images in imagelist1 and pull them randomly into the 9 pictures on the form.
    Pictures are named Pic(0) to Pic(9)

    I use the following code to establish a winning row when all three Pic (pictures) are the same type
    eg. 3 tripple bars in the same row.

    ' load random pictures from ImageList1 into the 9 Pic (pictures) on the form
    Dim PicAdd As Integer
    For PicAdd = 0 To 8 'Starts with Pic(0) and till it reaches Pic(8)
    Pic(PicAdd).Picture = ImageList1.ListImages(3).Picture
    Next PicAdd

    Dim AddWin as integer
    If Pic(0).Tag = 1 And Pic(3).Tag = 1 And Pic(6).Tag = 1 Then 'Pic(0).tag = 1 is index 1 in ImageList1
    ' Pic(0) is first, Pic(3) is second and Pic(6) is third pictue in top row
    AddWin = Bet.Caption * 60 ' Bet.caption is amount bet against the row
    lblCredits.Caption = lblCredits.Caption + AddWin
    Exit Sub
    End If

    THAT IS EASY as all three pictures (.tag = 1 ) are the same in ImageList1 index 1
    problem is that I would like to specify a winning row consisting of a mixture of Tripple, Double and Single bars also.
    They are Tripple Bar = index 1, DoubleBar = index 2 and SingleBar = index 3 in ImageList1. As it is selected at random
    it can be any combination of the 3 * 9 Pic (pictures) * 6 winning rows total of 162 possibles.

    The only I can think of is to code as follows:
    If Pic(0).Tag = 1 And Pic(3).Tag = 2 And Pic(6).Tag = 3 Then
    AddWin = Bet.Caption * 60
    lblCredits.Caption = lblCredits.Caption + AddWin
    Exit Sub
    End If

    THIS means reapeating the above 162 times (changing the index numbers around) to cater for any possibility
    eg 112, 113, 121, 122, 123, 221, 211, 213 and on and on
    All the suggestions will beappreciated.

    Greetings from sunny South Africa

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Need expert VB6 help

    How about somthing like this? Assign a different prime number to each picture. Then create a list of the totals for the different winning combinations. After that since the order wouldn't matter, all you would need to do would be to compare the totals in each row with the winning totals.

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