Blackjack

Advice on general approaches or feasibility and discussions about game design

Blackjack

Postby AntonyPrince » Mon Aug 11, 2014 10:47 pm

Abandoned my text adventure project in favor of this one. It'll be what the name says... Blackjack. ;) Right now, I have the title screen and the basic game screen design. No actual gameplay code has been written yet. I have all the card bitmaps created. Just have to convert them over to byte maps and code them in. Then the issue becomes fitting them on the screen. I couldn't find a way to create "card" bitmaps smaller than 8x8 so I could overlay them. At maximum, it would require 11 cards to reach 21 (1,1,1,1,2,2,2,2,3,3,3). The chances of that happening are very slim, but you have to consider all scenarios. Of course, 11 cards by 8 pixels = 88 pixels which is 4 more than the Gamebuino can fit on the screen. So... yeah. BLACKJACK! LOL

Image

This one shows the basic game screen. The card numbers/letters are going to be replaced with bitmaps. This was just trial data.
Image
User avatar
AntonyPrince
 
Posts: 21
Joined: Thu Aug 07, 2014 1:07 am
Location: Virginia, United States

Re: Blackjack

Postby AntonyPrince » Sun Aug 17, 2014 9:09 am

Image

Makin' some progress.
User avatar
AntonyPrince
 
Posts: 21
Joined: Thu Aug 07, 2014 1:07 am
Location: Virginia, United States

Re: Blackjack

Postby Matrix828 » Tue Aug 19, 2014 9:58 pm

Lookin good! :D
Can we see what code you've got already?
Matrix828
 
Posts: 43
Joined: Tue Jul 22, 2014 7:44 pm

Re: Blackjack

Postby pyr0pete » Wed Aug 20, 2014 10:33 am

AntonyPrince wrote:At maximum, it would require 11 cards to reach 21 (1,1,1,1,2,2,2,2,3,3,3). The chances of that happening are very slim, but you have to consider all scenarios. Of course, 11 cards by 8 pixels = 88 pixels which is 4 more than the Gamebuino can fit on the screen.


You could actually show a default graphic of a card stack, only displaying the latest card on top, with the sum of all cards shown below. Here's a quick sketch:

blackjack.gif
blackjack.gif (880 Bytes) Viewed 3904 times


You can see that I've used two graphics for the stack, depending on how many cards you've received. Also, it's in 8x8 and 16x16. I think you can go up to 16x16 for the cards when using stacks like this.
User avatar
pyr0pete
 
Posts: 13
Joined: Sat Jul 05, 2014 1:46 pm

Re: Blackjack

Postby yodasvideoarcade » Wed Aug 20, 2014 1:27 pm

If you make the cards 11 x 19 pixels, you can easily fit two rows of 11 cards on the screen. Just use this for positioning and drawing the cards:

Code: Select all
byte cardypos=0;
byte cardxpos=0;
for (byte counter=1; counter <= noofcards; counter++) {
  cardxpos = cardxpos + 12 - 2*(noofcards > 7) - (noofcards > 8) - (noofcards > 9) - (noofcards>10);
  gb.display.setColor(0);
  gb.display.fillRect(cardxpos,cardypos,11,19);
  gb.display.setColor(1);
  gb.display.drawRect(cardxpos,cardypos,11,19);
  byte cardtoshow=yourcards[counter];
  byte suittoshow=0+(cardtoshow>12)+(cardtoshow>24)+(cardtoshow>36);
  byte numbertoshow=cardtoshow % 13;
  gb.display.drawbitmap(cardxpos+2,cardypos+2,valueimage[numbertoshow]);
  gb.display.drawbitmap(cardxpos+2,cardypos+10,suiteimage[suitetoshow]);
}


- Set "cardypos" to the vertical position where you want the cards to be drawn.
- "noofcards" should hold the number of cards you have (1 to 11).
- the arraw yourcards[] must have the index of the cards in your hand stored in it (values from 0 to 51. 0 = ace of hearts, 1 = 2 of hearts etc.)
- and of course valueimage[] needs to hold 13 images of the card-values (A, 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K) as nice graphics in 7x7 pixels size.
- and suiteimage[] needs to hold the 4 suits (Hearts, Spades, Clubs, Diamonds) as nice graphics in 7x7 pixels size.

Disclaimer: Code neither tested nor syntax-checked.
User avatar
yodasvideoarcade
 
Posts: 102
Joined: Sat Apr 19, 2014 10:48 am
Location: Frankfurt/Germany


Return to Project Guidance & Game development

Who is online

Users browsing this forum: No registered users and 4 guests

cron