PDA

View Full Version : [AS2] Dice game help


tommygruber
09-03-2008, 06:57 AM
Hello,

I'm programming this dice game that's similar to yahtzee. It has 6 dice and I'm trying to figure out how to assign Points to the dice and certain rolls.

for example, if the 6 dice show 1,2,3,4,5,6; Then that would be a certain amount of points.

Any feedback on this would be awesome.

Thank you,

Tommy

www.gmediaservices.com

drumn4life0789
09-03-2008, 09:18 AM
first you need to know how they will roll. Like are they really rolling and whatever is facking up is what is called or is it like click this button and watch these 6 numbers change then they stop.

But eaither way you would have to create an array wich will check and add up the data and so on.

syruplord
09-03-2008, 01:19 PM
if all else fails, if(a and b and c...){points = x;}

tommygruber
09-03-2008, 06:26 PM
Hey,

Thank you for the advice. The only problem is my game doesn't add up the dice, the points are based off of what numbers show up.

1's are worth 100
5's are worth 50
3 of a kind = face value ( 3 Five's is 500 points)
4 of a kind = face value (4 two's is 2000 points)

I have a dice roller button and when you click on it it calls my rollDice function. I have my 6 dice in an Array called aDice. I'm also tracing the array to make sure the same numbers that are on the dice table are the same in the output panel.

So I guess my question is how to let flash know that when certain combinations of numbers appear, They have a set value.

Thank you again for your input,

rrh
09-03-2008, 08:26 PM
Oh man. That's "You Blew It!" I was totally playing with this a couple weeks ago.

it went something like this:

plug all the values into diceArray
sort diceArray
if diceArray matches 12345 or 23456 {
score is 1000
} else {
countArray=[0,0,0,0,0,0,0]
for each entry in diceArray,
increment the corresponding entry in countArray
if any entry in countArray is 3 or more, then {
three of a kind
} else {
score is countArray[1]*100+countArray[5]*50
}
}

tommygruber
09-03-2008, 09:51 PM
Wow! Thankyou...