Re: Assigning values to bitmaps in a sequence :)
- Posted by Roderick Jackson <rjackson at CSIWEB.COM> Dec 02, 1999
- 363 views
David Roach wrote: >Hello all, >This stuff is finally starting to make since to me. Just a little problem. >I am working on my first program, Black Jack. I have 52 bitmaps named >"1-52.bmp". These are loaded into a sequence Deck. Now how do assign values >to the elements in Deck. Lets say the ace of hearts is loaded into >Deck[1] how do I assign it a value of 1 and still keep the bitmap loaded >into that element. Or would I use another element like Deck[2] for the >value of the card. Basicaly I need to have a value associated with a Bitmap >in a sequence. Any help would be greatly apriciated. David, My suggestion would be to use a second sequence for your values. If your card is stored in Deck[1], put the value of it in DeckValue[1]. For a game like yours, this is probably the most efficient way to do it. If for some reason you need to have them together, you can take this approach... -- instead of Deck[1] = {...} -- bitmap of the card -- use Deck[1] = {value, {...}} -- value, AND the bitmap -- now you access the value with Deck[1][1], -- and the bitmap with Deck[1][2]. You can use -- constants to simplify things: VALUE=1, BITMAP=2 -- so that you access Deck[1][VALUE] and -- Deck[1][BITMAP] Rod Jackson