これまでにゲームプログラミングをしたことがないのですが、かなり簡単な質問です。
メインループが次のように見えるテトリスゲームを作成しているとします。
for every frame
    handle input
    if it's time to make the current block move down a row
        if we can move the block
            move the block
        else
            remove all complete rows
            move rows down so there are no gaps
            if we can spawn a new block
                spawn a new current block
            else
                game over
ゲーム内のすべてがこれまで瞬時に起こる-物事が瞬時に起動されている、私があれば行が即座などしかし、何が削除されていない事が瞬時に(すなわちアニメーションのこと)が起こるしたいですか?
for every frame
    handle input
    if it's time to make the current block move down a row
        if we can move the block
            move the block
        else
            ?? animate complete rows disappearing (somehow, wait over multiple frames until the animation is done)
            ?? animate rows moving downwards (and again, wait over multiple frames)
            if we can spawn a new block
                spawn a new current block
            else
                game over
私のPongクローンでは、これは問題ではありませんでした。すべてのフレームでボールを動かし、衝突をチェックしていたからです。
どうすればこの問題を回避できますか?確かにほとんどのゲームには、1フレーム以上かかるアクションが含まれ、他のアクションはアクションが完了するまで停止します。
Actionクラスと実行するアクションのキューを想像してください。アクションが完了したら、それをキューから削除し、次のアクションなどを実行します。ステートマシンよりもはるかに柔軟です。