How to Set a Maximum Variable Value in MicroWorld EX

By Camille McCue

Imagine you are creating a code in MicroWorld EX that guesses a secret number. In this scenario, a player needs to know the highest possible value of the secret number. For example, if you say “Guess a number from 1 to 100,” then 100 is the high value.

Setting the high value of the secret number to a low number makes the game easier because there are fewer possible numbers to guess. Setting the high value to a high number makes the game more challenging.

Create a slider to allow the player to set the high value for each game.

  1. From the toolbar, click the Create a Slider button.

    image0.jpg

    Or, choose Objects→New Slider from the menu bar.

  2. Move into the workspace and click.

    A Slider dialog box appears.

  3. In the Slider dialog box, fill in the following information:

    • Name: Type Max_Number, which represents the maximum high value that the secret number — secnum — can ever have.

    • Minimum: Type 0 for the minimum value.

    • Maximum: Type 1000 for the maximum value.

    • Value: Type 1000 for the starting value at which the slider is set. This value can be set at any number, but it may be helpful for the player to see the highest possible value for any game is 1000.

    • Show Name: Select this check box.

    • Visible: Select this check box.

    • Vertical: If you want to make the slider vertical (up and down), check the Vertical check box.

      After you fill in the information your screen should resemble the following:

      image1.jpg

  4. Click OK to close the Slider dialog box.

    The Max_Number slider appears in the workspace.

  5. Drag the slider to position it where you want it to appear in the workspace.

    image2.jpg

Sliders are variables to which you assign minimum and maximum values.