Click here to Skip to main content
15,893,564 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi,

Im creating a cardgame called UNO, and i've got some images of the cards that i want to use and i wonder how you in a easy way "load" them into your program. Also assign values to them and be able to randomized show up in a picturebox.

Do i have to create a specified array for each card? Like card[x] (imagefrompath(?), value(int), name) etc...

Im pretty new to this so Im thankful for all help. :)
Posted

I see the below link in code project for cards display.., using cards.dll

go through this.., this may help u


Drawing Cards with Cards.dll[^]
 
Share this answer
 
I hate to break it to you, but somebody already invented Uno! :)

But as to your question...you wouldn't have to create an array...there are a lot of ways that you could do this. As far as "loading" them...I would probably do something like this...

Zip all of the images into one file.
Add that file to your resources.
When the program is started, I would unzip the file and extract all of the images and place them in an array. You could follow the numbering convention found in the article from the other answer (that's about the only useful thing for you in it if you are using your own images).
As far as randomization, you can use the Random class in the .Net Framework. Just make sure you keep track of the cards that have already been used if you want a real-life game.

But there are many other ways to do this.
 
Share this answer
 
Comments
Toli Cuturicu 19-May-10 6:32am    
Reason for my vote of 2
way to complicated

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900