Basics of MicroWorld EX’s Day and Night Procedure
The day_and_night procedure in MicroWorld EX slowly changes the background color of the scene, cycling among daytime, dusk, and night colors. It can be a fun procedure to use to show time changes.
In the Procedures pane, write a day_and_night procedure as follows:
to day_and_night setbg “black wait 30 setbg “blue wait 30 setbg “cyan wait 30 end
The day_and_night procedure is executed when you click the Day and Night button. This procedure cycles among black, blue, and cyan background colors with 3-second wait periods (wait 30) in between.
Remember that procedure names made of more than one word must not have spaces! Either place all the words together without spaces, or use a dash (-) or underscore (_) symbol to connect words.
The Day and Night button will execute the day_and_night procedure forever. Follow these steps to create this button:
On the toolbar, click the Create a Button button and then click the workspace anywhere.
In the Button dialog box, fill in the fields as follows:
Label: Type Day and Night in the Label field to name the button.
While procedure names must not have spaces, it’s okay for Label names to have spaces.
Instruction: Type day_and_night in the Instruction field.
Do It: Select the Forever radio button.
Visible: Select this check box to leave the button visible.
The dialog box for the example should look similar to this one.
Click OK to close the Button dialog box.
The Day and Night button is added to the workspace.
Resize buttons to better fit long labels. Ctrl-click (Windows) or Command-click (Mac) button. Sizing dots appear — click and drag any of them to resize the button.
Drag the button to an out-of-the-way position in a corner of the workspace.
That is the completed Winter Wonderland scene for the example.
Note that the setbg “black command is no longer needed in the Command Center and can now be removed.