previous

page 15

next

This is how I got the waits to happen. Clever eh?

function button_click(colr) {
Hide('buttons');
g_n++;
if (g_cards[1]==g_cards[4]) {
if (colr=='green') g_score++;
} else {
if (colr=='red') g_score++;
}
show_card(1);
show_card(4);
// wait two seconds
setTimeout(button_click2,2000);
}
function button_click2() {
for (var i=0;i<5;i++) hide_card(i);
pick0();
show_card(0);
// wait three seconds
setTimeout(button_click3,3000);
}
function button_click3() {
hide_card(0);
move();
for (var j=4; j>0; j--) g_cards[j]=g_cards[j-1];
// when move finished
//show('buttons');
}

remove_move is called when the move finishes so that's where you put

show('buttons');
previous
next