Computing.Net > Forums > Programming > VB Solitaire game

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

VB Solitaire game

Reply to Message Icon

Name: Andrew
Date: October 9, 2002 at 07:02:06 Pacific
OS: Windows XP Pro
CPU/Ram: 128
Comment:

I'm making a Solitaire program for a school roject, its written in VB6.0. For the "Deck" butttom (where you click to get the three cards to pop up, if you dont understand start up windows solitaire and see) How could i program it to generate three random cards, that arent already in use, with the pictures on them?



Sponsored Link
Ads by Google

Response Number 1
Name: Spencer Ruport
Date: October 9, 2002 at 08:51:04 Pacific
Reply:

I think the easiest way to approach this would be to make a card class and then make an array of cards.

Dim Card(52) as Card

The card class would need these properties:
.location (certain code for where it's placed on the table)
.name
.faceup (Boolean)
.image (Number referring to the image object index)

You will also need to make an object array of 53 images with the card face. (52 cards plus the back of the card.)

From here you need to make subs such as

NewGame() Where you would make a fresh deck
Shuffle() A shuffling function to swap the cards around
Deal() Changing the location and faceup properties for each card based on it's index value.
Display() Going through your card array and placing the correct image in the area denoted by .location.

I hope this helps. :D
Spencer Ruport


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: VB Solitaire game

Where can I learn to program????? www.computing.net/answers/programming/where-can-i-learn-to-program/14348.html

VBA Shell Function www.computing.net/answers/programming/vba-shell-function/2677.html

My Isometric VB Game www.computing.net/answers/programming/my-isometric-vb-game/14444.html