Attempting to make a blackjack game

Get help using Construct 2

Post » Sun Jun 22, 2014 1:40 am

Hi everyone. I'm specifically having trouble with getting aces to total 1 or 11. Anyone with a sample capx on blackjack? I cant find anything searching for it. Thanks!
B
6
S
1
Posts: 8
Reputation: 870

Post » Sun Jun 22, 2014 10:22 am

You could try something like having the Aces to total 11 by default and then using the conditional expression. Let's say you already have the summed total in a local variable called CurrentTotal, and you're just missing the Ace (which you can simply leave for last by ordering cards in the player's hand by ascending value.

You could do something like

CurrentTotal = CurrentTotal + Ace.Value > 21 ? CurrentTotal + 1 : CurrentTotal + Ace.Value
B
6
S
2
Posts: 79
Reputation: 608

Post » Tue Jun 24, 2014 2:33 am

Thank you monitz, it worked!
Last edited by mochizmo on Tue Jun 24, 2014 2:34 am, edited 1 time in total.
B
6
S
1
Posts: 8
Reputation: 870


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 12 guests