Skip to content

Please update your browser

Your browser version is not supported by this site. CS First may not work properly. Learn more

3. Entscheidungen treffen lassen


If the user answers “yes” to the first question, then they will go to one world. If he or she answers anything else, like “no”, “maybe,” “probably”, “I’m not sure.” “Hopefully so,” “yah”, “yep, “mos def,” – literally any other word – then they will go somewhere else.

To check if the answer is yes, use the equals operator found in the operators menu.

Drag the answer variable into the first blank, and type “yes” into the other.

You just programmed a condition! Now, you need to tell the computer what to do if “answer” equals yes, then what to do if answer equals anything else.

Click control, and drag out an “if/else” block. Attach it below the “ask” block.

Drag the condition into the top of the if/else block.

If the answer equals “yes,” then the backdrop should change.

Click the looks menu, drag a “switch backdrop to” block into the “if/else” statement, and change the value to the name of the appropriate backdrop. This example uses “woods,” but you will choose the first backdrop you previously selected for your story.

Test it now. Click the block stack, and enter “yes.” The backdrop should switch to the backdrop you selected. Great! “If” the user answers something other than “yes,” the stage should change to a different backdrop.

Drag another “change backdrop” block into the “else” portion of the if/else statement, and change the value to your second backdrop. Click the block stack to test this again, and enter “no.”

Great, it works. But, there’s one problem.

The backdrop never changes to the brick wall for the start of the story. To reset the backdrop to the brick wall at the start of the story, drag the “switch backdrop to brick wall” block to the top of the block stack. Finally, add a “when flag clicked” event to start this code. Click the green flag to test this again, and test some different answers to the main character’s question to find out how it will react.

In the next video, you’ll program different stories for each backdrop.

arrow_backward Zurück
Weiter arrow_forward
  1. Erstellt die Bedingung, auf der die Entscheidung des Programms basieren soll.
  2. Wechselt zu einem Bühnenbild, wenn der Nutzer mit „Ja“ antwortet.
  3. Wechselt zu einem anderen Bühnenbild, wenn der Nutzer mit etwas anderem als „Ja“ antwortet.
  4. Programmiert, dass die Geschichte immer mit dem Bühnenbild „Backsteinmauer“ beginnt.