slot game, lines and prizes
Posted: Fri Jun 10, 2011 8:24 pm
When space is pressed the clons have random animpos. I'm requesting for simple code to count the prizes for horizontal and cross lines. hand 10 bells 20 islands 50.
Game Editor discussion board
http://game-editor.com/forum/
(slots[0][0]==slots[0][1] && slots[0][0]==slots[0][2])
for(i=0;i<8;i++)
{
switch(prizes[i])
{
case 0: // nothing
break;
case 1: // island
score+=50;
break;
case 2: // bell
score+=20;
break;
case 3: // hand
score+=10;
break;
}
}
int i;
int prizes[5];
//horizontal
prizes[0]=(slots[0][0]==slots[0][1] && slots[0][0]==slots[0][2])*slots[0][0];
prizes[1]=(slots[1][0]==slots[1][1] && slots[1][0]==slots[1][2])*slots[1][0];
prizes[2]=(slots[2][0]==slots[2][1] && slots[2][0]==slots[2][2])*slots[2][0];
//diagonal
prizes[3]=(slots[0][0]==slots[1][1] && slots[0][0]==slots[2][2])*slots[0][0];
prizes[4]=(slots[2][0]==slots[1][1] && slots[2][0]==slots[0][2])*slots[2][0];
for(i=0;i<5;i++)
{
switch(prizes[i])
{
case 0: // nothing
break;
case 1: // island
score+=50;
break;
case 2: // bell
score+=20;
break;
case 3: // hand
score+=10;
break;
}
}
animpos=rand(3);
animpos=rand(nframes);
for(i=0;i<5;i++)
{
switch(prizes[i])
{
case 0: // nothing
break;
case 1: // island
score+=50;
break;
case 2: // bell
score+=20;
break;
case 3: // hand
score+=10;
break;
case 4: // new
score+=5; // or whatever you want it to be
break;
}
}