Your code is different to MrGuest's and my advice, the mistake is obvious: You've removed "counter = 48;" from the line before the while(counter > 0) loop, i.e. you only set it once to a value (10) above zero. The next time you press key_space, counter will be of course < 0 and thus the while loop will never be executed.
Btw. it's horrible to look at this code without indentation, next time please use the [code ] my code here [/code ] tags (without the spaces between code and ]).