Writing Non-Blocking Code
In SceneMax3D (and so is in every other language), commands are executed one after the other for example:
d is a dragon
d.turn left 360 in 10 seconds
d.fly
In the above code the dragon is rotating to the left for 10 seconds and just then starts to “fly”. But what if we want the dragon to fly and turn at the same time?
We need to make the “turn” command to be non-blocking (i.e. running in it’s own thread). To do so, simply add the “async” attribute to the “turn” command:
d is a dragon
d.turn left 360 in 10 seconds async
d.fly
Adding the “async” attribute to the “turn” command has made it to work in it’s own thread thus not to block the next “fly” command. Now both “fly” and “turn” command will run at the same time.