Skip to content

Please update your browser

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

arrow_back Bonuspunkte erzielen.

Transcript

Sometimes games that have enemies to avoid, but also have prizes to catch. This screencast will show you how to make a sprite that gives you bonus points if caught.

First, you need to create the bonus sprite. This example will use an apple, but you can select whatever you would like.

Because this sprite will be a prize, it will start the game hidden.

Then, the apple should appear at random times.

To make something happen randomly, you can use an if statement, a “pick random” block, and an equals operator.

This will say: Well, when the sprite appears… It should glide to a spot...

Then it should hide. In order to keep making new random numbers for the entire game, place this code inside a forever loop.

This code now reads: That seems right! Try it!

This is a good time to tinker with the values to see how you can change game play.

Play around to see what happens when you change the values.

Looks good so far… Oh! The computer never told the apple to go back to where it started. After the apple moves to the right side of the screen and hides, it needs to go back to the left side of the screen.

To make that happen, add a “go-to” block just after the “hide” block, and put another one at the beginning of the program.

That way, the apple always starts in the same spot. Test your code to see if it works.

Looks good! Now that the apple is moving, the player should receive points for touching it. To do that, go back to the fish sprite.

You want the fish to score points if it is touching the apple. To do that, put the if block into your my program, then add a “touching” block and set the value to apple.

When the fish is touching the apple, you want the score to change by 5.

Add a "change score by block" that will change the score by 5 points.

When the fish touches the apple, 5 points get added.

Feel free to use your own numbers. This example started at 10, which is kind of small, but it was a good place to start testing.

The bonus sprite can be as rare or as common as you’d like in your game. You can also make the speed of the sprite slower or faster by changing the timing in the glide block.

Feel free to change the amount of points the bonus sprite gives you.

This is your chance to tinker with the code and make your game exactly the way you want it.

Erweiterung auswählen
Jubel an der Ziellinie programmieren
Einen Klang programmieren, der abgespielt wird, wenn die Spielfigur die Ziellinie berührt.
Mit einem Freund spielen – Option 1
Einen zweiten Spieler zum Spiel hinzufügen.
Mit einem Freund spielen – Option 2
Einen Freund herausfordern, indem ihr ihn die Feinde steuern lasst.
Den Schwierigkeitsgrad erhöhen
Die Ziellinie mit steigendem Punktestand des Spielers immer kürzer werden lassen.
Bonuspunkte erzielen.
Eine Figur erstellen, die Bonuspunkte einbringt, wenn die Spielfigur sie berührt.
Ein sich änderndes Bühnenbild programmieren
Das Bühnenbild so programmieren, dass es sich jedes Mal ändert, wenn der Spieler 5 Punkte erzielt.
arrow_backward Zurück
Weiter arrow_forward
Anweisungen
  1. Klickt auf eines der Kästchen, um zum Video mit den Erweiterungen zu gelangen.
  2. Wenn ihr fertig seid, kehrt zur Seite mit den Erweiterungen zurück und probiert eine andere Erweiterung aus!