Page 1 of 1

Dice Games

PostPosted: Sun Aug 27, 2006 2:54 pm
by pesto126
Hi. searched the forums and google but wasn't able to find anything regarding some games made with GE in the Dice genre.. ie: Yahtzee.. I was hoping to make a Yathz type game... but was looking for some sample code to help out.

Specifics:
Scorecard visible on screen.. clickable areas to add score.
Roll Dice button to roll 6 dice
Mini buttons/lights under dice to indicate hold/roll
Need a matrix to hold valid dice rolls to indicate scores that are valid
Perhaps animation for the dice on roll

Any help would be greatly appreciated.. trying to determine if actors should be made in parent/child or all dice as seperate actors? thx.

PostPosted: Mon Aug 28, 2006 5:42 pm
by makslane
Try this:

1) Create an actor 'dice' and put 6 different animations.
2) In the 'Create Actor' event select an random animation:

Code: Select all
//Get a random index from 0 to 5
int anim = round(rand(5));

//Use the index to change the current animation
ChangeAnimation("Event Actor", getAnimName(anim), FORWARD);


Other way, is use a single animation with 6 frames, so, you can use the animpos variable to change the current frame:

Code: Select all
animpos = round(rand(5));


In this case, make sure stop the animation when create the actor (Change Animation Direction)

3) If you need to roll 6 dice actors, just clone the dice, create an button actor and, in a 'Mouse Button Down' event send an Activation Event for each dice. In the dice actor, put the above script in the Activation Event handler.