"Has anyone an idea about setting a fixed time a block has to wait before it moves down one line?"
There are many ways to do it. You can either make use of a "timer" function, which runs in a given interval. Or use a structure such as the following:
fall_interval = 1.2
start_time = tic;
last_time = start_time;
current_time = toc(start_time);
last_time = current_time;
start_time is the time when a block starts to fall; last_time is the time when a block moved down; current_time is...current time.
This structure can be further improved. For example, it is not perfect to set last_time = current_time. Because if the fall_interval = 1.2
Then "last_time" (the expected time when the moving occurs) should be one of the following numbers: 1.2, 2.4, 3.6, 4.8,... Maybe you can add a counter to record how many lines have a block moved down since it appeared, and calculate the time the last fall "should have occurred".
If you want, you may check my game "Stellaria" to see how timing is handled.
22 Nov 2011
Tetris (vs AI)
An extended tetris game, using the plot function. You can either play by yourself or against an AI.
Thanks for your suggestion George, but I don't see how that could work: pause() pauses the execution, but (multiple) keyboard input should be processed immediately.
(Maybe it is possible with some comparison in time, maybe even using tic and toc - I dont know yet.)