Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mandude

macrumors member
Original poster
Nov 19, 2009
64
0
ok so im working on a card game right now and i know that i dont know everything in coding but im just trying to start off my card game by dealing four cards at random to the player. The four cards for now would simply appear instantly on the bottom of the screen, ill worry about animating them later. I have 52 card face PNG images in my xcode project, and i need to be able to randomly choose one of those 52 PNG's every time the cards are delt, four at a time. I was thinking along the lines of putting all 52 PNG images of the cards into an NSMutableArray, and randomly selecting an object (PNG image) from that array. i would then have four ImageViews on the bottom of the screen and then set the Imageview's image to be the randomly selected PNG images. After the Png images appears at the bottom of the screen they must be removed from the Array because you can't be dealt two of the same card in a game of cards (you cant have two 3 of clubs in a deck etc.). Also these PNG images that appear will need to be able to be touched by the user when the player wants to throw cards out of their hand and perform combinations and whatnot. Help on the basics of how to do this is much appreciated and please dont tell me what i need to read or what to look up because im fully aware just asking so i can learn for the future thanks!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.