the program will EVENTUALLY play the simple game of Hi-Lo (for a science project). the only thing i need help with is i don't know how to get a deck of cards to work. i am kind of a beginner at programming.
it is visual basic 6 programming
all i need right now is for when i click on the top of a deck of cards (the imgRndCard) for the next card in the deck to show in the discard pile. or i don't even mind a command or something, actually, just something to make the deck work.
i already have the code to make the deck random, so please answer with accordance to this code (and ... will this code work? for letting me go through the entire deck then it shuffles and lets me go through again? basically, having it shuffle and stuff correctly?):
'suit order is spades, clubs, hearts, diamonds 'discard pile: top = 480, left = 2520 Dim arrDeck(0 To 51) As Integer Public Sub ShuffleDeck() Randomize 'Makes it so the starting seed is different Dim CardCount As Integer 'This will be my loop counter Dim CardVal As Integer 'This will get assigned the random value CardCount = 1 'Resets card count to 1 Do While CardCount < 52 'This sets every slot in arrDeck to -1 arrDeck(CardCount) = -1 'so that later I can tell if the slot is empty CardCount = CardCount + 1 'or not Loop CardCount = 1 'Resets card count to 1 Do While CardCount < 52 'Loop until every slot is full 10 CardVal = Int((51 * Rnd) + 1) 'Set CardVal = to a random number If arrDeck(CardVal) = -1 Then 'Take random slot and see if there is a card 'in it yet. If there isn't it will be = to -1 'if there is it will be equal to a different 'value. arrDeck(CardVal) = CardCount 'There isn't so put current card in that slot CardCount = CardCount + 1 'Increment my card count Else: GoTo 10 'There is so start again from the beginning End If Loop 'Do it all again if < 52 End Sub
if the code doesn't work then how can i make it work? how do i make this deck of cards work correctly? well, thank you in advance

New Topic/Question
Reply




MultiQuote



|