Search code examples
smalltalksqueakmorphic

Refreshing a Morph without any user interaction


I am creating a board game that can have both human and bot players.

My first version, which uses the Transcript, is ready. So now I want to make a better looking, more user friendly version using Morphs. The problem is when I start the game with only bot players. Only the end board is shown, whereas I would like to see each move that has been played, each change on the board.

I have tried lots of things, with forced updates of the morph or the world. I have tried to use step, stepTime and startStepping.

The latter shows my I am missing something: step is called for the first time when the game is over. Also: I have no idea what to put in step. Adding and removing submorphs is done by other methods, as well as a call to morph changed.

So: how can I see morph changes, without any interaction like clicks?


Solution

  • step methods are not necessary, the only thing that is needed is:

    World doOneCycle
    

    anywhere in the game loop.

    The “solution” with writing an empty string to the Transcript, as given in a comment, probably causes the world to do a cycle.