Animation & video games under STk?

From: Harvey J. Stein <hjstein_at_math.huji.ac.il>
Date: Sun, 27 Nov 1994 21:12:24 +0200

I have a question about using STk for video games. The question is,
how do I get things to move smoothly & consistently across different
platforms?

To illustrate, let's consider a simple example. Suppose I wanted to
implement Tetris under STk. Then I might make a class <tetris-piece>
which draws the tetris piece, etc. I'd then need to somehow get this
piece to fall a notch every second (for example), and to process
keystrokes at the same time to move the piece left & right, & to
rotate it. The keystroke part is pretty easy just by using bindings,
but how do I get the piece to fall a notch exactly once every second?
The solution shouldn't be a waste time loop for the obvious reasons.

Additionally, as the player progresses, the pieces have to fall faster
and faster. Towards the end, the pieces might be dropping as fast as
a notch every 1/10 of a second.

If I was just writing in C on unix boxes, I suppose I'd use signals to
move the block, perhaps using the system calls getitimer & setitimer.

What would be neat would be to have a do-in-x-microseconds function in
STk which would take a # of microseconds & a procedure as arguments &
would execute the procedure in said microseconds.

Is there any such thing? Or is there some other way of doing this?
Or is there something in Tk which would help? Or do I just have to
try to wire up something using getitimer & setitimer & add it to STk?
Or am I better off usung a different tool (if so, please suggest one!).

Thanks,

Dr. Harvey J. Stein
Berger Financial Research
hjstein_at_math.huji.ac.il
Received on Sun Nov 27 1994 - 20:13:51 CET

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST