Thank you for visiting Blazing Games

Hearts Alpha

15:15-16:45

The alpha version is going to follow the lead of the pre-alpha version and simply place itself on the title screen. This will strictly be the rolling portion of the game with the round scoring enabled. The game does require six dice and the resolution of the game canvas is 640x480 so in order to fit the dice on a single line they will have to be 100x100 with a gap of 8 pixels between each die. This is fairly easy to implement as is the roll button to make the roll. The tricky part to writing this game is in handling the scoring.

Scoring took me quite a while to figure out. My first thoughts were sorting the results and then walking through the sort to see how high a number was reached. This was complicated by the fact that if three ones are rolled then the score for the round is a wiping out of that player's score.

Then I came up with the method that I actually implemented. I simply create an array that holds the die counts for seven die (die 7 is always zero and is only there to avoid array index problems). Each of the rolled die has it's value taken and the appropriate count is then updated. If the 1 count (array index 0) happens to be greater than 2 then the score is wiped out. I am using a score value of -1 to indicate this. Otherwise, I set an index variable to the first die which is index value zero and do a while loop over the counts array until a zero is reached. The index value reached multiplied by 5 happens to be the score. If by chance the final element (index 6) was reached then an additional bonus of 5 points is added.

While the above approach may sound complex, it is very simple to implement and is not overly inefficient.

Previous page
Making Hearts Page 4

About - Privacy Policy - Contact - Links - FAQ
Copyright © 2008 Blazing Games Inc. All Rights Reserved