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. Einen Ausgang hinzufügen

Transcript

In this video, you’ll program the object that the player is looking for to appear in only one location. To start, choose what your sprite is looking for. Click the object sprite, then go to the “costumes” tab. There are a few different choices available. Choose one of these items, or add a different object from the costume library. What might your character need to find?

Once you’ve chosen an object, go back to the “scripts” tab, click “looks,” and drag out “show” and “hide” blocks. The “show” block should run when the backdrop changes. Click events, and drag out a “When backdrop switches” block. Click the dropdown, and select the name of the location where your object will appear. This example uses the cave, but you will choose your own location for the object in your game. Then, drag another “when backdrop switches” block onto the “hide” block, and select “town.”

Click the flag to try it out. Move the sprite to the location you just selected, and great, the sprite appears! Next, program a winning condition that will happen *if* the player sprite touches the object.

Place a forever loop and an “if” statement under the “show” block.

Add a “touching” block from sensing, and select “character” from the dropdown.

Create a winning celebration. You might play a sound, or use a “say” block to say, “Yay, you win!” Click the flag to try it out. Move the sprite until it finds the object, and… great! Now, it’s your turn: Select the object sprite and a costume from the costumes tab.

Show the object in one location using “when backdrop switches” and “show” blocks.

Hide the object at the start of the program using “when backdrop switches” and “hide” blocks. Program a winning condition using “touching,” “forever,” and “if” blocks.

In the next video, you’ll add more storytelling elements to make your game more exciting.

arrow_backward Zurück
Weiter arrow_forward
Anweisungen
  1. Kopiert den Code von der Haus-Figur in die Ausgang-Figur.
  2. Tauscht die Blöcke „zeige dich“ und „verstecke dich“ aus.
  3. Ändert den Wert „wechsle Bühnenbild“ zu „Stadt“.
  4. Entfernt den Block „sende an alle“.
  5. Lasst die Ausgang-Figur je nach Bühnenbild das Kostüm wechseln Verwendet dazu die Blöcke „Wenn Bühnenbild wechselt“ und „wechsle Kostüm“.