PDA

View Full Version : Flash Blackjack


MrGone
04-12-2005, 02:02 AM
Hi everyone. I replied to another thread on this same subject, but then realized it was AS2.0, which I don't have. So I hope I don't get in trouble for posting a second topic about this.

I'm attempting to make a flash blackjack game. I'm not sure even really how to start something like this. I am hoping one of you Super AS guys can help me out.

This is where I am at so far:
cards = new Array(52);
for (var i = 0; i<52; i++) {
cards[i] = i;
}
trace("Random Card "+(random(cards.length)));


I guess my first question is how do I set the value of the cards? Do I need another array? Do I have to fill that array manually?

Thanks in advance for any advice anyone can give me,
MrGone

tomtomA920Dude
04-12-2005, 02:16 AM
Seriously, if you've never done actionscript before, then you may have to face the fact that something as complex as a blackjack game right now is simply above you.

No one's going to 'hold your hand' through making the entire game. Something like that will take HOURS of work. you wouldn't do some else's job for them for a day for free would you?

Start with something smaller, do some actionscript tutorials, then when you have a fundamental understanding of flash & actionscript come back and ask some educated questions.

I found a book that may help you at
http://www.amazon.com/exec/obidos/tg/detail/-/078972524X/102-9658605-1992903?v=glance

MrGone
04-12-2005, 02:20 AM
I have done actionscript before, but mainly for websites and animation. I am trying to make my first game, and I thought that blackjack would be fairly simple.

About that book, I did come across it on my search for actionscript blackjack. My mouse is hovering over the "buy now" button as we speak. ;)

MrGone
04-12-2005, 02:40 AM
Ok, I had a little progress on my own using a randomize tutorial that I found here.

Array.prototype.shuffle = function () {
return this.sort(function(a,b) {return (Math.floor(Math.random()*2) == 0) ? 1 : -1;});
};

cards = [2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8, 8,8,8,9,9,9,9,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,11,11,11,11];
trace(cards.shuffle());
trace("Dealer: " + (cards[0]+cards[1]));
trace("Player: " + (cards[2]+cards[3]));

I'm kind of getting into the technicalities of blackjack now. How is it dealt? Player then dealer, then player then dealer? Or is it dealer dealer then player player?

MrGone
04-12-2005, 10:21 AM
I'm pretty stumped on where I am at with this now. Does anybody know how I would go about attaching each of the cards to a certain index of this array?

Then again, when I shuffle the array it won't really matter because then the index would not line up with the right card.

I am either missing something, or going about this the complete wrong way. :(