diff --git a/af-ZA/images/banner.png b/af-ZA/images/banner.png new file mode 100644 index 0000000..7a0da5b Binary files /dev/null and b/af-ZA/images/banner.png differ diff --git a/af-ZA/images/binary-showcase.png b/af-ZA/images/binary-showcase.png new file mode 100644 index 0000000..499aa29 Binary files /dev/null and b/af-ZA/images/binary-showcase.png differ diff --git a/af-ZA/images/flappy-clones-test.png b/af-ZA/images/flappy-clones-test.png new file mode 100644 index 0000000..f874059 Binary files /dev/null and b/af-ZA/images/flappy-clones-test.png differ diff --git a/af-ZA/images/flappy-falling.gif b/af-ZA/images/flappy-falling.gif new file mode 100644 index 0000000..970d833 Binary files /dev/null and b/af-ZA/images/flappy-falling.gif differ diff --git a/af-ZA/images/flappy-flying.gif b/af-ZA/images/flappy-flying.gif new file mode 100644 index 0000000..e259ff1 Binary files /dev/null and b/af-ZA/images/flappy-flying.gif differ diff --git a/af-ZA/images/flappy-height-test.png b/af-ZA/images/flappy-height-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/af-ZA/images/flappy-height-test.png differ diff --git a/af-ZA/images/flappy-parrot-showcase.png b/af-ZA/images/flappy-parrot-showcase.png new file mode 100644 index 0000000..493049b Binary files /dev/null and b/af-ZA/images/flappy-parrot-showcase.png differ diff --git a/af-ZA/images/flappy-pipes-duplicate1-annotated.png b/af-ZA/images/flappy-pipes-duplicate1-annotated.png new file mode 100644 index 0000000..65e32c6 Binary files /dev/null and b/af-ZA/images/flappy-pipes-duplicate1-annotated.png differ diff --git a/af-ZA/images/flappy-pipes-duplicate1.png b/af-ZA/images/flappy-pipes-duplicate1.png new file mode 100644 index 0000000..4239b67 Binary files /dev/null and b/af-ZA/images/flappy-pipes-duplicate1.png differ diff --git a/af-ZA/images/flappy-pipes-duplicate2.png b/af-ZA/images/flappy-pipes-duplicate2.png new file mode 100644 index 0000000..ba1a69a Binary files /dev/null and b/af-ZA/images/flappy-pipes-duplicate2.png differ diff --git a/af-ZA/images/flappy-pipes-ends.png b/af-ZA/images/flappy-pipes-ends.png new file mode 100644 index 0000000..ab59aaa Binary files /dev/null and b/af-ZA/images/flappy-pipes-ends.png differ diff --git a/af-ZA/images/flappy-pipes-fill-rectangle.png b/af-ZA/images/flappy-pipes-fill-rectangle.png new file mode 100644 index 0000000..7360b87 Binary files /dev/null and b/af-ZA/images/flappy-pipes-fill-rectangle.png differ diff --git a/af-ZA/images/flappy-pipes-filled.png b/af-ZA/images/flappy-pipes-filled.png new file mode 100644 index 0000000..7d2c0dd Binary files /dev/null and b/af-ZA/images/flappy-pipes-filled.png differ diff --git a/af-ZA/images/flappy-pipes-position.png b/af-ZA/images/flappy-pipes-position.png new file mode 100644 index 0000000..ca2b810 Binary files /dev/null and b/af-ZA/images/flappy-pipes-position.png differ diff --git a/af-ZA/images/flappy-pipes-rectangle.png b/af-ZA/images/flappy-pipes-rectangle.png new file mode 100644 index 0000000..6e3bf02 Binary files /dev/null and b/af-ZA/images/flappy-pipes-rectangle.png differ diff --git a/af-ZA/images/flappy-pipes-test.png b/af-ZA/images/flappy-pipes-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/af-ZA/images/flappy-pipes-test.png differ diff --git a/af-ZA/images/flappy-setup.png b/af-ZA/images/flappy-setup.png new file mode 100644 index 0000000..92f9eca Binary files /dev/null and b/af-ZA/images/flappy-setup.png differ diff --git a/af-ZA/images/flappy-sprite.png b/af-ZA/images/flappy-sprite.png new file mode 100644 index 0000000..6a0c590 Binary files /dev/null and b/af-ZA/images/flappy-sprite.png differ diff --git a/af-ZA/images/flappy-stage.png b/af-ZA/images/flappy-stage.png new file mode 100644 index 0000000..5efe03c Binary files /dev/null and b/af-ZA/images/flappy-stage.png differ diff --git a/af-ZA/images/flappy-starting-position.png b/af-ZA/images/flappy-starting-position.png new file mode 100644 index 0000000..9089c9e Binary files /dev/null and b/af-ZA/images/flappy-starting-position.png differ diff --git a/af-ZA/images/flappy-wings.png b/af-ZA/images/flappy-wings.png new file mode 100644 index 0000000..ef0aa8e Binary files /dev/null and b/af-ZA/images/flappy-wings.png differ diff --git a/af-ZA/images/pipes-sprite.png b/af-ZA/images/pipes-sprite.png new file mode 100644 index 0000000..a9882ed Binary files /dev/null and b/af-ZA/images/pipes-sprite.png differ diff --git a/af-ZA/meta.yml b/af-ZA/meta.yml new file mode 100644 index 0000000..c2fe5e6 --- /dev/null +++ b/af-ZA/meta.yml @@ -0,0 +1,34 @@ +--- +title: Flappy parrot +hero_image: images/banner.png +description: Create a game in which you guide a parrot past moving obstacles +listed: true +copyedit: true +version: 4.1 +last_tested: 2018-10-90 +steps: + - + title: Introduction + - + title: Add the pipes + - + title: "Challenge: make better pipes" + challenge: true + - + title: Make the pipes move + - + title: Make Flappy fall + - + title: Make Flappy fly + - + title: Detect collisions + - + title: Add a score + - + title: 'Challenge: adjust the difficulty' + challenge: true + - + title: 'Challenge: add a high score' + challenge: true + - + title: What next? diff --git a/af-ZA/scratch-translatable.txt b/af-ZA/scratch-translatable.txt new file mode 100644 index 0000000..214e66c --- /dev/null +++ b/af-ZA/scratch-translatable.txt @@ -0,0 +1,13 @@ +Pipes + +costume1 + +Flappy + +wings down + +wings up + +Game Over! + +score diff --git a/af-ZA/solutions/FlappyParrot-Solution.sb3 b/af-ZA/solutions/FlappyParrot-Solution.sb3 new file mode 100644 index 0000000..a0cd354 Binary files /dev/null and b/af-ZA/solutions/FlappyParrot-Solution.sb3 differ diff --git a/af-ZA/step_1.md b/af-ZA/step_1.md new file mode 100644 index 0000000..f7519ae --- /dev/null +++ b/af-ZA/step_1.md @@ -0,0 +1,69 @@ +\--- no-print \--- + +This is the **Scratch 3** version of the project. There is also a [Scratch 2 version of the project](https://projects.raspberrypi.org/en/projects/flappy-parrot-scratch2). + +\--- /no-print \--- + +## Introduction + +Create a game in which you have to guide a parrot past scrolling pipes to score points. + +### What you will make + +\--- no-print \--- + +Click the green flag to start the game. Press the space bar to make the parrot flap its wings, and try to get it to fly through the gaps in the pipes! You score one point for every pipe that you manage to get the parrot past. + +
+ + +
+ +\--- /no-print \--- + +\--- print-only \--- + +You will press the space bar to make the parrot flap its wings, and score one point for every pipe that you manage to get the parrot past. + +![flappy parrot game being played](images/flappy-parrot-showcase.png) + +\--- /print-only \--- + +## \--- collapse \--- + +## title: What you will need + +### Hardware + ++ A computer capable of running Scratch 3 + +### Software + ++ Scratch 3 (either [online](https://rpf.io/scratchon) or [offline](https://rpf.io/scratchoff)) + +\--- /collapse \--- + +## \--- collapse \--- + +## title: What you will learn + ++ How to create sprites using Vector mode ++ How to use sounds ++ How to detect collisions ++ How to control a sprite using the keyboard + +\--- /collapse \--- + +## \--- collapse \--- + +## title: Additional notes for educators + +\--- no-print \--- + +If you need to print this project, please use the [printer-friendly version](https://projects.raspberrypi.org/en/projects/flappy-parrot/print){:target="_blank"}. + +\--- /no-print \--- + +You can find the [completed project here](https://rpf.io/p/en/flappy-parrot-get). + +\--- /collapse \--- \ No newline at end of file diff --git a/af-ZA/step_10.md b/af-ZA/step_10.md new file mode 100644 index 0000000..a5808f3 --- /dev/null +++ b/af-ZA/step_10.md @@ -0,0 +1,9 @@ +## Challenge: add a high score + +\--- challenge \--- + +Can you add a high score to the game so that, in addition to keeping track of score for the current round, it keeps track of the highest score you've ever reached? + +[[[generic-scratch3-high-score]]] + +\--- /challenge \--- \ No newline at end of file diff --git a/af-ZA/step_11.md b/af-ZA/step_11.md new file mode 100644 index 0000000..02ae229 --- /dev/null +++ b/af-ZA/step_11.md @@ -0,0 +1,19 @@ +## What next? + +Try the [Binary hero](https://projects.raspberrypi.org/en/projects/binary-hero?utm_source=pathway&utm_medium=whatnext&utm_campaign=projects) project, where you will make a game in which you play the notes of a song as they scroll down the Stage. + +\--- no-print \--- + +Click the green flag to start the game. Use the z, x, c, and v keys to play the correct notes when these reach the bottom of the Stage. You'll score ten points for every correct note you play. + +
+ +
+ +\--- /no-print \--- + +\--- print-only \--- + +The notes will fall from above, and you will have to press keys to "catch" and play the notes. ![showcase](images/binary-showcase.png) + +\--- /print-only \--- \ No newline at end of file diff --git a/af-ZA/step_2.md b/af-ZA/step_2.md new file mode 100644 index 0000000..d8f2ce5 --- /dev/null +++ b/af-ZA/step_2.md @@ -0,0 +1,84 @@ +## Add the pipes + +First, create the pipes. + +\--- task \--- + +Open a new empty Scratch project. + +[[[generic-scratch3-new-project]]] + +\--- /task \--- + +\--- task \--- + +Add a backdrop with an outdoor landscape. 'Blue Sky' is a good choice. + +![screenshot](images/flappy-stage.png) + +[[[generic-scratch3-backdrop-from-library]]] + +\--- /task \--- + +\--- task \--- + +Create a new sprite and name it 'Pipes'. + +[[[generic-scratch3-draw-sprite]]] + +\--- /task \--- + +The 'Pipes' sprite should be a pair of pipes with a gap in the middle. By moving the sprite up or down, you can put the gap in a different place. + +This picture shows an example of how the pipes could be positioned. The parts of the sprite outside the Stage are normally hidden, you only see then when you drag the sprite: + +![screenshot](images/flappy-pipes-position.png) + +You can't draw a sprite as big as the pipes need to be, but you can increase the size at which the sprite shows on the Stage. + +\--- task \--- + +![pipes sprite](images/pipes-sprite.png) + +Add code to make the sprite bigger. + +```blocks3 +when green flag clicked +set size to (200) % +``` + +This makes it's easier to see how big the pipes should be. + +\--- /task \--- + +\--- task \--- + +Draw a rectangle for the top pipe as shown here: + +![rectangle for the pipe](images/flappy-pipes-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Fill the pipe with a colour you like. + +![fill the rectangle](images/flappy-pipes-fill-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Create a duplicate of the pipe by selecting it and then clicking on **Copy** and **Paste**. + +![copy and paste pipe](images/flappy-pipes-duplicate1-annotated.png) + +\--- /task \--- + +\--- task \--- + +Drag the copy of the pipe to the bottom of the screen so that the copy is in line with the other pipe. There needs to be a gap between the two pipes. + +![screenshot](images/flappy-pipes-duplicate2.png) + +\--- /task \--- \ No newline at end of file diff --git a/af-ZA/step_3.md b/af-ZA/step_3.md new file mode 100644 index 0000000..17f05f7 --- /dev/null +++ b/af-ZA/step_3.md @@ -0,0 +1,11 @@ +## Challenge: make better pipes + +Can you make your pipes look better? + ++ Shade your pipes with a left-to-right gradient. + +![screenshot](images/flappy-pipes-filled.png) + ++ Add extra rectangles to the ends of the pipes: + +![screenshot](images/flappy-pipes-ends.png) \ No newline at end of file diff --git a/af-ZA/step_4.md b/af-ZA/step_4.md new file mode 100644 index 0000000..2beedd9 --- /dev/null +++ b/af-ZA/step_4.md @@ -0,0 +1,65 @@ +## Make the pipes move + +Next you're going to make the pipes move across the screen to create an obstacle course. + +![pipes moving across the screen](images/flappy-clones-test.png) + +\--- task \--- + +First make the pipes appear by adding code to the Pipes sprite so that, `when the green flag is clicked`{:class="block3events"}, the sprite `forever`{:class="block3control"} `creates a clone of itself`{:class="block3control"} every two seconds. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +**Tip:** clones are just copies of a sprite, and they are really useful for creating games. + +\--- /task \--- + +\--- task \--- + +Next make the pipes move by adding code so that, `when a clone starts`{:class="block3control"}, the clone appears on the right side of the Stage and `glides`{:class="block3motion"} across to the left. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show +go to x: (240) y: (0) +glide (4) secs to x: (-240) y: (0) +delete this clone +``` + +**Tip:** you can stop the pipes scrolling by clicking the red **stop** button next to the green flag. + +\--- /task \--- + +Now you should have lots of pipes, but their gaps are always in the same place. + +You can add some variety by using a `random`{:class="block3operators"} number for the Pipes sprite's `y position`{:class="block3motion"}. + +![pipes at different heights](images/flappy-height-test.png) + +\--- task \--- + +Modify your sprite's code so that each sprite clone `picks a random number from -80 to 80`{:class="block3operators"} and `glides`{:class="block3motion"} to that `y position`{:class="block3motion"}: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show ++ go to x: (240) y: (pick random (-80) to (80)) ++ glide (4) secs to x: (-240) y: (y position) +delete this clone +``` + +\--- /task \--- \ No newline at end of file diff --git a/af-ZA/step_5.md b/af-ZA/step_5.md new file mode 100644 index 0000000..f9d79ce --- /dev/null +++ b/af-ZA/step_5.md @@ -0,0 +1,77 @@ +## Make Flappy fall + +Now add a sprite called Flappy and create code it so Flappy falls down the Stage. In the next step, you will add the code to make Flappy fly when you press a key. + +\--- no-print \--- + +![flappy falling animation](images/flappy-falling.gif) + +\--- /no-print \--- + +\--- task \--- + +Add a new sprite that has two costumes, for 'wings up' and 'wings down', and name it `Flappy`. + +The parrot sprite is a good choice. + +![parrot sprite](images/flappy-sprite.png) + +\--- /task \--- + +Flappy needs to be smaller. + +\--- task \--- + +Add code to `set Flappy's size to 25%`{:class="block3looks"} `when the green flag is clicked`{:class="block3events"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +``` + +\--- /task \--- + +When the game starts, Flappy needs to be just left of the centre of the Stage, at coordinates `-50, 0`. + +![flappy shown at the start position](images/flappy-starting-position.png) + +\--- task \--- + +Add code to make Flappy `go to the x and y`{:class="block3motion"} starting position of `x: -50`{:class="block3motion"} and `y: 0`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % ++ go to x: (-50) y: (0) +``` + +[[[generic-scratch3-set-coordinates]]] + +\--- /task \--- + +\--- task \--- + +Now make Flappy keep falling down the Stage by `forever`{:class="block3control"} `changing the sprite's y position by -3`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +go to x: (-50) y: (0) ++ forever + change y by (-3) +end +``` + +\--- /task \--- + +\--- task \--- + +Test your code to make sure Flappy starts in the middle of the screen and falls to the bottom. When you drag Flappy to the top of the Stage, the sprite should fall again. + +\--- /task \--- \ No newline at end of file diff --git a/af-ZA/step_6.md b/af-ZA/step_6.md new file mode 100644 index 0000000..1a98cb2 --- /dev/null +++ b/af-ZA/step_6.md @@ -0,0 +1,106 @@ +## Make Flappy fly + +Now you will make Flappy flap upwards when you press the space bar. When you play the game, you have to time your taps to get Flappy through the gaps in the pipes. + +\--- no-print \--- + +![flappy flying upwards when space bar is pressed](images/flappy-flying.gif) + +\--- /no-print \--- + +Make Flappy fly upwards when you tap the space bar. + +\--- task \--- + +When the `space key is pressed`{:class="block3events"}, Flappy should move upwards by `changing its y coordinate`{:class="block3motion"} by a small amount, for example `6`. + +Flappy flies upwards by `repeating`{:class="block3control"} this movement `10 times`{:class="block3control"}. + +Add this code to your `Flappy` sprite: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +repeat (10) + change y by (6) +end +``` + +\--- /task \--- + +Now you need to get Flappy's wings flapping! + +\--- task \--- + +Click on the **Costumes** tab, and name Flappy's costumes 'wings up' and 'wings down'. + +![naming the costumes](images/flappy-wings.png) + +\--- /task \--- + +\--- task \--- + +Can you make Flappy's costume change to `wings down` when you press space, and then change it back to `wings up` halfway through the upward movement? + +\--- hints \--- + +\--- hint \--- + +You need to split the upward motion in half so that you can use two `repeat`{:class="block3control"} blocks to change Flappy's costume at the beginning and in the middle of the movement. + +Add `switch costume to`{:class="block3looks"} blocks to change how Flappy looks. + +\--- /hint \--- \--- hint \--- + +You need to use these blocks: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +repeat (5) + change y by (6) +end + +repeat (5) + change y by (6) +end + +switch costume to (wings up v) + +switch costume to (wings down v) + +when [space v] key pressed +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +switch costume to (wings down v) +repeat (5) + change y by (6) +end +switch costume to (wings up v) +repeat (5) + change y by (6) +end +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code. As you see, at the moment nothing happens if you let Flappy hit a pipe. + +\--- /task \--- \ No newline at end of file diff --git a/af-ZA/step_7.md b/af-ZA/step_7.md new file mode 100644 index 0000000..40a2720 --- /dev/null +++ b/af-ZA/step_7.md @@ -0,0 +1,77 @@ +## Detect collisions + +To make the game a challenge, the player needs to guide Flappy through the gaps without letting the parrot touch the pipes or the edges of the Stage. You need to add some blocks to detect when Flappy hits something. + +This is called **collision detection**. + +\--- task \--- + +Import a sound from the library that you want to play when Flappy collides with something. The 'screech' sound is a good choice. + +[[[generic-scratch3-sound-from-library]]] + +\--- /task \--- + +A `wait until`{:class="block3control"} block is necessart to check whether Flappy is `touching the pipes`{:class="block3sensing"} `or`{:class="block3operators"} `touching the edge`{:class="block3sensing"}. + +\--- task \--- + +Add a new `when green flag clicked`{:class="block3control"} block to the 'Flappy' sprite, and also add the following code: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) +``` + +\--- /task \--- + +\--- task \--- + +Test your code. If Flappy touches a pipe, the 'screech' sound should play. + +\--- /task \--- + +Next, update the code so that the game stops when Flappy hits a pipe. + +\--- task \--- + +Add the following code to stop the game after a collision is detected: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) ++ say [Game Over!] ++ broadcast (Game Over v) ++ stop [other scripts in sprite v] +``` + +The `broadcast`{:class="block3events"} block tells other sprites that the game is over. + +The `stop`{:class="block3control"} block stops other Flappy scripts that are running so that Flappy stops falling after a collision. + +\--- /task \--- + +\--- task \--- + +Finally, add the following code to the `Pipes` sprite so that pipes `stop`{:class="block3control"} appearing `when the sprite receives Game Over`{:class="block3events"}. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I receive [Game Over v] +stop [other scripts in sprite v] +``` + +\--- /task \--- + +\--- task \--- + +Test your game and see how long you can play before it's 'Game over'! + +\--- /task \--- \ No newline at end of file diff --git a/af-ZA/step_8.md b/af-ZA/step_8.md new file mode 100644 index 0000000..2c5cc08 --- /dev/null +++ b/af-ZA/step_8.md @@ -0,0 +1,116 @@ +## Add a score + +The player should score a point every time Flappy makes it through a gap between pipes. + +\--- task \--- + +Make a new variable **for all sprites** and call it `score`{:class="block3variables"}. + +[[[generic-scratch3-add-variable]]] + +\--- /task \--- + +Each 'Pipes' sprite clone should `wait until`{:class="block3control"} Flappy has flown past and then increase the `score`{:class="block3variables"}. + +\--- task \--- + +First, `set score to 0`{:class="block3variables"} when the game begins: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked ++ set [score v] to [0] +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +\--- /task \--- + +\--- task \--- + +Then add the following code to the `Pipes` sprite: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> +``` + +\--- /task \--- + +\--- task \--- + +Add more code so that, when Flappy's `x` position is greater than the pipe clone's `x` position, the `score`{:class="block3variables"} increases by `1` and a sound of your choice plays. + +You could use the 'pop' sound if you want, or add a sound from the library, for example 'bird'. + +\--- hints \--- + +\--- hint \--- + +You need to `wait until`{:class="block3control"} `Flappy's x position`{:class="block3sensing"} is `greater than (>)`{:class="block3operators"} the `x position`{:class="block3motion"} of `Pipes`. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone ++ wait until <> +``` + +Then `change score by 1`{:class="block3variables"} and `play a sound`{:class="block3sound"}. + +\--- /hint \--- + +\--- hint \--- + +Use these blocks in the correct order: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> + +play sound (pop v) + +change [score v] by (1) + +[x position v] of (Flappy v) + +x position + +() > () +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <([x position v] of (Flappy v)) > (x position)> +change [score v] by (1) +play sound (pop v) +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code and make sure you score a point every time Flappy gets through a gap between pipes. Check whether the `score`{:class="block3variables"} is set to `0` when you start a new game. + +\--- /task \--- \ No newline at end of file diff --git a/af-ZA/step_9.md b/af-ZA/step_9.md new file mode 100644 index 0000000..2f4e2e6 --- /dev/null +++ b/af-ZA/step_9.md @@ -0,0 +1,5 @@ +## Challenge: adjust the difficulty + +Is the game too hard or too easy for you? How many ways can you find to change the difficulty? + +Adjust the game until you are happy with its difficulty! \ No newline at end of file diff --git a/ar-SA/images/banner.png b/ar-SA/images/banner.png new file mode 100644 index 0000000..7a0da5b Binary files /dev/null and b/ar-SA/images/banner.png differ diff --git a/ar-SA/images/binary-showcase.png b/ar-SA/images/binary-showcase.png new file mode 100644 index 0000000..499aa29 Binary files /dev/null and b/ar-SA/images/binary-showcase.png differ diff --git a/ar-SA/images/flappy-clones-test.png b/ar-SA/images/flappy-clones-test.png new file mode 100644 index 0000000..f874059 Binary files /dev/null and b/ar-SA/images/flappy-clones-test.png differ diff --git a/ar-SA/images/flappy-falling.gif b/ar-SA/images/flappy-falling.gif new file mode 100644 index 0000000..970d833 Binary files /dev/null and b/ar-SA/images/flappy-falling.gif differ diff --git a/ar-SA/images/flappy-flying.gif b/ar-SA/images/flappy-flying.gif new file mode 100644 index 0000000..e259ff1 Binary files /dev/null and b/ar-SA/images/flappy-flying.gif differ diff --git a/ar-SA/images/flappy-height-test.png b/ar-SA/images/flappy-height-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/ar-SA/images/flappy-height-test.png differ diff --git a/ar-SA/images/flappy-parrot-showcase.png b/ar-SA/images/flappy-parrot-showcase.png new file mode 100644 index 0000000..493049b Binary files /dev/null and b/ar-SA/images/flappy-parrot-showcase.png differ diff --git a/ar-SA/images/flappy-pipes-duplicate1-annotated.png b/ar-SA/images/flappy-pipes-duplicate1-annotated.png new file mode 100644 index 0000000..65e32c6 Binary files /dev/null and b/ar-SA/images/flappy-pipes-duplicate1-annotated.png differ diff --git a/ar-SA/images/flappy-pipes-duplicate1.png b/ar-SA/images/flappy-pipes-duplicate1.png new file mode 100644 index 0000000..4239b67 Binary files /dev/null and b/ar-SA/images/flappy-pipes-duplicate1.png differ diff --git a/ar-SA/images/flappy-pipes-duplicate2.png b/ar-SA/images/flappy-pipes-duplicate2.png new file mode 100644 index 0000000..ba1a69a Binary files /dev/null and b/ar-SA/images/flappy-pipes-duplicate2.png differ diff --git a/ar-SA/images/flappy-pipes-ends.png b/ar-SA/images/flappy-pipes-ends.png new file mode 100644 index 0000000..ab59aaa Binary files /dev/null and b/ar-SA/images/flappy-pipes-ends.png differ diff --git a/ar-SA/images/flappy-pipes-fill-rectangle.png b/ar-SA/images/flappy-pipes-fill-rectangle.png new file mode 100644 index 0000000..7360b87 Binary files /dev/null and b/ar-SA/images/flappy-pipes-fill-rectangle.png differ diff --git a/ar-SA/images/flappy-pipes-filled.png b/ar-SA/images/flappy-pipes-filled.png new file mode 100644 index 0000000..7d2c0dd Binary files /dev/null and b/ar-SA/images/flappy-pipes-filled.png differ diff --git a/ar-SA/images/flappy-pipes-position.png b/ar-SA/images/flappy-pipes-position.png new file mode 100644 index 0000000..ca2b810 Binary files /dev/null and b/ar-SA/images/flappy-pipes-position.png differ diff --git a/ar-SA/images/flappy-pipes-rectangle.png b/ar-SA/images/flappy-pipes-rectangle.png new file mode 100644 index 0000000..6e3bf02 Binary files /dev/null and b/ar-SA/images/flappy-pipes-rectangle.png differ diff --git a/ar-SA/images/flappy-pipes-test.png b/ar-SA/images/flappy-pipes-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/ar-SA/images/flappy-pipes-test.png differ diff --git a/ar-SA/images/flappy-setup.png b/ar-SA/images/flappy-setup.png new file mode 100644 index 0000000..92f9eca Binary files /dev/null and b/ar-SA/images/flappy-setup.png differ diff --git a/ar-SA/images/flappy-sprite.png b/ar-SA/images/flappy-sprite.png new file mode 100644 index 0000000..6a0c590 Binary files /dev/null and b/ar-SA/images/flappy-sprite.png differ diff --git a/ar-SA/images/flappy-stage.png b/ar-SA/images/flappy-stage.png new file mode 100644 index 0000000..5efe03c Binary files /dev/null and b/ar-SA/images/flappy-stage.png differ diff --git a/ar-SA/images/flappy-starting-position.png b/ar-SA/images/flappy-starting-position.png new file mode 100644 index 0000000..9089c9e Binary files /dev/null and b/ar-SA/images/flappy-starting-position.png differ diff --git a/ar-SA/images/flappy-wings.png b/ar-SA/images/flappy-wings.png new file mode 100644 index 0000000..ef0aa8e Binary files /dev/null and b/ar-SA/images/flappy-wings.png differ diff --git a/ar-SA/images/pipes-sprite.png b/ar-SA/images/pipes-sprite.png new file mode 100644 index 0000000..a9882ed Binary files /dev/null and b/ar-SA/images/pipes-sprite.png differ diff --git a/ar-SA/meta.yml b/ar-SA/meta.yml new file mode 100644 index 0000000..c2fe5e6 --- /dev/null +++ b/ar-SA/meta.yml @@ -0,0 +1,34 @@ +--- +title: Flappy parrot +hero_image: images/banner.png +description: Create a game in which you guide a parrot past moving obstacles +listed: true +copyedit: true +version: 4.1 +last_tested: 2018-10-90 +steps: + - + title: Introduction + - + title: Add the pipes + - + title: "Challenge: make better pipes" + challenge: true + - + title: Make the pipes move + - + title: Make Flappy fall + - + title: Make Flappy fly + - + title: Detect collisions + - + title: Add a score + - + title: 'Challenge: adjust the difficulty' + challenge: true + - + title: 'Challenge: add a high score' + challenge: true + - + title: What next? diff --git a/ar-SA/scratch-translatable.txt b/ar-SA/scratch-translatable.txt new file mode 100644 index 0000000..214e66c --- /dev/null +++ b/ar-SA/scratch-translatable.txt @@ -0,0 +1,13 @@ +Pipes + +costume1 + +Flappy + +wings down + +wings up + +Game Over! + +score diff --git a/ar-SA/solutions/FlappyParrot-Solution.sb3 b/ar-SA/solutions/FlappyParrot-Solution.sb3 new file mode 100644 index 0000000..a0cd354 Binary files /dev/null and b/ar-SA/solutions/FlappyParrot-Solution.sb3 differ diff --git a/ar-SA/step_1.md b/ar-SA/step_1.md new file mode 100644 index 0000000..f7519ae --- /dev/null +++ b/ar-SA/step_1.md @@ -0,0 +1,69 @@ +\--- no-print \--- + +This is the **Scratch 3** version of the project. There is also a [Scratch 2 version of the project](https://projects.raspberrypi.org/en/projects/flappy-parrot-scratch2). + +\--- /no-print \--- + +## Introduction + +Create a game in which you have to guide a parrot past scrolling pipes to score points. + +### What you will make + +\--- no-print \--- + +Click the green flag to start the game. Press the space bar to make the parrot flap its wings, and try to get it to fly through the gaps in the pipes! You score one point for every pipe that you manage to get the parrot past. + +
+ + +
+ +\--- /no-print \--- + +\--- print-only \--- + +You will press the space bar to make the parrot flap its wings, and score one point for every pipe that you manage to get the parrot past. + +![flappy parrot game being played](images/flappy-parrot-showcase.png) + +\--- /print-only \--- + +## \--- collapse \--- + +## title: What you will need + +### Hardware + ++ A computer capable of running Scratch 3 + +### Software + ++ Scratch 3 (either [online](https://rpf.io/scratchon) or [offline](https://rpf.io/scratchoff)) + +\--- /collapse \--- + +## \--- collapse \--- + +## title: What you will learn + ++ How to create sprites using Vector mode ++ How to use sounds ++ How to detect collisions ++ How to control a sprite using the keyboard + +\--- /collapse \--- + +## \--- collapse \--- + +## title: Additional notes for educators + +\--- no-print \--- + +If you need to print this project, please use the [printer-friendly version](https://projects.raspberrypi.org/en/projects/flappy-parrot/print){:target="_blank"}. + +\--- /no-print \--- + +You can find the [completed project here](https://rpf.io/p/en/flappy-parrot-get). + +\--- /collapse \--- \ No newline at end of file diff --git a/ar-SA/step_10.md b/ar-SA/step_10.md new file mode 100644 index 0000000..a5808f3 --- /dev/null +++ b/ar-SA/step_10.md @@ -0,0 +1,9 @@ +## Challenge: add a high score + +\--- challenge \--- + +Can you add a high score to the game so that, in addition to keeping track of score for the current round, it keeps track of the highest score you've ever reached? + +[[[generic-scratch3-high-score]]] + +\--- /challenge \--- \ No newline at end of file diff --git a/ar-SA/step_11.md b/ar-SA/step_11.md new file mode 100644 index 0000000..02ae229 --- /dev/null +++ b/ar-SA/step_11.md @@ -0,0 +1,19 @@ +## What next? + +Try the [Binary hero](https://projects.raspberrypi.org/en/projects/binary-hero?utm_source=pathway&utm_medium=whatnext&utm_campaign=projects) project, where you will make a game in which you play the notes of a song as they scroll down the Stage. + +\--- no-print \--- + +Click the green flag to start the game. Use the z, x, c, and v keys to play the correct notes when these reach the bottom of the Stage. You'll score ten points for every correct note you play. + +
+ +
+ +\--- /no-print \--- + +\--- print-only \--- + +The notes will fall from above, and you will have to press keys to "catch" and play the notes. ![showcase](images/binary-showcase.png) + +\--- /print-only \--- \ No newline at end of file diff --git a/ar-SA/step_2.md b/ar-SA/step_2.md new file mode 100644 index 0000000..d8f2ce5 --- /dev/null +++ b/ar-SA/step_2.md @@ -0,0 +1,84 @@ +## Add the pipes + +First, create the pipes. + +\--- task \--- + +Open a new empty Scratch project. + +[[[generic-scratch3-new-project]]] + +\--- /task \--- + +\--- task \--- + +Add a backdrop with an outdoor landscape. 'Blue Sky' is a good choice. + +![screenshot](images/flappy-stage.png) + +[[[generic-scratch3-backdrop-from-library]]] + +\--- /task \--- + +\--- task \--- + +Create a new sprite and name it 'Pipes'. + +[[[generic-scratch3-draw-sprite]]] + +\--- /task \--- + +The 'Pipes' sprite should be a pair of pipes with a gap in the middle. By moving the sprite up or down, you can put the gap in a different place. + +This picture shows an example of how the pipes could be positioned. The parts of the sprite outside the Stage are normally hidden, you only see then when you drag the sprite: + +![screenshot](images/flappy-pipes-position.png) + +You can't draw a sprite as big as the pipes need to be, but you can increase the size at which the sprite shows on the Stage. + +\--- task \--- + +![pipes sprite](images/pipes-sprite.png) + +Add code to make the sprite bigger. + +```blocks3 +when green flag clicked +set size to (200) % +``` + +This makes it's easier to see how big the pipes should be. + +\--- /task \--- + +\--- task \--- + +Draw a rectangle for the top pipe as shown here: + +![rectangle for the pipe](images/flappy-pipes-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Fill the pipe with a colour you like. + +![fill the rectangle](images/flappy-pipes-fill-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Create a duplicate of the pipe by selecting it and then clicking on **Copy** and **Paste**. + +![copy and paste pipe](images/flappy-pipes-duplicate1-annotated.png) + +\--- /task \--- + +\--- task \--- + +Drag the copy of the pipe to the bottom of the screen so that the copy is in line with the other pipe. There needs to be a gap between the two pipes. + +![screenshot](images/flappy-pipes-duplicate2.png) + +\--- /task \--- \ No newline at end of file diff --git a/ar-SA/step_3.md b/ar-SA/step_3.md new file mode 100644 index 0000000..17f05f7 --- /dev/null +++ b/ar-SA/step_3.md @@ -0,0 +1,11 @@ +## Challenge: make better pipes + +Can you make your pipes look better? + ++ Shade your pipes with a left-to-right gradient. + +![screenshot](images/flappy-pipes-filled.png) + ++ Add extra rectangles to the ends of the pipes: + +![screenshot](images/flappy-pipes-ends.png) \ No newline at end of file diff --git a/ar-SA/step_4.md b/ar-SA/step_4.md new file mode 100644 index 0000000..2beedd9 --- /dev/null +++ b/ar-SA/step_4.md @@ -0,0 +1,65 @@ +## Make the pipes move + +Next you're going to make the pipes move across the screen to create an obstacle course. + +![pipes moving across the screen](images/flappy-clones-test.png) + +\--- task \--- + +First make the pipes appear by adding code to the Pipes sprite so that, `when the green flag is clicked`{:class="block3events"}, the sprite `forever`{:class="block3control"} `creates a clone of itself`{:class="block3control"} every two seconds. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +**Tip:** clones are just copies of a sprite, and they are really useful for creating games. + +\--- /task \--- + +\--- task \--- + +Next make the pipes move by adding code so that, `when a clone starts`{:class="block3control"}, the clone appears on the right side of the Stage and `glides`{:class="block3motion"} across to the left. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show +go to x: (240) y: (0) +glide (4) secs to x: (-240) y: (0) +delete this clone +``` + +**Tip:** you can stop the pipes scrolling by clicking the red **stop** button next to the green flag. + +\--- /task \--- + +Now you should have lots of pipes, but their gaps are always in the same place. + +You can add some variety by using a `random`{:class="block3operators"} number for the Pipes sprite's `y position`{:class="block3motion"}. + +![pipes at different heights](images/flappy-height-test.png) + +\--- task \--- + +Modify your sprite's code so that each sprite clone `picks a random number from -80 to 80`{:class="block3operators"} and `glides`{:class="block3motion"} to that `y position`{:class="block3motion"}: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show ++ go to x: (240) y: (pick random (-80) to (80)) ++ glide (4) secs to x: (-240) y: (y position) +delete this clone +``` + +\--- /task \--- \ No newline at end of file diff --git a/ar-SA/step_5.md b/ar-SA/step_5.md new file mode 100644 index 0000000..f9d79ce --- /dev/null +++ b/ar-SA/step_5.md @@ -0,0 +1,77 @@ +## Make Flappy fall + +Now add a sprite called Flappy and create code it so Flappy falls down the Stage. In the next step, you will add the code to make Flappy fly when you press a key. + +\--- no-print \--- + +![flappy falling animation](images/flappy-falling.gif) + +\--- /no-print \--- + +\--- task \--- + +Add a new sprite that has two costumes, for 'wings up' and 'wings down', and name it `Flappy`. + +The parrot sprite is a good choice. + +![parrot sprite](images/flappy-sprite.png) + +\--- /task \--- + +Flappy needs to be smaller. + +\--- task \--- + +Add code to `set Flappy's size to 25%`{:class="block3looks"} `when the green flag is clicked`{:class="block3events"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +``` + +\--- /task \--- + +When the game starts, Flappy needs to be just left of the centre of the Stage, at coordinates `-50, 0`. + +![flappy shown at the start position](images/flappy-starting-position.png) + +\--- task \--- + +Add code to make Flappy `go to the x and y`{:class="block3motion"} starting position of `x: -50`{:class="block3motion"} and `y: 0`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % ++ go to x: (-50) y: (0) +``` + +[[[generic-scratch3-set-coordinates]]] + +\--- /task \--- + +\--- task \--- + +Now make Flappy keep falling down the Stage by `forever`{:class="block3control"} `changing the sprite's y position by -3`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +go to x: (-50) y: (0) ++ forever + change y by (-3) +end +``` + +\--- /task \--- + +\--- task \--- + +Test your code to make sure Flappy starts in the middle of the screen and falls to the bottom. When you drag Flappy to the top of the Stage, the sprite should fall again. + +\--- /task \--- \ No newline at end of file diff --git a/ar-SA/step_6.md b/ar-SA/step_6.md new file mode 100644 index 0000000..1a98cb2 --- /dev/null +++ b/ar-SA/step_6.md @@ -0,0 +1,106 @@ +## Make Flappy fly + +Now you will make Flappy flap upwards when you press the space bar. When you play the game, you have to time your taps to get Flappy through the gaps in the pipes. + +\--- no-print \--- + +![flappy flying upwards when space bar is pressed](images/flappy-flying.gif) + +\--- /no-print \--- + +Make Flappy fly upwards when you tap the space bar. + +\--- task \--- + +When the `space key is pressed`{:class="block3events"}, Flappy should move upwards by `changing its y coordinate`{:class="block3motion"} by a small amount, for example `6`. + +Flappy flies upwards by `repeating`{:class="block3control"} this movement `10 times`{:class="block3control"}. + +Add this code to your `Flappy` sprite: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +repeat (10) + change y by (6) +end +``` + +\--- /task \--- + +Now you need to get Flappy's wings flapping! + +\--- task \--- + +Click on the **Costumes** tab, and name Flappy's costumes 'wings up' and 'wings down'. + +![naming the costumes](images/flappy-wings.png) + +\--- /task \--- + +\--- task \--- + +Can you make Flappy's costume change to `wings down` when you press space, and then change it back to `wings up` halfway through the upward movement? + +\--- hints \--- + +\--- hint \--- + +You need to split the upward motion in half so that you can use two `repeat`{:class="block3control"} blocks to change Flappy's costume at the beginning and in the middle of the movement. + +Add `switch costume to`{:class="block3looks"} blocks to change how Flappy looks. + +\--- /hint \--- \--- hint \--- + +You need to use these blocks: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +repeat (5) + change y by (6) +end + +repeat (5) + change y by (6) +end + +switch costume to (wings up v) + +switch costume to (wings down v) + +when [space v] key pressed +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +switch costume to (wings down v) +repeat (5) + change y by (6) +end +switch costume to (wings up v) +repeat (5) + change y by (6) +end +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code. As you see, at the moment nothing happens if you let Flappy hit a pipe. + +\--- /task \--- \ No newline at end of file diff --git a/ar-SA/step_7.md b/ar-SA/step_7.md new file mode 100644 index 0000000..40a2720 --- /dev/null +++ b/ar-SA/step_7.md @@ -0,0 +1,77 @@ +## Detect collisions + +To make the game a challenge, the player needs to guide Flappy through the gaps without letting the parrot touch the pipes or the edges of the Stage. You need to add some blocks to detect when Flappy hits something. + +This is called **collision detection**. + +\--- task \--- + +Import a sound from the library that you want to play when Flappy collides with something. The 'screech' sound is a good choice. + +[[[generic-scratch3-sound-from-library]]] + +\--- /task \--- + +A `wait until`{:class="block3control"} block is necessart to check whether Flappy is `touching the pipes`{:class="block3sensing"} `or`{:class="block3operators"} `touching the edge`{:class="block3sensing"}. + +\--- task \--- + +Add a new `when green flag clicked`{:class="block3control"} block to the 'Flappy' sprite, and also add the following code: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) +``` + +\--- /task \--- + +\--- task \--- + +Test your code. If Flappy touches a pipe, the 'screech' sound should play. + +\--- /task \--- + +Next, update the code so that the game stops when Flappy hits a pipe. + +\--- task \--- + +Add the following code to stop the game after a collision is detected: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) ++ say [Game Over!] ++ broadcast (Game Over v) ++ stop [other scripts in sprite v] +``` + +The `broadcast`{:class="block3events"} block tells other sprites that the game is over. + +The `stop`{:class="block3control"} block stops other Flappy scripts that are running so that Flappy stops falling after a collision. + +\--- /task \--- + +\--- task \--- + +Finally, add the following code to the `Pipes` sprite so that pipes `stop`{:class="block3control"} appearing `when the sprite receives Game Over`{:class="block3events"}. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I receive [Game Over v] +stop [other scripts in sprite v] +``` + +\--- /task \--- + +\--- task \--- + +Test your game and see how long you can play before it's 'Game over'! + +\--- /task \--- \ No newline at end of file diff --git a/ar-SA/step_8.md b/ar-SA/step_8.md new file mode 100644 index 0000000..2c5cc08 --- /dev/null +++ b/ar-SA/step_8.md @@ -0,0 +1,116 @@ +## Add a score + +The player should score a point every time Flappy makes it through a gap between pipes. + +\--- task \--- + +Make a new variable **for all sprites** and call it `score`{:class="block3variables"}. + +[[[generic-scratch3-add-variable]]] + +\--- /task \--- + +Each 'Pipes' sprite clone should `wait until`{:class="block3control"} Flappy has flown past and then increase the `score`{:class="block3variables"}. + +\--- task \--- + +First, `set score to 0`{:class="block3variables"} when the game begins: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked ++ set [score v] to [0] +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +\--- /task \--- + +\--- task \--- + +Then add the following code to the `Pipes` sprite: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> +``` + +\--- /task \--- + +\--- task \--- + +Add more code so that, when Flappy's `x` position is greater than the pipe clone's `x` position, the `score`{:class="block3variables"} increases by `1` and a sound of your choice plays. + +You could use the 'pop' sound if you want, or add a sound from the library, for example 'bird'. + +\--- hints \--- + +\--- hint \--- + +You need to `wait until`{:class="block3control"} `Flappy's x position`{:class="block3sensing"} is `greater than (>)`{:class="block3operators"} the `x position`{:class="block3motion"} of `Pipes`. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone ++ wait until <> +``` + +Then `change score by 1`{:class="block3variables"} and `play a sound`{:class="block3sound"}. + +\--- /hint \--- + +\--- hint \--- + +Use these blocks in the correct order: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> + +play sound (pop v) + +change [score v] by (1) + +[x position v] of (Flappy v) + +x position + +() > () +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <([x position v] of (Flappy v)) > (x position)> +change [score v] by (1) +play sound (pop v) +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code and make sure you score a point every time Flappy gets through a gap between pipes. Check whether the `score`{:class="block3variables"} is set to `0` when you start a new game. + +\--- /task \--- \ No newline at end of file diff --git a/ar-SA/step_9.md b/ar-SA/step_9.md new file mode 100644 index 0000000..2f4e2e6 --- /dev/null +++ b/ar-SA/step_9.md @@ -0,0 +1,5 @@ +## Challenge: adjust the difficulty + +Is the game too hard or too easy for you? How many ways can you find to change the difficulty? + +Adjust the game until you are happy with its difficulty! \ No newline at end of file diff --git a/ca-ES/images/banner.png b/ca-ES/images/banner.png new file mode 100644 index 0000000..7a0da5b Binary files /dev/null and b/ca-ES/images/banner.png differ diff --git a/ca-ES/images/binary-showcase.png b/ca-ES/images/binary-showcase.png new file mode 100644 index 0000000..499aa29 Binary files /dev/null and b/ca-ES/images/binary-showcase.png differ diff --git a/ca-ES/images/flappy-clones-test.png b/ca-ES/images/flappy-clones-test.png new file mode 100644 index 0000000..f874059 Binary files /dev/null and b/ca-ES/images/flappy-clones-test.png differ diff --git a/ca-ES/images/flappy-falling.gif b/ca-ES/images/flappy-falling.gif new file mode 100644 index 0000000..970d833 Binary files /dev/null and b/ca-ES/images/flappy-falling.gif differ diff --git a/ca-ES/images/flappy-flying.gif b/ca-ES/images/flappy-flying.gif new file mode 100644 index 0000000..e259ff1 Binary files /dev/null and b/ca-ES/images/flappy-flying.gif differ diff --git a/ca-ES/images/flappy-height-test.png b/ca-ES/images/flappy-height-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/ca-ES/images/flappy-height-test.png differ diff --git a/ca-ES/images/flappy-parrot-showcase.png b/ca-ES/images/flappy-parrot-showcase.png new file mode 100644 index 0000000..493049b Binary files /dev/null and b/ca-ES/images/flappy-parrot-showcase.png differ diff --git a/ca-ES/images/flappy-pipes-duplicate1-annotated.png b/ca-ES/images/flappy-pipes-duplicate1-annotated.png new file mode 100644 index 0000000..65e32c6 Binary files /dev/null and b/ca-ES/images/flappy-pipes-duplicate1-annotated.png differ diff --git a/ca-ES/images/flappy-pipes-duplicate1.png b/ca-ES/images/flappy-pipes-duplicate1.png new file mode 100644 index 0000000..4239b67 Binary files /dev/null and b/ca-ES/images/flappy-pipes-duplicate1.png differ diff --git a/ca-ES/images/flappy-pipes-duplicate2.png b/ca-ES/images/flappy-pipes-duplicate2.png new file mode 100644 index 0000000..ba1a69a Binary files /dev/null and b/ca-ES/images/flappy-pipes-duplicate2.png differ diff --git a/ca-ES/images/flappy-pipes-ends.png b/ca-ES/images/flappy-pipes-ends.png new file mode 100644 index 0000000..ab59aaa Binary files /dev/null and b/ca-ES/images/flappy-pipes-ends.png differ diff --git a/ca-ES/images/flappy-pipes-fill-rectangle.png b/ca-ES/images/flappy-pipes-fill-rectangle.png new file mode 100644 index 0000000..7360b87 Binary files /dev/null and b/ca-ES/images/flappy-pipes-fill-rectangle.png differ diff --git a/ca-ES/images/flappy-pipes-filled.png b/ca-ES/images/flappy-pipes-filled.png new file mode 100644 index 0000000..7d2c0dd Binary files /dev/null and b/ca-ES/images/flappy-pipes-filled.png differ diff --git a/ca-ES/images/flappy-pipes-position.png b/ca-ES/images/flappy-pipes-position.png new file mode 100644 index 0000000..ca2b810 Binary files /dev/null and b/ca-ES/images/flappy-pipes-position.png differ diff --git a/ca-ES/images/flappy-pipes-rectangle.png b/ca-ES/images/flappy-pipes-rectangle.png new file mode 100644 index 0000000..6e3bf02 Binary files /dev/null and b/ca-ES/images/flappy-pipes-rectangle.png differ diff --git a/ca-ES/images/flappy-pipes-test.png b/ca-ES/images/flappy-pipes-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/ca-ES/images/flappy-pipes-test.png differ diff --git a/ca-ES/images/flappy-setup.png b/ca-ES/images/flappy-setup.png new file mode 100644 index 0000000..92f9eca Binary files /dev/null and b/ca-ES/images/flappy-setup.png differ diff --git a/ca-ES/images/flappy-sprite.png b/ca-ES/images/flappy-sprite.png new file mode 100644 index 0000000..6a0c590 Binary files /dev/null and b/ca-ES/images/flappy-sprite.png differ diff --git a/ca-ES/images/flappy-stage.png b/ca-ES/images/flappy-stage.png new file mode 100644 index 0000000..5efe03c Binary files /dev/null and b/ca-ES/images/flappy-stage.png differ diff --git a/ca-ES/images/flappy-starting-position.png b/ca-ES/images/flappy-starting-position.png new file mode 100644 index 0000000..9089c9e Binary files /dev/null and b/ca-ES/images/flappy-starting-position.png differ diff --git a/ca-ES/images/flappy-wings.png b/ca-ES/images/flappy-wings.png new file mode 100644 index 0000000..ef0aa8e Binary files /dev/null and b/ca-ES/images/flappy-wings.png differ diff --git a/ca-ES/images/pipes-sprite.png b/ca-ES/images/pipes-sprite.png new file mode 100644 index 0000000..a9882ed Binary files /dev/null and b/ca-ES/images/pipes-sprite.png differ diff --git a/ca-ES/meta.yml b/ca-ES/meta.yml new file mode 100644 index 0000000..c2fe5e6 --- /dev/null +++ b/ca-ES/meta.yml @@ -0,0 +1,34 @@ +--- +title: Flappy parrot +hero_image: images/banner.png +description: Create a game in which you guide a parrot past moving obstacles +listed: true +copyedit: true +version: 4.1 +last_tested: 2018-10-90 +steps: + - + title: Introduction + - + title: Add the pipes + - + title: "Challenge: make better pipes" + challenge: true + - + title: Make the pipes move + - + title: Make Flappy fall + - + title: Make Flappy fly + - + title: Detect collisions + - + title: Add a score + - + title: 'Challenge: adjust the difficulty' + challenge: true + - + title: 'Challenge: add a high score' + challenge: true + - + title: What next? diff --git a/ca-ES/scratch-translatable.txt b/ca-ES/scratch-translatable.txt new file mode 100644 index 0000000..214e66c --- /dev/null +++ b/ca-ES/scratch-translatable.txt @@ -0,0 +1,13 @@ +Pipes + +costume1 + +Flappy + +wings down + +wings up + +Game Over! + +score diff --git a/ca-ES/solutions/FlappyParrot-Solution.sb3 b/ca-ES/solutions/FlappyParrot-Solution.sb3 new file mode 100644 index 0000000..a0cd354 Binary files /dev/null and b/ca-ES/solutions/FlappyParrot-Solution.sb3 differ diff --git a/ca-ES/step_1.md b/ca-ES/step_1.md new file mode 100644 index 0000000..f7519ae --- /dev/null +++ b/ca-ES/step_1.md @@ -0,0 +1,69 @@ +\--- no-print \--- + +This is the **Scratch 3** version of the project. There is also a [Scratch 2 version of the project](https://projects.raspberrypi.org/en/projects/flappy-parrot-scratch2). + +\--- /no-print \--- + +## Introduction + +Create a game in which you have to guide a parrot past scrolling pipes to score points. + +### What you will make + +\--- no-print \--- + +Click the green flag to start the game. Press the space bar to make the parrot flap its wings, and try to get it to fly through the gaps in the pipes! You score one point for every pipe that you manage to get the parrot past. + +
+ + +
+ +\--- /no-print \--- + +\--- print-only \--- + +You will press the space bar to make the parrot flap its wings, and score one point for every pipe that you manage to get the parrot past. + +![flappy parrot game being played](images/flappy-parrot-showcase.png) + +\--- /print-only \--- + +## \--- collapse \--- + +## title: What you will need + +### Hardware + ++ A computer capable of running Scratch 3 + +### Software + ++ Scratch 3 (either [online](https://rpf.io/scratchon) or [offline](https://rpf.io/scratchoff)) + +\--- /collapse \--- + +## \--- collapse \--- + +## title: What you will learn + ++ How to create sprites using Vector mode ++ How to use sounds ++ How to detect collisions ++ How to control a sprite using the keyboard + +\--- /collapse \--- + +## \--- collapse \--- + +## title: Additional notes for educators + +\--- no-print \--- + +If you need to print this project, please use the [printer-friendly version](https://projects.raspberrypi.org/en/projects/flappy-parrot/print){:target="_blank"}. + +\--- /no-print \--- + +You can find the [completed project here](https://rpf.io/p/en/flappy-parrot-get). + +\--- /collapse \--- \ No newline at end of file diff --git a/ca-ES/step_10.md b/ca-ES/step_10.md new file mode 100644 index 0000000..a5808f3 --- /dev/null +++ b/ca-ES/step_10.md @@ -0,0 +1,9 @@ +## Challenge: add a high score + +\--- challenge \--- + +Can you add a high score to the game so that, in addition to keeping track of score for the current round, it keeps track of the highest score you've ever reached? + +[[[generic-scratch3-high-score]]] + +\--- /challenge \--- \ No newline at end of file diff --git a/ca-ES/step_11.md b/ca-ES/step_11.md new file mode 100644 index 0000000..02ae229 --- /dev/null +++ b/ca-ES/step_11.md @@ -0,0 +1,19 @@ +## What next? + +Try the [Binary hero](https://projects.raspberrypi.org/en/projects/binary-hero?utm_source=pathway&utm_medium=whatnext&utm_campaign=projects) project, where you will make a game in which you play the notes of a song as they scroll down the Stage. + +\--- no-print \--- + +Click the green flag to start the game. Use the z, x, c, and v keys to play the correct notes when these reach the bottom of the Stage. You'll score ten points for every correct note you play. + +
+ +
+ +\--- /no-print \--- + +\--- print-only \--- + +The notes will fall from above, and you will have to press keys to "catch" and play the notes. ![showcase](images/binary-showcase.png) + +\--- /print-only \--- \ No newline at end of file diff --git a/ca-ES/step_2.md b/ca-ES/step_2.md new file mode 100644 index 0000000..d8f2ce5 --- /dev/null +++ b/ca-ES/step_2.md @@ -0,0 +1,84 @@ +## Add the pipes + +First, create the pipes. + +\--- task \--- + +Open a new empty Scratch project. + +[[[generic-scratch3-new-project]]] + +\--- /task \--- + +\--- task \--- + +Add a backdrop with an outdoor landscape. 'Blue Sky' is a good choice. + +![screenshot](images/flappy-stage.png) + +[[[generic-scratch3-backdrop-from-library]]] + +\--- /task \--- + +\--- task \--- + +Create a new sprite and name it 'Pipes'. + +[[[generic-scratch3-draw-sprite]]] + +\--- /task \--- + +The 'Pipes' sprite should be a pair of pipes with a gap in the middle. By moving the sprite up or down, you can put the gap in a different place. + +This picture shows an example of how the pipes could be positioned. The parts of the sprite outside the Stage are normally hidden, you only see then when you drag the sprite: + +![screenshot](images/flappy-pipes-position.png) + +You can't draw a sprite as big as the pipes need to be, but you can increase the size at which the sprite shows on the Stage. + +\--- task \--- + +![pipes sprite](images/pipes-sprite.png) + +Add code to make the sprite bigger. + +```blocks3 +when green flag clicked +set size to (200) % +``` + +This makes it's easier to see how big the pipes should be. + +\--- /task \--- + +\--- task \--- + +Draw a rectangle for the top pipe as shown here: + +![rectangle for the pipe](images/flappy-pipes-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Fill the pipe with a colour you like. + +![fill the rectangle](images/flappy-pipes-fill-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Create a duplicate of the pipe by selecting it and then clicking on **Copy** and **Paste**. + +![copy and paste pipe](images/flappy-pipes-duplicate1-annotated.png) + +\--- /task \--- + +\--- task \--- + +Drag the copy of the pipe to the bottom of the screen so that the copy is in line with the other pipe. There needs to be a gap between the two pipes. + +![screenshot](images/flappy-pipes-duplicate2.png) + +\--- /task \--- \ No newline at end of file diff --git a/ca-ES/step_3.md b/ca-ES/step_3.md new file mode 100644 index 0000000..17f05f7 --- /dev/null +++ b/ca-ES/step_3.md @@ -0,0 +1,11 @@ +## Challenge: make better pipes + +Can you make your pipes look better? + ++ Shade your pipes with a left-to-right gradient. + +![screenshot](images/flappy-pipes-filled.png) + ++ Add extra rectangles to the ends of the pipes: + +![screenshot](images/flappy-pipes-ends.png) \ No newline at end of file diff --git a/ca-ES/step_4.md b/ca-ES/step_4.md new file mode 100644 index 0000000..2beedd9 --- /dev/null +++ b/ca-ES/step_4.md @@ -0,0 +1,65 @@ +## Make the pipes move + +Next you're going to make the pipes move across the screen to create an obstacle course. + +![pipes moving across the screen](images/flappy-clones-test.png) + +\--- task \--- + +First make the pipes appear by adding code to the Pipes sprite so that, `when the green flag is clicked`{:class="block3events"}, the sprite `forever`{:class="block3control"} `creates a clone of itself`{:class="block3control"} every two seconds. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +**Tip:** clones are just copies of a sprite, and they are really useful for creating games. + +\--- /task \--- + +\--- task \--- + +Next make the pipes move by adding code so that, `when a clone starts`{:class="block3control"}, the clone appears on the right side of the Stage and `glides`{:class="block3motion"} across to the left. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show +go to x: (240) y: (0) +glide (4) secs to x: (-240) y: (0) +delete this clone +``` + +**Tip:** you can stop the pipes scrolling by clicking the red **stop** button next to the green flag. + +\--- /task \--- + +Now you should have lots of pipes, but their gaps are always in the same place. + +You can add some variety by using a `random`{:class="block3operators"} number for the Pipes sprite's `y position`{:class="block3motion"}. + +![pipes at different heights](images/flappy-height-test.png) + +\--- task \--- + +Modify your sprite's code so that each sprite clone `picks a random number from -80 to 80`{:class="block3operators"} and `glides`{:class="block3motion"} to that `y position`{:class="block3motion"}: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show ++ go to x: (240) y: (pick random (-80) to (80)) ++ glide (4) secs to x: (-240) y: (y position) +delete this clone +``` + +\--- /task \--- \ No newline at end of file diff --git a/ca-ES/step_5.md b/ca-ES/step_5.md new file mode 100644 index 0000000..f9d79ce --- /dev/null +++ b/ca-ES/step_5.md @@ -0,0 +1,77 @@ +## Make Flappy fall + +Now add a sprite called Flappy and create code it so Flappy falls down the Stage. In the next step, you will add the code to make Flappy fly when you press a key. + +\--- no-print \--- + +![flappy falling animation](images/flappy-falling.gif) + +\--- /no-print \--- + +\--- task \--- + +Add a new sprite that has two costumes, for 'wings up' and 'wings down', and name it `Flappy`. + +The parrot sprite is a good choice. + +![parrot sprite](images/flappy-sprite.png) + +\--- /task \--- + +Flappy needs to be smaller. + +\--- task \--- + +Add code to `set Flappy's size to 25%`{:class="block3looks"} `when the green flag is clicked`{:class="block3events"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +``` + +\--- /task \--- + +When the game starts, Flappy needs to be just left of the centre of the Stage, at coordinates `-50, 0`. + +![flappy shown at the start position](images/flappy-starting-position.png) + +\--- task \--- + +Add code to make Flappy `go to the x and y`{:class="block3motion"} starting position of `x: -50`{:class="block3motion"} and `y: 0`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % ++ go to x: (-50) y: (0) +``` + +[[[generic-scratch3-set-coordinates]]] + +\--- /task \--- + +\--- task \--- + +Now make Flappy keep falling down the Stage by `forever`{:class="block3control"} `changing the sprite's y position by -3`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +go to x: (-50) y: (0) ++ forever + change y by (-3) +end +``` + +\--- /task \--- + +\--- task \--- + +Test your code to make sure Flappy starts in the middle of the screen and falls to the bottom. When you drag Flappy to the top of the Stage, the sprite should fall again. + +\--- /task \--- \ No newline at end of file diff --git a/ca-ES/step_6.md b/ca-ES/step_6.md new file mode 100644 index 0000000..1a98cb2 --- /dev/null +++ b/ca-ES/step_6.md @@ -0,0 +1,106 @@ +## Make Flappy fly + +Now you will make Flappy flap upwards when you press the space bar. When you play the game, you have to time your taps to get Flappy through the gaps in the pipes. + +\--- no-print \--- + +![flappy flying upwards when space bar is pressed](images/flappy-flying.gif) + +\--- /no-print \--- + +Make Flappy fly upwards when you tap the space bar. + +\--- task \--- + +When the `space key is pressed`{:class="block3events"}, Flappy should move upwards by `changing its y coordinate`{:class="block3motion"} by a small amount, for example `6`. + +Flappy flies upwards by `repeating`{:class="block3control"} this movement `10 times`{:class="block3control"}. + +Add this code to your `Flappy` sprite: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +repeat (10) + change y by (6) +end +``` + +\--- /task \--- + +Now you need to get Flappy's wings flapping! + +\--- task \--- + +Click on the **Costumes** tab, and name Flappy's costumes 'wings up' and 'wings down'. + +![naming the costumes](images/flappy-wings.png) + +\--- /task \--- + +\--- task \--- + +Can you make Flappy's costume change to `wings down` when you press space, and then change it back to `wings up` halfway through the upward movement? + +\--- hints \--- + +\--- hint \--- + +You need to split the upward motion in half so that you can use two `repeat`{:class="block3control"} blocks to change Flappy's costume at the beginning and in the middle of the movement. + +Add `switch costume to`{:class="block3looks"} blocks to change how Flappy looks. + +\--- /hint \--- \--- hint \--- + +You need to use these blocks: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +repeat (5) + change y by (6) +end + +repeat (5) + change y by (6) +end + +switch costume to (wings up v) + +switch costume to (wings down v) + +when [space v] key pressed +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +switch costume to (wings down v) +repeat (5) + change y by (6) +end +switch costume to (wings up v) +repeat (5) + change y by (6) +end +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code. As you see, at the moment nothing happens if you let Flappy hit a pipe. + +\--- /task \--- \ No newline at end of file diff --git a/ca-ES/step_7.md b/ca-ES/step_7.md new file mode 100644 index 0000000..40a2720 --- /dev/null +++ b/ca-ES/step_7.md @@ -0,0 +1,77 @@ +## Detect collisions + +To make the game a challenge, the player needs to guide Flappy through the gaps without letting the parrot touch the pipes or the edges of the Stage. You need to add some blocks to detect when Flappy hits something. + +This is called **collision detection**. + +\--- task \--- + +Import a sound from the library that you want to play when Flappy collides with something. The 'screech' sound is a good choice. + +[[[generic-scratch3-sound-from-library]]] + +\--- /task \--- + +A `wait until`{:class="block3control"} block is necessart to check whether Flappy is `touching the pipes`{:class="block3sensing"} `or`{:class="block3operators"} `touching the edge`{:class="block3sensing"}. + +\--- task \--- + +Add a new `when green flag clicked`{:class="block3control"} block to the 'Flappy' sprite, and also add the following code: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) +``` + +\--- /task \--- + +\--- task \--- + +Test your code. If Flappy touches a pipe, the 'screech' sound should play. + +\--- /task \--- + +Next, update the code so that the game stops when Flappy hits a pipe. + +\--- task \--- + +Add the following code to stop the game after a collision is detected: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) ++ say [Game Over!] ++ broadcast (Game Over v) ++ stop [other scripts in sprite v] +``` + +The `broadcast`{:class="block3events"} block tells other sprites that the game is over. + +The `stop`{:class="block3control"} block stops other Flappy scripts that are running so that Flappy stops falling after a collision. + +\--- /task \--- + +\--- task \--- + +Finally, add the following code to the `Pipes` sprite so that pipes `stop`{:class="block3control"} appearing `when the sprite receives Game Over`{:class="block3events"}. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I receive [Game Over v] +stop [other scripts in sprite v] +``` + +\--- /task \--- + +\--- task \--- + +Test your game and see how long you can play before it's 'Game over'! + +\--- /task \--- \ No newline at end of file diff --git a/ca-ES/step_8.md b/ca-ES/step_8.md new file mode 100644 index 0000000..2c5cc08 --- /dev/null +++ b/ca-ES/step_8.md @@ -0,0 +1,116 @@ +## Add a score + +The player should score a point every time Flappy makes it through a gap between pipes. + +\--- task \--- + +Make a new variable **for all sprites** and call it `score`{:class="block3variables"}. + +[[[generic-scratch3-add-variable]]] + +\--- /task \--- + +Each 'Pipes' sprite clone should `wait until`{:class="block3control"} Flappy has flown past and then increase the `score`{:class="block3variables"}. + +\--- task \--- + +First, `set score to 0`{:class="block3variables"} when the game begins: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked ++ set [score v] to [0] +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +\--- /task \--- + +\--- task \--- + +Then add the following code to the `Pipes` sprite: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> +``` + +\--- /task \--- + +\--- task \--- + +Add more code so that, when Flappy's `x` position is greater than the pipe clone's `x` position, the `score`{:class="block3variables"} increases by `1` and a sound of your choice plays. + +You could use the 'pop' sound if you want, or add a sound from the library, for example 'bird'. + +\--- hints \--- + +\--- hint \--- + +You need to `wait until`{:class="block3control"} `Flappy's x position`{:class="block3sensing"} is `greater than (>)`{:class="block3operators"} the `x position`{:class="block3motion"} of `Pipes`. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone ++ wait until <> +``` + +Then `change score by 1`{:class="block3variables"} and `play a sound`{:class="block3sound"}. + +\--- /hint \--- + +\--- hint \--- + +Use these blocks in the correct order: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> + +play sound (pop v) + +change [score v] by (1) + +[x position v] of (Flappy v) + +x position + +() > () +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <([x position v] of (Flappy v)) > (x position)> +change [score v] by (1) +play sound (pop v) +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code and make sure you score a point every time Flappy gets through a gap between pipes. Check whether the `score`{:class="block3variables"} is set to `0` when you start a new game. + +\--- /task \--- \ No newline at end of file diff --git a/ca-ES/step_9.md b/ca-ES/step_9.md new file mode 100644 index 0000000..2f4e2e6 --- /dev/null +++ b/ca-ES/step_9.md @@ -0,0 +1,5 @@ +## Challenge: adjust the difficulty + +Is the game too hard or too easy for you? How many ways can you find to change the difficulty? + +Adjust the game until you are happy with its difficulty! \ No newline at end of file diff --git a/cs-CZ/images/banner.png b/cs-CZ/images/banner.png new file mode 100644 index 0000000..7a0da5b Binary files /dev/null and b/cs-CZ/images/banner.png differ diff --git a/cs-CZ/images/binary-showcase.png b/cs-CZ/images/binary-showcase.png new file mode 100644 index 0000000..499aa29 Binary files /dev/null and b/cs-CZ/images/binary-showcase.png differ diff --git a/cs-CZ/images/flappy-clones-test.png b/cs-CZ/images/flappy-clones-test.png new file mode 100644 index 0000000..f874059 Binary files /dev/null and b/cs-CZ/images/flappy-clones-test.png differ diff --git a/cs-CZ/images/flappy-falling.gif b/cs-CZ/images/flappy-falling.gif new file mode 100644 index 0000000..970d833 Binary files /dev/null and b/cs-CZ/images/flappy-falling.gif differ diff --git a/cs-CZ/images/flappy-flying.gif b/cs-CZ/images/flappy-flying.gif new file mode 100644 index 0000000..e259ff1 Binary files /dev/null and b/cs-CZ/images/flappy-flying.gif differ diff --git a/cs-CZ/images/flappy-height-test.png b/cs-CZ/images/flappy-height-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/cs-CZ/images/flappy-height-test.png differ diff --git a/cs-CZ/images/flappy-parrot-showcase.png b/cs-CZ/images/flappy-parrot-showcase.png new file mode 100644 index 0000000..493049b Binary files /dev/null and b/cs-CZ/images/flappy-parrot-showcase.png differ diff --git a/cs-CZ/images/flappy-pipes-duplicate1-annotated.png b/cs-CZ/images/flappy-pipes-duplicate1-annotated.png new file mode 100644 index 0000000..65e32c6 Binary files /dev/null and b/cs-CZ/images/flappy-pipes-duplicate1-annotated.png differ diff --git a/cs-CZ/images/flappy-pipes-duplicate1.png b/cs-CZ/images/flappy-pipes-duplicate1.png new file mode 100644 index 0000000..4239b67 Binary files /dev/null and b/cs-CZ/images/flappy-pipes-duplicate1.png differ diff --git a/cs-CZ/images/flappy-pipes-duplicate2.png b/cs-CZ/images/flappy-pipes-duplicate2.png new file mode 100644 index 0000000..ba1a69a Binary files /dev/null and b/cs-CZ/images/flappy-pipes-duplicate2.png differ diff --git a/cs-CZ/images/flappy-pipes-ends.png b/cs-CZ/images/flappy-pipes-ends.png new file mode 100644 index 0000000..ab59aaa Binary files /dev/null and b/cs-CZ/images/flappy-pipes-ends.png differ diff --git a/cs-CZ/images/flappy-pipes-fill-rectangle.png b/cs-CZ/images/flappy-pipes-fill-rectangle.png new file mode 100644 index 0000000..7360b87 Binary files /dev/null and b/cs-CZ/images/flappy-pipes-fill-rectangle.png differ diff --git a/cs-CZ/images/flappy-pipes-filled.png b/cs-CZ/images/flappy-pipes-filled.png new file mode 100644 index 0000000..7d2c0dd Binary files /dev/null and b/cs-CZ/images/flappy-pipes-filled.png differ diff --git a/cs-CZ/images/flappy-pipes-position.png b/cs-CZ/images/flappy-pipes-position.png new file mode 100644 index 0000000..ca2b810 Binary files /dev/null and b/cs-CZ/images/flappy-pipes-position.png differ diff --git a/cs-CZ/images/flappy-pipes-rectangle.png b/cs-CZ/images/flappy-pipes-rectangle.png new file mode 100644 index 0000000..6e3bf02 Binary files /dev/null and b/cs-CZ/images/flappy-pipes-rectangle.png differ diff --git a/cs-CZ/images/flappy-pipes-test.png b/cs-CZ/images/flappy-pipes-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/cs-CZ/images/flappy-pipes-test.png differ diff --git a/cs-CZ/images/flappy-setup.png b/cs-CZ/images/flappy-setup.png new file mode 100644 index 0000000..92f9eca Binary files /dev/null and b/cs-CZ/images/flappy-setup.png differ diff --git a/cs-CZ/images/flappy-sprite.png b/cs-CZ/images/flappy-sprite.png new file mode 100644 index 0000000..6a0c590 Binary files /dev/null and b/cs-CZ/images/flappy-sprite.png differ diff --git a/cs-CZ/images/flappy-stage.png b/cs-CZ/images/flappy-stage.png new file mode 100644 index 0000000..5efe03c Binary files /dev/null and b/cs-CZ/images/flappy-stage.png differ diff --git a/cs-CZ/images/flappy-starting-position.png b/cs-CZ/images/flappy-starting-position.png new file mode 100644 index 0000000..9089c9e Binary files /dev/null and b/cs-CZ/images/flappy-starting-position.png differ diff --git a/cs-CZ/images/flappy-wings.png b/cs-CZ/images/flappy-wings.png new file mode 100644 index 0000000..ef0aa8e Binary files /dev/null and b/cs-CZ/images/flappy-wings.png differ diff --git a/cs-CZ/images/pipes-sprite.png b/cs-CZ/images/pipes-sprite.png new file mode 100644 index 0000000..a9882ed Binary files /dev/null and b/cs-CZ/images/pipes-sprite.png differ diff --git a/cs-CZ/meta.yml b/cs-CZ/meta.yml new file mode 100644 index 0000000..c2fe5e6 --- /dev/null +++ b/cs-CZ/meta.yml @@ -0,0 +1,34 @@ +--- +title: Flappy parrot +hero_image: images/banner.png +description: Create a game in which you guide a parrot past moving obstacles +listed: true +copyedit: true +version: 4.1 +last_tested: 2018-10-90 +steps: + - + title: Introduction + - + title: Add the pipes + - + title: "Challenge: make better pipes" + challenge: true + - + title: Make the pipes move + - + title: Make Flappy fall + - + title: Make Flappy fly + - + title: Detect collisions + - + title: Add a score + - + title: 'Challenge: adjust the difficulty' + challenge: true + - + title: 'Challenge: add a high score' + challenge: true + - + title: What next? diff --git a/cs-CZ/scratch-translatable.txt b/cs-CZ/scratch-translatable.txt new file mode 100644 index 0000000..214e66c --- /dev/null +++ b/cs-CZ/scratch-translatable.txt @@ -0,0 +1,13 @@ +Pipes + +costume1 + +Flappy + +wings down + +wings up + +Game Over! + +score diff --git a/cs-CZ/solutions/FlappyParrot-Solution.sb3 b/cs-CZ/solutions/FlappyParrot-Solution.sb3 new file mode 100644 index 0000000..a0cd354 Binary files /dev/null and b/cs-CZ/solutions/FlappyParrot-Solution.sb3 differ diff --git a/cs-CZ/step_1.md b/cs-CZ/step_1.md new file mode 100644 index 0000000..f7519ae --- /dev/null +++ b/cs-CZ/step_1.md @@ -0,0 +1,69 @@ +\--- no-print \--- + +This is the **Scratch 3** version of the project. There is also a [Scratch 2 version of the project](https://projects.raspberrypi.org/en/projects/flappy-parrot-scratch2). + +\--- /no-print \--- + +## Introduction + +Create a game in which you have to guide a parrot past scrolling pipes to score points. + +### What you will make + +\--- no-print \--- + +Click the green flag to start the game. Press the space bar to make the parrot flap its wings, and try to get it to fly through the gaps in the pipes! You score one point for every pipe that you manage to get the parrot past. + +
+ + +
+ +\--- /no-print \--- + +\--- print-only \--- + +You will press the space bar to make the parrot flap its wings, and score one point for every pipe that you manage to get the parrot past. + +![flappy parrot game being played](images/flappy-parrot-showcase.png) + +\--- /print-only \--- + +## \--- collapse \--- + +## title: What you will need + +### Hardware + ++ A computer capable of running Scratch 3 + +### Software + ++ Scratch 3 (either [online](https://rpf.io/scratchon) or [offline](https://rpf.io/scratchoff)) + +\--- /collapse \--- + +## \--- collapse \--- + +## title: What you will learn + ++ How to create sprites using Vector mode ++ How to use sounds ++ How to detect collisions ++ How to control a sprite using the keyboard + +\--- /collapse \--- + +## \--- collapse \--- + +## title: Additional notes for educators + +\--- no-print \--- + +If you need to print this project, please use the [printer-friendly version](https://projects.raspberrypi.org/en/projects/flappy-parrot/print){:target="_blank"}. + +\--- /no-print \--- + +You can find the [completed project here](https://rpf.io/p/en/flappy-parrot-get). + +\--- /collapse \--- \ No newline at end of file diff --git a/cs-CZ/step_10.md b/cs-CZ/step_10.md new file mode 100644 index 0000000..a5808f3 --- /dev/null +++ b/cs-CZ/step_10.md @@ -0,0 +1,9 @@ +## Challenge: add a high score + +\--- challenge \--- + +Can you add a high score to the game so that, in addition to keeping track of score for the current round, it keeps track of the highest score you've ever reached? + +[[[generic-scratch3-high-score]]] + +\--- /challenge \--- \ No newline at end of file diff --git a/cs-CZ/step_11.md b/cs-CZ/step_11.md new file mode 100644 index 0000000..02ae229 --- /dev/null +++ b/cs-CZ/step_11.md @@ -0,0 +1,19 @@ +## What next? + +Try the [Binary hero](https://projects.raspberrypi.org/en/projects/binary-hero?utm_source=pathway&utm_medium=whatnext&utm_campaign=projects) project, where you will make a game in which you play the notes of a song as they scroll down the Stage. + +\--- no-print \--- + +Click the green flag to start the game. Use the z, x, c, and v keys to play the correct notes when these reach the bottom of the Stage. You'll score ten points for every correct note you play. + +
+ +
+ +\--- /no-print \--- + +\--- print-only \--- + +The notes will fall from above, and you will have to press keys to "catch" and play the notes. ![showcase](images/binary-showcase.png) + +\--- /print-only \--- \ No newline at end of file diff --git a/cs-CZ/step_2.md b/cs-CZ/step_2.md new file mode 100644 index 0000000..d8f2ce5 --- /dev/null +++ b/cs-CZ/step_2.md @@ -0,0 +1,84 @@ +## Add the pipes + +First, create the pipes. + +\--- task \--- + +Open a new empty Scratch project. + +[[[generic-scratch3-new-project]]] + +\--- /task \--- + +\--- task \--- + +Add a backdrop with an outdoor landscape. 'Blue Sky' is a good choice. + +![screenshot](images/flappy-stage.png) + +[[[generic-scratch3-backdrop-from-library]]] + +\--- /task \--- + +\--- task \--- + +Create a new sprite and name it 'Pipes'. + +[[[generic-scratch3-draw-sprite]]] + +\--- /task \--- + +The 'Pipes' sprite should be a pair of pipes with a gap in the middle. By moving the sprite up or down, you can put the gap in a different place. + +This picture shows an example of how the pipes could be positioned. The parts of the sprite outside the Stage are normally hidden, you only see then when you drag the sprite: + +![screenshot](images/flappy-pipes-position.png) + +You can't draw a sprite as big as the pipes need to be, but you can increase the size at which the sprite shows on the Stage. + +\--- task \--- + +![pipes sprite](images/pipes-sprite.png) + +Add code to make the sprite bigger. + +```blocks3 +when green flag clicked +set size to (200) % +``` + +This makes it's easier to see how big the pipes should be. + +\--- /task \--- + +\--- task \--- + +Draw a rectangle for the top pipe as shown here: + +![rectangle for the pipe](images/flappy-pipes-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Fill the pipe with a colour you like. + +![fill the rectangle](images/flappy-pipes-fill-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Create a duplicate of the pipe by selecting it and then clicking on **Copy** and **Paste**. + +![copy and paste pipe](images/flappy-pipes-duplicate1-annotated.png) + +\--- /task \--- + +\--- task \--- + +Drag the copy of the pipe to the bottom of the screen so that the copy is in line with the other pipe. There needs to be a gap between the two pipes. + +![screenshot](images/flappy-pipes-duplicate2.png) + +\--- /task \--- \ No newline at end of file diff --git a/cs-CZ/step_3.md b/cs-CZ/step_3.md new file mode 100644 index 0000000..17f05f7 --- /dev/null +++ b/cs-CZ/step_3.md @@ -0,0 +1,11 @@ +## Challenge: make better pipes + +Can you make your pipes look better? + ++ Shade your pipes with a left-to-right gradient. + +![screenshot](images/flappy-pipes-filled.png) + ++ Add extra rectangles to the ends of the pipes: + +![screenshot](images/flappy-pipes-ends.png) \ No newline at end of file diff --git a/cs-CZ/step_4.md b/cs-CZ/step_4.md new file mode 100644 index 0000000..2beedd9 --- /dev/null +++ b/cs-CZ/step_4.md @@ -0,0 +1,65 @@ +## Make the pipes move + +Next you're going to make the pipes move across the screen to create an obstacle course. + +![pipes moving across the screen](images/flappy-clones-test.png) + +\--- task \--- + +First make the pipes appear by adding code to the Pipes sprite so that, `when the green flag is clicked`{:class="block3events"}, the sprite `forever`{:class="block3control"} `creates a clone of itself`{:class="block3control"} every two seconds. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +**Tip:** clones are just copies of a sprite, and they are really useful for creating games. + +\--- /task \--- + +\--- task \--- + +Next make the pipes move by adding code so that, `when a clone starts`{:class="block3control"}, the clone appears on the right side of the Stage and `glides`{:class="block3motion"} across to the left. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show +go to x: (240) y: (0) +glide (4) secs to x: (-240) y: (0) +delete this clone +``` + +**Tip:** you can stop the pipes scrolling by clicking the red **stop** button next to the green flag. + +\--- /task \--- + +Now you should have lots of pipes, but their gaps are always in the same place. + +You can add some variety by using a `random`{:class="block3operators"} number for the Pipes sprite's `y position`{:class="block3motion"}. + +![pipes at different heights](images/flappy-height-test.png) + +\--- task \--- + +Modify your sprite's code so that each sprite clone `picks a random number from -80 to 80`{:class="block3operators"} and `glides`{:class="block3motion"} to that `y position`{:class="block3motion"}: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show ++ go to x: (240) y: (pick random (-80) to (80)) ++ glide (4) secs to x: (-240) y: (y position) +delete this clone +``` + +\--- /task \--- \ No newline at end of file diff --git a/cs-CZ/step_5.md b/cs-CZ/step_5.md new file mode 100644 index 0000000..f9d79ce --- /dev/null +++ b/cs-CZ/step_5.md @@ -0,0 +1,77 @@ +## Make Flappy fall + +Now add a sprite called Flappy and create code it so Flappy falls down the Stage. In the next step, you will add the code to make Flappy fly when you press a key. + +\--- no-print \--- + +![flappy falling animation](images/flappy-falling.gif) + +\--- /no-print \--- + +\--- task \--- + +Add a new sprite that has two costumes, for 'wings up' and 'wings down', and name it `Flappy`. + +The parrot sprite is a good choice. + +![parrot sprite](images/flappy-sprite.png) + +\--- /task \--- + +Flappy needs to be smaller. + +\--- task \--- + +Add code to `set Flappy's size to 25%`{:class="block3looks"} `when the green flag is clicked`{:class="block3events"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +``` + +\--- /task \--- + +When the game starts, Flappy needs to be just left of the centre of the Stage, at coordinates `-50, 0`. + +![flappy shown at the start position](images/flappy-starting-position.png) + +\--- task \--- + +Add code to make Flappy `go to the x and y`{:class="block3motion"} starting position of `x: -50`{:class="block3motion"} and `y: 0`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % ++ go to x: (-50) y: (0) +``` + +[[[generic-scratch3-set-coordinates]]] + +\--- /task \--- + +\--- task \--- + +Now make Flappy keep falling down the Stage by `forever`{:class="block3control"} `changing the sprite's y position by -3`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +go to x: (-50) y: (0) ++ forever + change y by (-3) +end +``` + +\--- /task \--- + +\--- task \--- + +Test your code to make sure Flappy starts in the middle of the screen and falls to the bottom. When you drag Flappy to the top of the Stage, the sprite should fall again. + +\--- /task \--- \ No newline at end of file diff --git a/cs-CZ/step_6.md b/cs-CZ/step_6.md new file mode 100644 index 0000000..1a98cb2 --- /dev/null +++ b/cs-CZ/step_6.md @@ -0,0 +1,106 @@ +## Make Flappy fly + +Now you will make Flappy flap upwards when you press the space bar. When you play the game, you have to time your taps to get Flappy through the gaps in the pipes. + +\--- no-print \--- + +![flappy flying upwards when space bar is pressed](images/flappy-flying.gif) + +\--- /no-print \--- + +Make Flappy fly upwards when you tap the space bar. + +\--- task \--- + +When the `space key is pressed`{:class="block3events"}, Flappy should move upwards by `changing its y coordinate`{:class="block3motion"} by a small amount, for example `6`. + +Flappy flies upwards by `repeating`{:class="block3control"} this movement `10 times`{:class="block3control"}. + +Add this code to your `Flappy` sprite: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +repeat (10) + change y by (6) +end +``` + +\--- /task \--- + +Now you need to get Flappy's wings flapping! + +\--- task \--- + +Click on the **Costumes** tab, and name Flappy's costumes 'wings up' and 'wings down'. + +![naming the costumes](images/flappy-wings.png) + +\--- /task \--- + +\--- task \--- + +Can you make Flappy's costume change to `wings down` when you press space, and then change it back to `wings up` halfway through the upward movement? + +\--- hints \--- + +\--- hint \--- + +You need to split the upward motion in half so that you can use two `repeat`{:class="block3control"} blocks to change Flappy's costume at the beginning and in the middle of the movement. + +Add `switch costume to`{:class="block3looks"} blocks to change how Flappy looks. + +\--- /hint \--- \--- hint \--- + +You need to use these blocks: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +repeat (5) + change y by (6) +end + +repeat (5) + change y by (6) +end + +switch costume to (wings up v) + +switch costume to (wings down v) + +when [space v] key pressed +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +switch costume to (wings down v) +repeat (5) + change y by (6) +end +switch costume to (wings up v) +repeat (5) + change y by (6) +end +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code. As you see, at the moment nothing happens if you let Flappy hit a pipe. + +\--- /task \--- \ No newline at end of file diff --git a/cs-CZ/step_7.md b/cs-CZ/step_7.md new file mode 100644 index 0000000..40a2720 --- /dev/null +++ b/cs-CZ/step_7.md @@ -0,0 +1,77 @@ +## Detect collisions + +To make the game a challenge, the player needs to guide Flappy through the gaps without letting the parrot touch the pipes or the edges of the Stage. You need to add some blocks to detect when Flappy hits something. + +This is called **collision detection**. + +\--- task \--- + +Import a sound from the library that you want to play when Flappy collides with something. The 'screech' sound is a good choice. + +[[[generic-scratch3-sound-from-library]]] + +\--- /task \--- + +A `wait until`{:class="block3control"} block is necessart to check whether Flappy is `touching the pipes`{:class="block3sensing"} `or`{:class="block3operators"} `touching the edge`{:class="block3sensing"}. + +\--- task \--- + +Add a new `when green flag clicked`{:class="block3control"} block to the 'Flappy' sprite, and also add the following code: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) +``` + +\--- /task \--- + +\--- task \--- + +Test your code. If Flappy touches a pipe, the 'screech' sound should play. + +\--- /task \--- + +Next, update the code so that the game stops when Flappy hits a pipe. + +\--- task \--- + +Add the following code to stop the game after a collision is detected: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) ++ say [Game Over!] ++ broadcast (Game Over v) ++ stop [other scripts in sprite v] +``` + +The `broadcast`{:class="block3events"} block tells other sprites that the game is over. + +The `stop`{:class="block3control"} block stops other Flappy scripts that are running so that Flappy stops falling after a collision. + +\--- /task \--- + +\--- task \--- + +Finally, add the following code to the `Pipes` sprite so that pipes `stop`{:class="block3control"} appearing `when the sprite receives Game Over`{:class="block3events"}. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I receive [Game Over v] +stop [other scripts in sprite v] +``` + +\--- /task \--- + +\--- task \--- + +Test your game and see how long you can play before it's 'Game over'! + +\--- /task \--- \ No newline at end of file diff --git a/cs-CZ/step_8.md b/cs-CZ/step_8.md new file mode 100644 index 0000000..2c5cc08 --- /dev/null +++ b/cs-CZ/step_8.md @@ -0,0 +1,116 @@ +## Add a score + +The player should score a point every time Flappy makes it through a gap between pipes. + +\--- task \--- + +Make a new variable **for all sprites** and call it `score`{:class="block3variables"}. + +[[[generic-scratch3-add-variable]]] + +\--- /task \--- + +Each 'Pipes' sprite clone should `wait until`{:class="block3control"} Flappy has flown past and then increase the `score`{:class="block3variables"}. + +\--- task \--- + +First, `set score to 0`{:class="block3variables"} when the game begins: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked ++ set [score v] to [0] +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +\--- /task \--- + +\--- task \--- + +Then add the following code to the `Pipes` sprite: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> +``` + +\--- /task \--- + +\--- task \--- + +Add more code so that, when Flappy's `x` position is greater than the pipe clone's `x` position, the `score`{:class="block3variables"} increases by `1` and a sound of your choice plays. + +You could use the 'pop' sound if you want, or add a sound from the library, for example 'bird'. + +\--- hints \--- + +\--- hint \--- + +You need to `wait until`{:class="block3control"} `Flappy's x position`{:class="block3sensing"} is `greater than (>)`{:class="block3operators"} the `x position`{:class="block3motion"} of `Pipes`. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone ++ wait until <> +``` + +Then `change score by 1`{:class="block3variables"} and `play a sound`{:class="block3sound"}. + +\--- /hint \--- + +\--- hint \--- + +Use these blocks in the correct order: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> + +play sound (pop v) + +change [score v] by (1) + +[x position v] of (Flappy v) + +x position + +() > () +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <([x position v] of (Flappy v)) > (x position)> +change [score v] by (1) +play sound (pop v) +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code and make sure you score a point every time Flappy gets through a gap between pipes. Check whether the `score`{:class="block3variables"} is set to `0` when you start a new game. + +\--- /task \--- \ No newline at end of file diff --git a/cs-CZ/step_9.md b/cs-CZ/step_9.md new file mode 100644 index 0000000..2f4e2e6 --- /dev/null +++ b/cs-CZ/step_9.md @@ -0,0 +1,5 @@ +## Challenge: adjust the difficulty + +Is the game too hard or too easy for you? How many ways can you find to change the difficulty? + +Adjust the game until you are happy with its difficulty! \ No newline at end of file diff --git a/da-DK/images/banner.png b/da-DK/images/banner.png new file mode 100644 index 0000000..7a0da5b Binary files /dev/null and b/da-DK/images/banner.png differ diff --git a/da-DK/images/binary-showcase.png b/da-DK/images/binary-showcase.png new file mode 100644 index 0000000..499aa29 Binary files /dev/null and b/da-DK/images/binary-showcase.png differ diff --git a/da-DK/images/flappy-clones-test.png b/da-DK/images/flappy-clones-test.png new file mode 100644 index 0000000..f874059 Binary files /dev/null and b/da-DK/images/flappy-clones-test.png differ diff --git a/da-DK/images/flappy-falling.gif b/da-DK/images/flappy-falling.gif new file mode 100644 index 0000000..970d833 Binary files /dev/null and b/da-DK/images/flappy-falling.gif differ diff --git a/da-DK/images/flappy-flying.gif b/da-DK/images/flappy-flying.gif new file mode 100644 index 0000000..e259ff1 Binary files /dev/null and b/da-DK/images/flappy-flying.gif differ diff --git a/da-DK/images/flappy-height-test.png b/da-DK/images/flappy-height-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/da-DK/images/flappy-height-test.png differ diff --git a/da-DK/images/flappy-parrot-showcase.png b/da-DK/images/flappy-parrot-showcase.png new file mode 100644 index 0000000..493049b Binary files /dev/null and b/da-DK/images/flappy-parrot-showcase.png differ diff --git a/da-DK/images/flappy-pipes-duplicate1-annotated.png b/da-DK/images/flappy-pipes-duplicate1-annotated.png new file mode 100644 index 0000000..65e32c6 Binary files /dev/null and b/da-DK/images/flappy-pipes-duplicate1-annotated.png differ diff --git a/da-DK/images/flappy-pipes-duplicate1.png b/da-DK/images/flappy-pipes-duplicate1.png new file mode 100644 index 0000000..4239b67 Binary files /dev/null and b/da-DK/images/flappy-pipes-duplicate1.png differ diff --git a/da-DK/images/flappy-pipes-duplicate2.png b/da-DK/images/flappy-pipes-duplicate2.png new file mode 100644 index 0000000..ba1a69a Binary files /dev/null and b/da-DK/images/flappy-pipes-duplicate2.png differ diff --git a/da-DK/images/flappy-pipes-ends.png b/da-DK/images/flappy-pipes-ends.png new file mode 100644 index 0000000..ab59aaa Binary files /dev/null and b/da-DK/images/flappy-pipes-ends.png differ diff --git a/da-DK/images/flappy-pipes-fill-rectangle.png b/da-DK/images/flappy-pipes-fill-rectangle.png new file mode 100644 index 0000000..7360b87 Binary files /dev/null and b/da-DK/images/flappy-pipes-fill-rectangle.png differ diff --git a/da-DK/images/flappy-pipes-filled.png b/da-DK/images/flappy-pipes-filled.png new file mode 100644 index 0000000..7d2c0dd Binary files /dev/null and b/da-DK/images/flappy-pipes-filled.png differ diff --git a/da-DK/images/flappy-pipes-position.png b/da-DK/images/flappy-pipes-position.png new file mode 100644 index 0000000..ca2b810 Binary files /dev/null and b/da-DK/images/flappy-pipes-position.png differ diff --git a/da-DK/images/flappy-pipes-rectangle.png b/da-DK/images/flappy-pipes-rectangle.png new file mode 100644 index 0000000..6e3bf02 Binary files /dev/null and b/da-DK/images/flappy-pipes-rectangle.png differ diff --git a/da-DK/images/flappy-pipes-test.png b/da-DK/images/flappy-pipes-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/da-DK/images/flappy-pipes-test.png differ diff --git a/da-DK/images/flappy-setup.png b/da-DK/images/flappy-setup.png new file mode 100644 index 0000000..92f9eca Binary files /dev/null and b/da-DK/images/flappy-setup.png differ diff --git a/da-DK/images/flappy-sprite.png b/da-DK/images/flappy-sprite.png new file mode 100644 index 0000000..6a0c590 Binary files /dev/null and b/da-DK/images/flappy-sprite.png differ diff --git a/da-DK/images/flappy-stage.png b/da-DK/images/flappy-stage.png new file mode 100644 index 0000000..5efe03c Binary files /dev/null and b/da-DK/images/flappy-stage.png differ diff --git a/da-DK/images/flappy-starting-position.png b/da-DK/images/flappy-starting-position.png new file mode 100644 index 0000000..9089c9e Binary files /dev/null and b/da-DK/images/flappy-starting-position.png differ diff --git a/da-DK/images/flappy-wings.png b/da-DK/images/flappy-wings.png new file mode 100644 index 0000000..ef0aa8e Binary files /dev/null and b/da-DK/images/flappy-wings.png differ diff --git a/da-DK/images/pipes-sprite.png b/da-DK/images/pipes-sprite.png new file mode 100644 index 0000000..a9882ed Binary files /dev/null and b/da-DK/images/pipes-sprite.png differ diff --git a/da-DK/meta.yml b/da-DK/meta.yml new file mode 100644 index 0000000..c2fe5e6 --- /dev/null +++ b/da-DK/meta.yml @@ -0,0 +1,34 @@ +--- +title: Flappy parrot +hero_image: images/banner.png +description: Create a game in which you guide a parrot past moving obstacles +listed: true +copyedit: true +version: 4.1 +last_tested: 2018-10-90 +steps: + - + title: Introduction + - + title: Add the pipes + - + title: "Challenge: make better pipes" + challenge: true + - + title: Make the pipes move + - + title: Make Flappy fall + - + title: Make Flappy fly + - + title: Detect collisions + - + title: Add a score + - + title: 'Challenge: adjust the difficulty' + challenge: true + - + title: 'Challenge: add a high score' + challenge: true + - + title: What next? diff --git a/da-DK/scratch-translatable.txt b/da-DK/scratch-translatable.txt new file mode 100644 index 0000000..214e66c --- /dev/null +++ b/da-DK/scratch-translatable.txt @@ -0,0 +1,13 @@ +Pipes + +costume1 + +Flappy + +wings down + +wings up + +Game Over! + +score diff --git a/da-DK/solutions/FlappyParrot-Solution.sb3 b/da-DK/solutions/FlappyParrot-Solution.sb3 new file mode 100644 index 0000000..a0cd354 Binary files /dev/null and b/da-DK/solutions/FlappyParrot-Solution.sb3 differ diff --git a/da-DK/step_1.md b/da-DK/step_1.md new file mode 100644 index 0000000..f7519ae --- /dev/null +++ b/da-DK/step_1.md @@ -0,0 +1,69 @@ +\--- no-print \--- + +This is the **Scratch 3** version of the project. There is also a [Scratch 2 version of the project](https://projects.raspberrypi.org/en/projects/flappy-parrot-scratch2). + +\--- /no-print \--- + +## Introduction + +Create a game in which you have to guide a parrot past scrolling pipes to score points. + +### What you will make + +\--- no-print \--- + +Click the green flag to start the game. Press the space bar to make the parrot flap its wings, and try to get it to fly through the gaps in the pipes! You score one point for every pipe that you manage to get the parrot past. + +
+ + +
+ +\--- /no-print \--- + +\--- print-only \--- + +You will press the space bar to make the parrot flap its wings, and score one point for every pipe that you manage to get the parrot past. + +![flappy parrot game being played](images/flappy-parrot-showcase.png) + +\--- /print-only \--- + +## \--- collapse \--- + +## title: What you will need + +### Hardware + ++ A computer capable of running Scratch 3 + +### Software + ++ Scratch 3 (either [online](https://rpf.io/scratchon) or [offline](https://rpf.io/scratchoff)) + +\--- /collapse \--- + +## \--- collapse \--- + +## title: What you will learn + ++ How to create sprites using Vector mode ++ How to use sounds ++ How to detect collisions ++ How to control a sprite using the keyboard + +\--- /collapse \--- + +## \--- collapse \--- + +## title: Additional notes for educators + +\--- no-print \--- + +If you need to print this project, please use the [printer-friendly version](https://projects.raspberrypi.org/en/projects/flappy-parrot/print){:target="_blank"}. + +\--- /no-print \--- + +You can find the [completed project here](https://rpf.io/p/en/flappy-parrot-get). + +\--- /collapse \--- \ No newline at end of file diff --git a/da-DK/step_10.md b/da-DK/step_10.md new file mode 100644 index 0000000..a5808f3 --- /dev/null +++ b/da-DK/step_10.md @@ -0,0 +1,9 @@ +## Challenge: add a high score + +\--- challenge \--- + +Can you add a high score to the game so that, in addition to keeping track of score for the current round, it keeps track of the highest score you've ever reached? + +[[[generic-scratch3-high-score]]] + +\--- /challenge \--- \ No newline at end of file diff --git a/da-DK/step_11.md b/da-DK/step_11.md new file mode 100644 index 0000000..02ae229 --- /dev/null +++ b/da-DK/step_11.md @@ -0,0 +1,19 @@ +## What next? + +Try the [Binary hero](https://projects.raspberrypi.org/en/projects/binary-hero?utm_source=pathway&utm_medium=whatnext&utm_campaign=projects) project, where you will make a game in which you play the notes of a song as they scroll down the Stage. + +\--- no-print \--- + +Click the green flag to start the game. Use the z, x, c, and v keys to play the correct notes when these reach the bottom of the Stage. You'll score ten points for every correct note you play. + +
+ +
+ +\--- /no-print \--- + +\--- print-only \--- + +The notes will fall from above, and you will have to press keys to "catch" and play the notes. ![showcase](images/binary-showcase.png) + +\--- /print-only \--- \ No newline at end of file diff --git a/da-DK/step_2.md b/da-DK/step_2.md new file mode 100644 index 0000000..d8f2ce5 --- /dev/null +++ b/da-DK/step_2.md @@ -0,0 +1,84 @@ +## Add the pipes + +First, create the pipes. + +\--- task \--- + +Open a new empty Scratch project. + +[[[generic-scratch3-new-project]]] + +\--- /task \--- + +\--- task \--- + +Add a backdrop with an outdoor landscape. 'Blue Sky' is a good choice. + +![screenshot](images/flappy-stage.png) + +[[[generic-scratch3-backdrop-from-library]]] + +\--- /task \--- + +\--- task \--- + +Create a new sprite and name it 'Pipes'. + +[[[generic-scratch3-draw-sprite]]] + +\--- /task \--- + +The 'Pipes' sprite should be a pair of pipes with a gap in the middle. By moving the sprite up or down, you can put the gap in a different place. + +This picture shows an example of how the pipes could be positioned. The parts of the sprite outside the Stage are normally hidden, you only see then when you drag the sprite: + +![screenshot](images/flappy-pipes-position.png) + +You can't draw a sprite as big as the pipes need to be, but you can increase the size at which the sprite shows on the Stage. + +\--- task \--- + +![pipes sprite](images/pipes-sprite.png) + +Add code to make the sprite bigger. + +```blocks3 +when green flag clicked +set size to (200) % +``` + +This makes it's easier to see how big the pipes should be. + +\--- /task \--- + +\--- task \--- + +Draw a rectangle for the top pipe as shown here: + +![rectangle for the pipe](images/flappy-pipes-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Fill the pipe with a colour you like. + +![fill the rectangle](images/flappy-pipes-fill-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Create a duplicate of the pipe by selecting it and then clicking on **Copy** and **Paste**. + +![copy and paste pipe](images/flappy-pipes-duplicate1-annotated.png) + +\--- /task \--- + +\--- task \--- + +Drag the copy of the pipe to the bottom of the screen so that the copy is in line with the other pipe. There needs to be a gap between the two pipes. + +![screenshot](images/flappy-pipes-duplicate2.png) + +\--- /task \--- \ No newline at end of file diff --git a/da-DK/step_3.md b/da-DK/step_3.md new file mode 100644 index 0000000..17f05f7 --- /dev/null +++ b/da-DK/step_3.md @@ -0,0 +1,11 @@ +## Challenge: make better pipes + +Can you make your pipes look better? + ++ Shade your pipes with a left-to-right gradient. + +![screenshot](images/flappy-pipes-filled.png) + ++ Add extra rectangles to the ends of the pipes: + +![screenshot](images/flappy-pipes-ends.png) \ No newline at end of file diff --git a/da-DK/step_4.md b/da-DK/step_4.md new file mode 100644 index 0000000..2beedd9 --- /dev/null +++ b/da-DK/step_4.md @@ -0,0 +1,65 @@ +## Make the pipes move + +Next you're going to make the pipes move across the screen to create an obstacle course. + +![pipes moving across the screen](images/flappy-clones-test.png) + +\--- task \--- + +First make the pipes appear by adding code to the Pipes sprite so that, `when the green flag is clicked`{:class="block3events"}, the sprite `forever`{:class="block3control"} `creates a clone of itself`{:class="block3control"} every two seconds. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +**Tip:** clones are just copies of a sprite, and they are really useful for creating games. + +\--- /task \--- + +\--- task \--- + +Next make the pipes move by adding code so that, `when a clone starts`{:class="block3control"}, the clone appears on the right side of the Stage and `glides`{:class="block3motion"} across to the left. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show +go to x: (240) y: (0) +glide (4) secs to x: (-240) y: (0) +delete this clone +``` + +**Tip:** you can stop the pipes scrolling by clicking the red **stop** button next to the green flag. + +\--- /task \--- + +Now you should have lots of pipes, but their gaps are always in the same place. + +You can add some variety by using a `random`{:class="block3operators"} number for the Pipes sprite's `y position`{:class="block3motion"}. + +![pipes at different heights](images/flappy-height-test.png) + +\--- task \--- + +Modify your sprite's code so that each sprite clone `picks a random number from -80 to 80`{:class="block3operators"} and `glides`{:class="block3motion"} to that `y position`{:class="block3motion"}: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show ++ go to x: (240) y: (pick random (-80) to (80)) ++ glide (4) secs to x: (-240) y: (y position) +delete this clone +``` + +\--- /task \--- \ No newline at end of file diff --git a/da-DK/step_5.md b/da-DK/step_5.md new file mode 100644 index 0000000..f9d79ce --- /dev/null +++ b/da-DK/step_5.md @@ -0,0 +1,77 @@ +## Make Flappy fall + +Now add a sprite called Flappy and create code it so Flappy falls down the Stage. In the next step, you will add the code to make Flappy fly when you press a key. + +\--- no-print \--- + +![flappy falling animation](images/flappy-falling.gif) + +\--- /no-print \--- + +\--- task \--- + +Add a new sprite that has two costumes, for 'wings up' and 'wings down', and name it `Flappy`. + +The parrot sprite is a good choice. + +![parrot sprite](images/flappy-sprite.png) + +\--- /task \--- + +Flappy needs to be smaller. + +\--- task \--- + +Add code to `set Flappy's size to 25%`{:class="block3looks"} `when the green flag is clicked`{:class="block3events"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +``` + +\--- /task \--- + +When the game starts, Flappy needs to be just left of the centre of the Stage, at coordinates `-50, 0`. + +![flappy shown at the start position](images/flappy-starting-position.png) + +\--- task \--- + +Add code to make Flappy `go to the x and y`{:class="block3motion"} starting position of `x: -50`{:class="block3motion"} and `y: 0`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % ++ go to x: (-50) y: (0) +``` + +[[[generic-scratch3-set-coordinates]]] + +\--- /task \--- + +\--- task \--- + +Now make Flappy keep falling down the Stage by `forever`{:class="block3control"} `changing the sprite's y position by -3`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +go to x: (-50) y: (0) ++ forever + change y by (-3) +end +``` + +\--- /task \--- + +\--- task \--- + +Test your code to make sure Flappy starts in the middle of the screen and falls to the bottom. When you drag Flappy to the top of the Stage, the sprite should fall again. + +\--- /task \--- \ No newline at end of file diff --git a/da-DK/step_6.md b/da-DK/step_6.md new file mode 100644 index 0000000..1a98cb2 --- /dev/null +++ b/da-DK/step_6.md @@ -0,0 +1,106 @@ +## Make Flappy fly + +Now you will make Flappy flap upwards when you press the space bar. When you play the game, you have to time your taps to get Flappy through the gaps in the pipes. + +\--- no-print \--- + +![flappy flying upwards when space bar is pressed](images/flappy-flying.gif) + +\--- /no-print \--- + +Make Flappy fly upwards when you tap the space bar. + +\--- task \--- + +When the `space key is pressed`{:class="block3events"}, Flappy should move upwards by `changing its y coordinate`{:class="block3motion"} by a small amount, for example `6`. + +Flappy flies upwards by `repeating`{:class="block3control"} this movement `10 times`{:class="block3control"}. + +Add this code to your `Flappy` sprite: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +repeat (10) + change y by (6) +end +``` + +\--- /task \--- + +Now you need to get Flappy's wings flapping! + +\--- task \--- + +Click on the **Costumes** tab, and name Flappy's costumes 'wings up' and 'wings down'. + +![naming the costumes](images/flappy-wings.png) + +\--- /task \--- + +\--- task \--- + +Can you make Flappy's costume change to `wings down` when you press space, and then change it back to `wings up` halfway through the upward movement? + +\--- hints \--- + +\--- hint \--- + +You need to split the upward motion in half so that you can use two `repeat`{:class="block3control"} blocks to change Flappy's costume at the beginning and in the middle of the movement. + +Add `switch costume to`{:class="block3looks"} blocks to change how Flappy looks. + +\--- /hint \--- \--- hint \--- + +You need to use these blocks: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +repeat (5) + change y by (6) +end + +repeat (5) + change y by (6) +end + +switch costume to (wings up v) + +switch costume to (wings down v) + +when [space v] key pressed +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +switch costume to (wings down v) +repeat (5) + change y by (6) +end +switch costume to (wings up v) +repeat (5) + change y by (6) +end +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code. As you see, at the moment nothing happens if you let Flappy hit a pipe. + +\--- /task \--- \ No newline at end of file diff --git a/da-DK/step_7.md b/da-DK/step_7.md new file mode 100644 index 0000000..40a2720 --- /dev/null +++ b/da-DK/step_7.md @@ -0,0 +1,77 @@ +## Detect collisions + +To make the game a challenge, the player needs to guide Flappy through the gaps without letting the parrot touch the pipes or the edges of the Stage. You need to add some blocks to detect when Flappy hits something. + +This is called **collision detection**. + +\--- task \--- + +Import a sound from the library that you want to play when Flappy collides with something. The 'screech' sound is a good choice. + +[[[generic-scratch3-sound-from-library]]] + +\--- /task \--- + +A `wait until`{:class="block3control"} block is necessart to check whether Flappy is `touching the pipes`{:class="block3sensing"} `or`{:class="block3operators"} `touching the edge`{:class="block3sensing"}. + +\--- task \--- + +Add a new `when green flag clicked`{:class="block3control"} block to the 'Flappy' sprite, and also add the following code: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) +``` + +\--- /task \--- + +\--- task \--- + +Test your code. If Flappy touches a pipe, the 'screech' sound should play. + +\--- /task \--- + +Next, update the code so that the game stops when Flappy hits a pipe. + +\--- task \--- + +Add the following code to stop the game after a collision is detected: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) ++ say [Game Over!] ++ broadcast (Game Over v) ++ stop [other scripts in sprite v] +``` + +The `broadcast`{:class="block3events"} block tells other sprites that the game is over. + +The `stop`{:class="block3control"} block stops other Flappy scripts that are running so that Flappy stops falling after a collision. + +\--- /task \--- + +\--- task \--- + +Finally, add the following code to the `Pipes` sprite so that pipes `stop`{:class="block3control"} appearing `when the sprite receives Game Over`{:class="block3events"}. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I receive [Game Over v] +stop [other scripts in sprite v] +``` + +\--- /task \--- + +\--- task \--- + +Test your game and see how long you can play before it's 'Game over'! + +\--- /task \--- \ No newline at end of file diff --git a/da-DK/step_8.md b/da-DK/step_8.md new file mode 100644 index 0000000..2c5cc08 --- /dev/null +++ b/da-DK/step_8.md @@ -0,0 +1,116 @@ +## Add a score + +The player should score a point every time Flappy makes it through a gap between pipes. + +\--- task \--- + +Make a new variable **for all sprites** and call it `score`{:class="block3variables"}. + +[[[generic-scratch3-add-variable]]] + +\--- /task \--- + +Each 'Pipes' sprite clone should `wait until`{:class="block3control"} Flappy has flown past and then increase the `score`{:class="block3variables"}. + +\--- task \--- + +First, `set score to 0`{:class="block3variables"} when the game begins: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked ++ set [score v] to [0] +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +\--- /task \--- + +\--- task \--- + +Then add the following code to the `Pipes` sprite: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> +``` + +\--- /task \--- + +\--- task \--- + +Add more code so that, when Flappy's `x` position is greater than the pipe clone's `x` position, the `score`{:class="block3variables"} increases by `1` and a sound of your choice plays. + +You could use the 'pop' sound if you want, or add a sound from the library, for example 'bird'. + +\--- hints \--- + +\--- hint \--- + +You need to `wait until`{:class="block3control"} `Flappy's x position`{:class="block3sensing"} is `greater than (>)`{:class="block3operators"} the `x position`{:class="block3motion"} of `Pipes`. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone ++ wait until <> +``` + +Then `change score by 1`{:class="block3variables"} and `play a sound`{:class="block3sound"}. + +\--- /hint \--- + +\--- hint \--- + +Use these blocks in the correct order: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> + +play sound (pop v) + +change [score v] by (1) + +[x position v] of (Flappy v) + +x position + +() > () +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <([x position v] of (Flappy v)) > (x position)> +change [score v] by (1) +play sound (pop v) +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code and make sure you score a point every time Flappy gets through a gap between pipes. Check whether the `score`{:class="block3variables"} is set to `0` when you start a new game. + +\--- /task \--- \ No newline at end of file diff --git a/da-DK/step_9.md b/da-DK/step_9.md new file mode 100644 index 0000000..2f4e2e6 --- /dev/null +++ b/da-DK/step_9.md @@ -0,0 +1,5 @@ +## Challenge: adjust the difficulty + +Is the game too hard or too easy for you? How many ways can you find to change the difficulty? + +Adjust the game until you are happy with its difficulty! \ No newline at end of file diff --git a/de-DE/images/banner.png b/de-DE/images/banner.png new file mode 100644 index 0000000..7a0da5b Binary files /dev/null and b/de-DE/images/banner.png differ diff --git a/de-DE/images/binary-showcase.png b/de-DE/images/binary-showcase.png new file mode 100644 index 0000000..499aa29 Binary files /dev/null and b/de-DE/images/binary-showcase.png differ diff --git a/de-DE/images/flappy-clones-test.png b/de-DE/images/flappy-clones-test.png new file mode 100644 index 0000000..f874059 Binary files /dev/null and b/de-DE/images/flappy-clones-test.png differ diff --git a/de-DE/images/flappy-falling.gif b/de-DE/images/flappy-falling.gif new file mode 100644 index 0000000..970d833 Binary files /dev/null and b/de-DE/images/flappy-falling.gif differ diff --git a/de-DE/images/flappy-flying.gif b/de-DE/images/flappy-flying.gif new file mode 100644 index 0000000..e259ff1 Binary files /dev/null and b/de-DE/images/flappy-flying.gif differ diff --git a/de-DE/images/flappy-height-test.png b/de-DE/images/flappy-height-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/de-DE/images/flappy-height-test.png differ diff --git a/de-DE/images/flappy-parrot-showcase.png b/de-DE/images/flappy-parrot-showcase.png new file mode 100644 index 0000000..493049b Binary files /dev/null and b/de-DE/images/flappy-parrot-showcase.png differ diff --git a/de-DE/images/flappy-pipes-duplicate1-annotated.png b/de-DE/images/flappy-pipes-duplicate1-annotated.png new file mode 100644 index 0000000..65e32c6 Binary files /dev/null and b/de-DE/images/flappy-pipes-duplicate1-annotated.png differ diff --git a/de-DE/images/flappy-pipes-duplicate1.png b/de-DE/images/flappy-pipes-duplicate1.png new file mode 100644 index 0000000..4239b67 Binary files /dev/null and b/de-DE/images/flappy-pipes-duplicate1.png differ diff --git a/de-DE/images/flappy-pipes-duplicate2.png b/de-DE/images/flappy-pipes-duplicate2.png new file mode 100644 index 0000000..ba1a69a Binary files /dev/null and b/de-DE/images/flappy-pipes-duplicate2.png differ diff --git a/de-DE/images/flappy-pipes-ends.png b/de-DE/images/flappy-pipes-ends.png new file mode 100644 index 0000000..ab59aaa Binary files /dev/null and b/de-DE/images/flappy-pipes-ends.png differ diff --git a/de-DE/images/flappy-pipes-fill-rectangle.png b/de-DE/images/flappy-pipes-fill-rectangle.png new file mode 100644 index 0000000..7360b87 Binary files /dev/null and b/de-DE/images/flappy-pipes-fill-rectangle.png differ diff --git a/de-DE/images/flappy-pipes-filled.png b/de-DE/images/flappy-pipes-filled.png new file mode 100644 index 0000000..7d2c0dd Binary files /dev/null and b/de-DE/images/flappy-pipes-filled.png differ diff --git a/de-DE/images/flappy-pipes-position.png b/de-DE/images/flappy-pipes-position.png new file mode 100644 index 0000000..ca2b810 Binary files /dev/null and b/de-DE/images/flappy-pipes-position.png differ diff --git a/de-DE/images/flappy-pipes-rectangle.png b/de-DE/images/flappy-pipes-rectangle.png new file mode 100644 index 0000000..6e3bf02 Binary files /dev/null and b/de-DE/images/flappy-pipes-rectangle.png differ diff --git a/de-DE/images/flappy-pipes-test.png b/de-DE/images/flappy-pipes-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/de-DE/images/flappy-pipes-test.png differ diff --git a/de-DE/images/flappy-setup.png b/de-DE/images/flappy-setup.png new file mode 100644 index 0000000..92f9eca Binary files /dev/null and b/de-DE/images/flappy-setup.png differ diff --git a/de-DE/images/flappy-sprite.png b/de-DE/images/flappy-sprite.png new file mode 100644 index 0000000..6a0c590 Binary files /dev/null and b/de-DE/images/flappy-sprite.png differ diff --git a/de-DE/images/flappy-stage.png b/de-DE/images/flappy-stage.png new file mode 100644 index 0000000..5efe03c Binary files /dev/null and b/de-DE/images/flappy-stage.png differ diff --git a/de-DE/images/flappy-starting-position.png b/de-DE/images/flappy-starting-position.png new file mode 100644 index 0000000..9089c9e Binary files /dev/null and b/de-DE/images/flappy-starting-position.png differ diff --git a/de-DE/images/flappy-wings.png b/de-DE/images/flappy-wings.png new file mode 100644 index 0000000..ef0aa8e Binary files /dev/null and b/de-DE/images/flappy-wings.png differ diff --git a/de-DE/images/pipes-sprite.png b/de-DE/images/pipes-sprite.png new file mode 100644 index 0000000..a9882ed Binary files /dev/null and b/de-DE/images/pipes-sprite.png differ diff --git a/de-DE/meta.yml b/de-DE/meta.yml new file mode 100644 index 0000000..c2fe5e6 --- /dev/null +++ b/de-DE/meta.yml @@ -0,0 +1,34 @@ +--- +title: Flappy parrot +hero_image: images/banner.png +description: Create a game in which you guide a parrot past moving obstacles +listed: true +copyedit: true +version: 4.1 +last_tested: 2018-10-90 +steps: + - + title: Introduction + - + title: Add the pipes + - + title: "Challenge: make better pipes" + challenge: true + - + title: Make the pipes move + - + title: Make Flappy fall + - + title: Make Flappy fly + - + title: Detect collisions + - + title: Add a score + - + title: 'Challenge: adjust the difficulty' + challenge: true + - + title: 'Challenge: add a high score' + challenge: true + - + title: What next? diff --git a/de-DE/scratch-translatable.txt b/de-DE/scratch-translatable.txt new file mode 100644 index 0000000..214e66c --- /dev/null +++ b/de-DE/scratch-translatable.txt @@ -0,0 +1,13 @@ +Pipes + +costume1 + +Flappy + +wings down + +wings up + +Game Over! + +score diff --git a/de-DE/solutions/FlappyParrot-Solution.sb3 b/de-DE/solutions/FlappyParrot-Solution.sb3 new file mode 100644 index 0000000..a0cd354 Binary files /dev/null and b/de-DE/solutions/FlappyParrot-Solution.sb3 differ diff --git a/de-DE/step_1.md b/de-DE/step_1.md new file mode 100644 index 0000000..f7519ae --- /dev/null +++ b/de-DE/step_1.md @@ -0,0 +1,69 @@ +\--- no-print \--- + +This is the **Scratch 3** version of the project. There is also a [Scratch 2 version of the project](https://projects.raspberrypi.org/en/projects/flappy-parrot-scratch2). + +\--- /no-print \--- + +## Introduction + +Create a game in which you have to guide a parrot past scrolling pipes to score points. + +### What you will make + +\--- no-print \--- + +Click the green flag to start the game. Press the space bar to make the parrot flap its wings, and try to get it to fly through the gaps in the pipes! You score one point for every pipe that you manage to get the parrot past. + +
+ + +
+ +\--- /no-print \--- + +\--- print-only \--- + +You will press the space bar to make the parrot flap its wings, and score one point for every pipe that you manage to get the parrot past. + +![flappy parrot game being played](images/flappy-parrot-showcase.png) + +\--- /print-only \--- + +## \--- collapse \--- + +## title: What you will need + +### Hardware + ++ A computer capable of running Scratch 3 + +### Software + ++ Scratch 3 (either [online](https://rpf.io/scratchon) or [offline](https://rpf.io/scratchoff)) + +\--- /collapse \--- + +## \--- collapse \--- + +## title: What you will learn + ++ How to create sprites using Vector mode ++ How to use sounds ++ How to detect collisions ++ How to control a sprite using the keyboard + +\--- /collapse \--- + +## \--- collapse \--- + +## title: Additional notes for educators + +\--- no-print \--- + +If you need to print this project, please use the [printer-friendly version](https://projects.raspberrypi.org/en/projects/flappy-parrot/print){:target="_blank"}. + +\--- /no-print \--- + +You can find the [completed project here](https://rpf.io/p/en/flappy-parrot-get). + +\--- /collapse \--- \ No newline at end of file diff --git a/de-DE/step_10.md b/de-DE/step_10.md new file mode 100644 index 0000000..a5808f3 --- /dev/null +++ b/de-DE/step_10.md @@ -0,0 +1,9 @@ +## Challenge: add a high score + +\--- challenge \--- + +Can you add a high score to the game so that, in addition to keeping track of score for the current round, it keeps track of the highest score you've ever reached? + +[[[generic-scratch3-high-score]]] + +\--- /challenge \--- \ No newline at end of file diff --git a/de-DE/step_11.md b/de-DE/step_11.md new file mode 100644 index 0000000..02ae229 --- /dev/null +++ b/de-DE/step_11.md @@ -0,0 +1,19 @@ +## What next? + +Try the [Binary hero](https://projects.raspberrypi.org/en/projects/binary-hero?utm_source=pathway&utm_medium=whatnext&utm_campaign=projects) project, where you will make a game in which you play the notes of a song as they scroll down the Stage. + +\--- no-print \--- + +Click the green flag to start the game. Use the z, x, c, and v keys to play the correct notes when these reach the bottom of the Stage. You'll score ten points for every correct note you play. + +
+ +
+ +\--- /no-print \--- + +\--- print-only \--- + +The notes will fall from above, and you will have to press keys to "catch" and play the notes. ![showcase](images/binary-showcase.png) + +\--- /print-only \--- \ No newline at end of file diff --git a/de-DE/step_2.md b/de-DE/step_2.md new file mode 100644 index 0000000..d8f2ce5 --- /dev/null +++ b/de-DE/step_2.md @@ -0,0 +1,84 @@ +## Add the pipes + +First, create the pipes. + +\--- task \--- + +Open a new empty Scratch project. + +[[[generic-scratch3-new-project]]] + +\--- /task \--- + +\--- task \--- + +Add a backdrop with an outdoor landscape. 'Blue Sky' is a good choice. + +![screenshot](images/flappy-stage.png) + +[[[generic-scratch3-backdrop-from-library]]] + +\--- /task \--- + +\--- task \--- + +Create a new sprite and name it 'Pipes'. + +[[[generic-scratch3-draw-sprite]]] + +\--- /task \--- + +The 'Pipes' sprite should be a pair of pipes with a gap in the middle. By moving the sprite up or down, you can put the gap in a different place. + +This picture shows an example of how the pipes could be positioned. The parts of the sprite outside the Stage are normally hidden, you only see then when you drag the sprite: + +![screenshot](images/flappy-pipes-position.png) + +You can't draw a sprite as big as the pipes need to be, but you can increase the size at which the sprite shows on the Stage. + +\--- task \--- + +![pipes sprite](images/pipes-sprite.png) + +Add code to make the sprite bigger. + +```blocks3 +when green flag clicked +set size to (200) % +``` + +This makes it's easier to see how big the pipes should be. + +\--- /task \--- + +\--- task \--- + +Draw a rectangle for the top pipe as shown here: + +![rectangle for the pipe](images/flappy-pipes-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Fill the pipe with a colour you like. + +![fill the rectangle](images/flappy-pipes-fill-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Create a duplicate of the pipe by selecting it and then clicking on **Copy** and **Paste**. + +![copy and paste pipe](images/flappy-pipes-duplicate1-annotated.png) + +\--- /task \--- + +\--- task \--- + +Drag the copy of the pipe to the bottom of the screen so that the copy is in line with the other pipe. There needs to be a gap between the two pipes. + +![screenshot](images/flappy-pipes-duplicate2.png) + +\--- /task \--- \ No newline at end of file diff --git a/de-DE/step_3.md b/de-DE/step_3.md new file mode 100644 index 0000000..17f05f7 --- /dev/null +++ b/de-DE/step_3.md @@ -0,0 +1,11 @@ +## Challenge: make better pipes + +Can you make your pipes look better? + ++ Shade your pipes with a left-to-right gradient. + +![screenshot](images/flappy-pipes-filled.png) + ++ Add extra rectangles to the ends of the pipes: + +![screenshot](images/flappy-pipes-ends.png) \ No newline at end of file diff --git a/de-DE/step_4.md b/de-DE/step_4.md new file mode 100644 index 0000000..2beedd9 --- /dev/null +++ b/de-DE/step_4.md @@ -0,0 +1,65 @@ +## Make the pipes move + +Next you're going to make the pipes move across the screen to create an obstacle course. + +![pipes moving across the screen](images/flappy-clones-test.png) + +\--- task \--- + +First make the pipes appear by adding code to the Pipes sprite so that, `when the green flag is clicked`{:class="block3events"}, the sprite `forever`{:class="block3control"} `creates a clone of itself`{:class="block3control"} every two seconds. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +**Tip:** clones are just copies of a sprite, and they are really useful for creating games. + +\--- /task \--- + +\--- task \--- + +Next make the pipes move by adding code so that, `when a clone starts`{:class="block3control"}, the clone appears on the right side of the Stage and `glides`{:class="block3motion"} across to the left. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show +go to x: (240) y: (0) +glide (4) secs to x: (-240) y: (0) +delete this clone +``` + +**Tip:** you can stop the pipes scrolling by clicking the red **stop** button next to the green flag. + +\--- /task \--- + +Now you should have lots of pipes, but their gaps are always in the same place. + +You can add some variety by using a `random`{:class="block3operators"} number for the Pipes sprite's `y position`{:class="block3motion"}. + +![pipes at different heights](images/flappy-height-test.png) + +\--- task \--- + +Modify your sprite's code so that each sprite clone `picks a random number from -80 to 80`{:class="block3operators"} and `glides`{:class="block3motion"} to that `y position`{:class="block3motion"}: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show ++ go to x: (240) y: (pick random (-80) to (80)) ++ glide (4) secs to x: (-240) y: (y position) +delete this clone +``` + +\--- /task \--- \ No newline at end of file diff --git a/de-DE/step_5.md b/de-DE/step_5.md new file mode 100644 index 0000000..f9d79ce --- /dev/null +++ b/de-DE/step_5.md @@ -0,0 +1,77 @@ +## Make Flappy fall + +Now add a sprite called Flappy and create code it so Flappy falls down the Stage. In the next step, you will add the code to make Flappy fly when you press a key. + +\--- no-print \--- + +![flappy falling animation](images/flappy-falling.gif) + +\--- /no-print \--- + +\--- task \--- + +Add a new sprite that has two costumes, for 'wings up' and 'wings down', and name it `Flappy`. + +The parrot sprite is a good choice. + +![parrot sprite](images/flappy-sprite.png) + +\--- /task \--- + +Flappy needs to be smaller. + +\--- task \--- + +Add code to `set Flappy's size to 25%`{:class="block3looks"} `when the green flag is clicked`{:class="block3events"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +``` + +\--- /task \--- + +When the game starts, Flappy needs to be just left of the centre of the Stage, at coordinates `-50, 0`. + +![flappy shown at the start position](images/flappy-starting-position.png) + +\--- task \--- + +Add code to make Flappy `go to the x and y`{:class="block3motion"} starting position of `x: -50`{:class="block3motion"} and `y: 0`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % ++ go to x: (-50) y: (0) +``` + +[[[generic-scratch3-set-coordinates]]] + +\--- /task \--- + +\--- task \--- + +Now make Flappy keep falling down the Stage by `forever`{:class="block3control"} `changing the sprite's y position by -3`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +go to x: (-50) y: (0) ++ forever + change y by (-3) +end +``` + +\--- /task \--- + +\--- task \--- + +Test your code to make sure Flappy starts in the middle of the screen and falls to the bottom. When you drag Flappy to the top of the Stage, the sprite should fall again. + +\--- /task \--- \ No newline at end of file diff --git a/de-DE/step_6.md b/de-DE/step_6.md new file mode 100644 index 0000000..1a98cb2 --- /dev/null +++ b/de-DE/step_6.md @@ -0,0 +1,106 @@ +## Make Flappy fly + +Now you will make Flappy flap upwards when you press the space bar. When you play the game, you have to time your taps to get Flappy through the gaps in the pipes. + +\--- no-print \--- + +![flappy flying upwards when space bar is pressed](images/flappy-flying.gif) + +\--- /no-print \--- + +Make Flappy fly upwards when you tap the space bar. + +\--- task \--- + +When the `space key is pressed`{:class="block3events"}, Flappy should move upwards by `changing its y coordinate`{:class="block3motion"} by a small amount, for example `6`. + +Flappy flies upwards by `repeating`{:class="block3control"} this movement `10 times`{:class="block3control"}. + +Add this code to your `Flappy` sprite: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +repeat (10) + change y by (6) +end +``` + +\--- /task \--- + +Now you need to get Flappy's wings flapping! + +\--- task \--- + +Click on the **Costumes** tab, and name Flappy's costumes 'wings up' and 'wings down'. + +![naming the costumes](images/flappy-wings.png) + +\--- /task \--- + +\--- task \--- + +Can you make Flappy's costume change to `wings down` when you press space, and then change it back to `wings up` halfway through the upward movement? + +\--- hints \--- + +\--- hint \--- + +You need to split the upward motion in half so that you can use two `repeat`{:class="block3control"} blocks to change Flappy's costume at the beginning and in the middle of the movement. + +Add `switch costume to`{:class="block3looks"} blocks to change how Flappy looks. + +\--- /hint \--- \--- hint \--- + +You need to use these blocks: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +repeat (5) + change y by (6) +end + +repeat (5) + change y by (6) +end + +switch costume to (wings up v) + +switch costume to (wings down v) + +when [space v] key pressed +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +switch costume to (wings down v) +repeat (5) + change y by (6) +end +switch costume to (wings up v) +repeat (5) + change y by (6) +end +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code. As you see, at the moment nothing happens if you let Flappy hit a pipe. + +\--- /task \--- \ No newline at end of file diff --git a/de-DE/step_7.md b/de-DE/step_7.md new file mode 100644 index 0000000..40a2720 --- /dev/null +++ b/de-DE/step_7.md @@ -0,0 +1,77 @@ +## Detect collisions + +To make the game a challenge, the player needs to guide Flappy through the gaps without letting the parrot touch the pipes or the edges of the Stage. You need to add some blocks to detect when Flappy hits something. + +This is called **collision detection**. + +\--- task \--- + +Import a sound from the library that you want to play when Flappy collides with something. The 'screech' sound is a good choice. + +[[[generic-scratch3-sound-from-library]]] + +\--- /task \--- + +A `wait until`{:class="block3control"} block is necessart to check whether Flappy is `touching the pipes`{:class="block3sensing"} `or`{:class="block3operators"} `touching the edge`{:class="block3sensing"}. + +\--- task \--- + +Add a new `when green flag clicked`{:class="block3control"} block to the 'Flappy' sprite, and also add the following code: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) +``` + +\--- /task \--- + +\--- task \--- + +Test your code. If Flappy touches a pipe, the 'screech' sound should play. + +\--- /task \--- + +Next, update the code so that the game stops when Flappy hits a pipe. + +\--- task \--- + +Add the following code to stop the game after a collision is detected: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) ++ say [Game Over!] ++ broadcast (Game Over v) ++ stop [other scripts in sprite v] +``` + +The `broadcast`{:class="block3events"} block tells other sprites that the game is over. + +The `stop`{:class="block3control"} block stops other Flappy scripts that are running so that Flappy stops falling after a collision. + +\--- /task \--- + +\--- task \--- + +Finally, add the following code to the `Pipes` sprite so that pipes `stop`{:class="block3control"} appearing `when the sprite receives Game Over`{:class="block3events"}. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I receive [Game Over v] +stop [other scripts in sprite v] +``` + +\--- /task \--- + +\--- task \--- + +Test your game and see how long you can play before it's 'Game over'! + +\--- /task \--- \ No newline at end of file diff --git a/de-DE/step_8.md b/de-DE/step_8.md new file mode 100644 index 0000000..2c5cc08 --- /dev/null +++ b/de-DE/step_8.md @@ -0,0 +1,116 @@ +## Add a score + +The player should score a point every time Flappy makes it through a gap between pipes. + +\--- task \--- + +Make a new variable **for all sprites** and call it `score`{:class="block3variables"}. + +[[[generic-scratch3-add-variable]]] + +\--- /task \--- + +Each 'Pipes' sprite clone should `wait until`{:class="block3control"} Flappy has flown past and then increase the `score`{:class="block3variables"}. + +\--- task \--- + +First, `set score to 0`{:class="block3variables"} when the game begins: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked ++ set [score v] to [0] +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +\--- /task \--- + +\--- task \--- + +Then add the following code to the `Pipes` sprite: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> +``` + +\--- /task \--- + +\--- task \--- + +Add more code so that, when Flappy's `x` position is greater than the pipe clone's `x` position, the `score`{:class="block3variables"} increases by `1` and a sound of your choice plays. + +You could use the 'pop' sound if you want, or add a sound from the library, for example 'bird'. + +\--- hints \--- + +\--- hint \--- + +You need to `wait until`{:class="block3control"} `Flappy's x position`{:class="block3sensing"} is `greater than (>)`{:class="block3operators"} the `x position`{:class="block3motion"} of `Pipes`. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone ++ wait until <> +``` + +Then `change score by 1`{:class="block3variables"} and `play a sound`{:class="block3sound"}. + +\--- /hint \--- + +\--- hint \--- + +Use these blocks in the correct order: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> + +play sound (pop v) + +change [score v] by (1) + +[x position v] of (Flappy v) + +x position + +() > () +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <([x position v] of (Flappy v)) > (x position)> +change [score v] by (1) +play sound (pop v) +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code and make sure you score a point every time Flappy gets through a gap between pipes. Check whether the `score`{:class="block3variables"} is set to `0` when you start a new game. + +\--- /task \--- \ No newline at end of file diff --git a/de-DE/step_9.md b/de-DE/step_9.md new file mode 100644 index 0000000..2f4e2e6 --- /dev/null +++ b/de-DE/step_9.md @@ -0,0 +1,5 @@ +## Challenge: adjust the difficulty + +Is the game too hard or too easy for you? How many ways can you find to change the difficulty? + +Adjust the game until you are happy with its difficulty! \ No newline at end of file diff --git a/el-GR/images/banner.png b/el-GR/images/banner.png new file mode 100644 index 0000000..7a0da5b Binary files /dev/null and b/el-GR/images/banner.png differ diff --git a/el-GR/images/binary-showcase.png b/el-GR/images/binary-showcase.png new file mode 100644 index 0000000..499aa29 Binary files /dev/null and b/el-GR/images/binary-showcase.png differ diff --git a/el-GR/images/flappy-clones-test.png b/el-GR/images/flappy-clones-test.png new file mode 100644 index 0000000..f874059 Binary files /dev/null and b/el-GR/images/flappy-clones-test.png differ diff --git a/el-GR/images/flappy-falling.gif b/el-GR/images/flappy-falling.gif new file mode 100644 index 0000000..970d833 Binary files /dev/null and b/el-GR/images/flappy-falling.gif differ diff --git a/el-GR/images/flappy-flying.gif b/el-GR/images/flappy-flying.gif new file mode 100644 index 0000000..e259ff1 Binary files /dev/null and b/el-GR/images/flappy-flying.gif differ diff --git a/el-GR/images/flappy-height-test.png b/el-GR/images/flappy-height-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/el-GR/images/flappy-height-test.png differ diff --git a/el-GR/images/flappy-parrot-showcase.png b/el-GR/images/flappy-parrot-showcase.png new file mode 100644 index 0000000..493049b Binary files /dev/null and b/el-GR/images/flappy-parrot-showcase.png differ diff --git a/el-GR/images/flappy-pipes-duplicate1-annotated.png b/el-GR/images/flappy-pipes-duplicate1-annotated.png new file mode 100644 index 0000000..65e32c6 Binary files /dev/null and b/el-GR/images/flappy-pipes-duplicate1-annotated.png differ diff --git a/el-GR/images/flappy-pipes-duplicate1.png b/el-GR/images/flappy-pipes-duplicate1.png new file mode 100644 index 0000000..4239b67 Binary files /dev/null and b/el-GR/images/flappy-pipes-duplicate1.png differ diff --git a/el-GR/images/flappy-pipes-duplicate2.png b/el-GR/images/flappy-pipes-duplicate2.png new file mode 100644 index 0000000..ba1a69a Binary files /dev/null and b/el-GR/images/flappy-pipes-duplicate2.png differ diff --git a/el-GR/images/flappy-pipes-ends.png b/el-GR/images/flappy-pipes-ends.png new file mode 100644 index 0000000..ab59aaa Binary files /dev/null and b/el-GR/images/flappy-pipes-ends.png differ diff --git a/el-GR/images/flappy-pipes-fill-rectangle.png b/el-GR/images/flappy-pipes-fill-rectangle.png new file mode 100644 index 0000000..7360b87 Binary files /dev/null and b/el-GR/images/flappy-pipes-fill-rectangle.png differ diff --git a/el-GR/images/flappy-pipes-filled.png b/el-GR/images/flappy-pipes-filled.png new file mode 100644 index 0000000..7d2c0dd Binary files /dev/null and b/el-GR/images/flappy-pipes-filled.png differ diff --git a/el-GR/images/flappy-pipes-position.png b/el-GR/images/flappy-pipes-position.png new file mode 100644 index 0000000..ca2b810 Binary files /dev/null and b/el-GR/images/flappy-pipes-position.png differ diff --git a/el-GR/images/flappy-pipes-rectangle.png b/el-GR/images/flappy-pipes-rectangle.png new file mode 100644 index 0000000..6e3bf02 Binary files /dev/null and b/el-GR/images/flappy-pipes-rectangle.png differ diff --git a/el-GR/images/flappy-pipes-test.png b/el-GR/images/flappy-pipes-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/el-GR/images/flappy-pipes-test.png differ diff --git a/el-GR/images/flappy-setup.png b/el-GR/images/flappy-setup.png new file mode 100644 index 0000000..92f9eca Binary files /dev/null and b/el-GR/images/flappy-setup.png differ diff --git a/el-GR/images/flappy-sprite.png b/el-GR/images/flappy-sprite.png new file mode 100644 index 0000000..6a0c590 Binary files /dev/null and b/el-GR/images/flappy-sprite.png differ diff --git a/el-GR/images/flappy-stage.png b/el-GR/images/flappy-stage.png new file mode 100644 index 0000000..5efe03c Binary files /dev/null and b/el-GR/images/flappy-stage.png differ diff --git a/el-GR/images/flappy-starting-position.png b/el-GR/images/flappy-starting-position.png new file mode 100644 index 0000000..9089c9e Binary files /dev/null and b/el-GR/images/flappy-starting-position.png differ diff --git a/el-GR/images/flappy-wings.png b/el-GR/images/flappy-wings.png new file mode 100644 index 0000000..ef0aa8e Binary files /dev/null and b/el-GR/images/flappy-wings.png differ diff --git a/el-GR/images/pipes-sprite.png b/el-GR/images/pipes-sprite.png new file mode 100644 index 0000000..a9882ed Binary files /dev/null and b/el-GR/images/pipes-sprite.png differ diff --git a/el-GR/meta.yml b/el-GR/meta.yml new file mode 100644 index 0000000..c2fe5e6 --- /dev/null +++ b/el-GR/meta.yml @@ -0,0 +1,34 @@ +--- +title: Flappy parrot +hero_image: images/banner.png +description: Create a game in which you guide a parrot past moving obstacles +listed: true +copyedit: true +version: 4.1 +last_tested: 2018-10-90 +steps: + - + title: Introduction + - + title: Add the pipes + - + title: "Challenge: make better pipes" + challenge: true + - + title: Make the pipes move + - + title: Make Flappy fall + - + title: Make Flappy fly + - + title: Detect collisions + - + title: Add a score + - + title: 'Challenge: adjust the difficulty' + challenge: true + - + title: 'Challenge: add a high score' + challenge: true + - + title: What next? diff --git a/el-GR/scratch-translatable.txt b/el-GR/scratch-translatable.txt new file mode 100644 index 0000000..214e66c --- /dev/null +++ b/el-GR/scratch-translatable.txt @@ -0,0 +1,13 @@ +Pipes + +costume1 + +Flappy + +wings down + +wings up + +Game Over! + +score diff --git a/el-GR/solutions/FlappyParrot-Solution.sb3 b/el-GR/solutions/FlappyParrot-Solution.sb3 new file mode 100644 index 0000000..a0cd354 Binary files /dev/null and b/el-GR/solutions/FlappyParrot-Solution.sb3 differ diff --git a/el-GR/step_1.md b/el-GR/step_1.md new file mode 100644 index 0000000..f7519ae --- /dev/null +++ b/el-GR/step_1.md @@ -0,0 +1,69 @@ +\--- no-print \--- + +This is the **Scratch 3** version of the project. There is also a [Scratch 2 version of the project](https://projects.raspberrypi.org/en/projects/flappy-parrot-scratch2). + +\--- /no-print \--- + +## Introduction + +Create a game in which you have to guide a parrot past scrolling pipes to score points. + +### What you will make + +\--- no-print \--- + +Click the green flag to start the game. Press the space bar to make the parrot flap its wings, and try to get it to fly through the gaps in the pipes! You score one point for every pipe that you manage to get the parrot past. + +
+ + +
+ +\--- /no-print \--- + +\--- print-only \--- + +You will press the space bar to make the parrot flap its wings, and score one point for every pipe that you manage to get the parrot past. + +![flappy parrot game being played](images/flappy-parrot-showcase.png) + +\--- /print-only \--- + +## \--- collapse \--- + +## title: What you will need + +### Hardware + ++ A computer capable of running Scratch 3 + +### Software + ++ Scratch 3 (either [online](https://rpf.io/scratchon) or [offline](https://rpf.io/scratchoff)) + +\--- /collapse \--- + +## \--- collapse \--- + +## title: What you will learn + ++ How to create sprites using Vector mode ++ How to use sounds ++ How to detect collisions ++ How to control a sprite using the keyboard + +\--- /collapse \--- + +## \--- collapse \--- + +## title: Additional notes for educators + +\--- no-print \--- + +If you need to print this project, please use the [printer-friendly version](https://projects.raspberrypi.org/en/projects/flappy-parrot/print){:target="_blank"}. + +\--- /no-print \--- + +You can find the [completed project here](https://rpf.io/p/en/flappy-parrot-get). + +\--- /collapse \--- \ No newline at end of file diff --git a/el-GR/step_10.md b/el-GR/step_10.md new file mode 100644 index 0000000..a5808f3 --- /dev/null +++ b/el-GR/step_10.md @@ -0,0 +1,9 @@ +## Challenge: add a high score + +\--- challenge \--- + +Can you add a high score to the game so that, in addition to keeping track of score for the current round, it keeps track of the highest score you've ever reached? + +[[[generic-scratch3-high-score]]] + +\--- /challenge \--- \ No newline at end of file diff --git a/el-GR/step_11.md b/el-GR/step_11.md new file mode 100644 index 0000000..02ae229 --- /dev/null +++ b/el-GR/step_11.md @@ -0,0 +1,19 @@ +## What next? + +Try the [Binary hero](https://projects.raspberrypi.org/en/projects/binary-hero?utm_source=pathway&utm_medium=whatnext&utm_campaign=projects) project, where you will make a game in which you play the notes of a song as they scroll down the Stage. + +\--- no-print \--- + +Click the green flag to start the game. Use the z, x, c, and v keys to play the correct notes when these reach the bottom of the Stage. You'll score ten points for every correct note you play. + +
+ +
+ +\--- /no-print \--- + +\--- print-only \--- + +The notes will fall from above, and you will have to press keys to "catch" and play the notes. ![showcase](images/binary-showcase.png) + +\--- /print-only \--- \ No newline at end of file diff --git a/el-GR/step_2.md b/el-GR/step_2.md new file mode 100644 index 0000000..d8f2ce5 --- /dev/null +++ b/el-GR/step_2.md @@ -0,0 +1,84 @@ +## Add the pipes + +First, create the pipes. + +\--- task \--- + +Open a new empty Scratch project. + +[[[generic-scratch3-new-project]]] + +\--- /task \--- + +\--- task \--- + +Add a backdrop with an outdoor landscape. 'Blue Sky' is a good choice. + +![screenshot](images/flappy-stage.png) + +[[[generic-scratch3-backdrop-from-library]]] + +\--- /task \--- + +\--- task \--- + +Create a new sprite and name it 'Pipes'. + +[[[generic-scratch3-draw-sprite]]] + +\--- /task \--- + +The 'Pipes' sprite should be a pair of pipes with a gap in the middle. By moving the sprite up or down, you can put the gap in a different place. + +This picture shows an example of how the pipes could be positioned. The parts of the sprite outside the Stage are normally hidden, you only see then when you drag the sprite: + +![screenshot](images/flappy-pipes-position.png) + +You can't draw a sprite as big as the pipes need to be, but you can increase the size at which the sprite shows on the Stage. + +\--- task \--- + +![pipes sprite](images/pipes-sprite.png) + +Add code to make the sprite bigger. + +```blocks3 +when green flag clicked +set size to (200) % +``` + +This makes it's easier to see how big the pipes should be. + +\--- /task \--- + +\--- task \--- + +Draw a rectangle for the top pipe as shown here: + +![rectangle for the pipe](images/flappy-pipes-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Fill the pipe with a colour you like. + +![fill the rectangle](images/flappy-pipes-fill-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Create a duplicate of the pipe by selecting it and then clicking on **Copy** and **Paste**. + +![copy and paste pipe](images/flappy-pipes-duplicate1-annotated.png) + +\--- /task \--- + +\--- task \--- + +Drag the copy of the pipe to the bottom of the screen so that the copy is in line with the other pipe. There needs to be a gap between the two pipes. + +![screenshot](images/flappy-pipes-duplicate2.png) + +\--- /task \--- \ No newline at end of file diff --git a/el-GR/step_3.md b/el-GR/step_3.md new file mode 100644 index 0000000..17f05f7 --- /dev/null +++ b/el-GR/step_3.md @@ -0,0 +1,11 @@ +## Challenge: make better pipes + +Can you make your pipes look better? + ++ Shade your pipes with a left-to-right gradient. + +![screenshot](images/flappy-pipes-filled.png) + ++ Add extra rectangles to the ends of the pipes: + +![screenshot](images/flappy-pipes-ends.png) \ No newline at end of file diff --git a/el-GR/step_4.md b/el-GR/step_4.md new file mode 100644 index 0000000..2beedd9 --- /dev/null +++ b/el-GR/step_4.md @@ -0,0 +1,65 @@ +## Make the pipes move + +Next you're going to make the pipes move across the screen to create an obstacle course. + +![pipes moving across the screen](images/flappy-clones-test.png) + +\--- task \--- + +First make the pipes appear by adding code to the Pipes sprite so that, `when the green flag is clicked`{:class="block3events"}, the sprite `forever`{:class="block3control"} `creates a clone of itself`{:class="block3control"} every two seconds. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +**Tip:** clones are just copies of a sprite, and they are really useful for creating games. + +\--- /task \--- + +\--- task \--- + +Next make the pipes move by adding code so that, `when a clone starts`{:class="block3control"}, the clone appears on the right side of the Stage and `glides`{:class="block3motion"} across to the left. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show +go to x: (240) y: (0) +glide (4) secs to x: (-240) y: (0) +delete this clone +``` + +**Tip:** you can stop the pipes scrolling by clicking the red **stop** button next to the green flag. + +\--- /task \--- + +Now you should have lots of pipes, but their gaps are always in the same place. + +You can add some variety by using a `random`{:class="block3operators"} number for the Pipes sprite's `y position`{:class="block3motion"}. + +![pipes at different heights](images/flappy-height-test.png) + +\--- task \--- + +Modify your sprite's code so that each sprite clone `picks a random number from -80 to 80`{:class="block3operators"} and `glides`{:class="block3motion"} to that `y position`{:class="block3motion"}: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show ++ go to x: (240) y: (pick random (-80) to (80)) ++ glide (4) secs to x: (-240) y: (y position) +delete this clone +``` + +\--- /task \--- \ No newline at end of file diff --git a/el-GR/step_5.md b/el-GR/step_5.md new file mode 100644 index 0000000..f9d79ce --- /dev/null +++ b/el-GR/step_5.md @@ -0,0 +1,77 @@ +## Make Flappy fall + +Now add a sprite called Flappy and create code it so Flappy falls down the Stage. In the next step, you will add the code to make Flappy fly when you press a key. + +\--- no-print \--- + +![flappy falling animation](images/flappy-falling.gif) + +\--- /no-print \--- + +\--- task \--- + +Add a new sprite that has two costumes, for 'wings up' and 'wings down', and name it `Flappy`. + +The parrot sprite is a good choice. + +![parrot sprite](images/flappy-sprite.png) + +\--- /task \--- + +Flappy needs to be smaller. + +\--- task \--- + +Add code to `set Flappy's size to 25%`{:class="block3looks"} `when the green flag is clicked`{:class="block3events"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +``` + +\--- /task \--- + +When the game starts, Flappy needs to be just left of the centre of the Stage, at coordinates `-50, 0`. + +![flappy shown at the start position](images/flappy-starting-position.png) + +\--- task \--- + +Add code to make Flappy `go to the x and y`{:class="block3motion"} starting position of `x: -50`{:class="block3motion"} and `y: 0`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % ++ go to x: (-50) y: (0) +``` + +[[[generic-scratch3-set-coordinates]]] + +\--- /task \--- + +\--- task \--- + +Now make Flappy keep falling down the Stage by `forever`{:class="block3control"} `changing the sprite's y position by -3`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +go to x: (-50) y: (0) ++ forever + change y by (-3) +end +``` + +\--- /task \--- + +\--- task \--- + +Test your code to make sure Flappy starts in the middle of the screen and falls to the bottom. When you drag Flappy to the top of the Stage, the sprite should fall again. + +\--- /task \--- \ No newline at end of file diff --git a/el-GR/step_6.md b/el-GR/step_6.md new file mode 100644 index 0000000..1a98cb2 --- /dev/null +++ b/el-GR/step_6.md @@ -0,0 +1,106 @@ +## Make Flappy fly + +Now you will make Flappy flap upwards when you press the space bar. When you play the game, you have to time your taps to get Flappy through the gaps in the pipes. + +\--- no-print \--- + +![flappy flying upwards when space bar is pressed](images/flappy-flying.gif) + +\--- /no-print \--- + +Make Flappy fly upwards when you tap the space bar. + +\--- task \--- + +When the `space key is pressed`{:class="block3events"}, Flappy should move upwards by `changing its y coordinate`{:class="block3motion"} by a small amount, for example `6`. + +Flappy flies upwards by `repeating`{:class="block3control"} this movement `10 times`{:class="block3control"}. + +Add this code to your `Flappy` sprite: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +repeat (10) + change y by (6) +end +``` + +\--- /task \--- + +Now you need to get Flappy's wings flapping! + +\--- task \--- + +Click on the **Costumes** tab, and name Flappy's costumes 'wings up' and 'wings down'. + +![naming the costumes](images/flappy-wings.png) + +\--- /task \--- + +\--- task \--- + +Can you make Flappy's costume change to `wings down` when you press space, and then change it back to `wings up` halfway through the upward movement? + +\--- hints \--- + +\--- hint \--- + +You need to split the upward motion in half so that you can use two `repeat`{:class="block3control"} blocks to change Flappy's costume at the beginning and in the middle of the movement. + +Add `switch costume to`{:class="block3looks"} blocks to change how Flappy looks. + +\--- /hint \--- \--- hint \--- + +You need to use these blocks: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +repeat (5) + change y by (6) +end + +repeat (5) + change y by (6) +end + +switch costume to (wings up v) + +switch costume to (wings down v) + +when [space v] key pressed +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +switch costume to (wings down v) +repeat (5) + change y by (6) +end +switch costume to (wings up v) +repeat (5) + change y by (6) +end +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code. As you see, at the moment nothing happens if you let Flappy hit a pipe. + +\--- /task \--- \ No newline at end of file diff --git a/el-GR/step_7.md b/el-GR/step_7.md new file mode 100644 index 0000000..40a2720 --- /dev/null +++ b/el-GR/step_7.md @@ -0,0 +1,77 @@ +## Detect collisions + +To make the game a challenge, the player needs to guide Flappy through the gaps without letting the parrot touch the pipes or the edges of the Stage. You need to add some blocks to detect when Flappy hits something. + +This is called **collision detection**. + +\--- task \--- + +Import a sound from the library that you want to play when Flappy collides with something. The 'screech' sound is a good choice. + +[[[generic-scratch3-sound-from-library]]] + +\--- /task \--- + +A `wait until`{:class="block3control"} block is necessart to check whether Flappy is `touching the pipes`{:class="block3sensing"} `or`{:class="block3operators"} `touching the edge`{:class="block3sensing"}. + +\--- task \--- + +Add a new `when green flag clicked`{:class="block3control"} block to the 'Flappy' sprite, and also add the following code: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) +``` + +\--- /task \--- + +\--- task \--- + +Test your code. If Flappy touches a pipe, the 'screech' sound should play. + +\--- /task \--- + +Next, update the code so that the game stops when Flappy hits a pipe. + +\--- task \--- + +Add the following code to stop the game after a collision is detected: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) ++ say [Game Over!] ++ broadcast (Game Over v) ++ stop [other scripts in sprite v] +``` + +The `broadcast`{:class="block3events"} block tells other sprites that the game is over. + +The `stop`{:class="block3control"} block stops other Flappy scripts that are running so that Flappy stops falling after a collision. + +\--- /task \--- + +\--- task \--- + +Finally, add the following code to the `Pipes` sprite so that pipes `stop`{:class="block3control"} appearing `when the sprite receives Game Over`{:class="block3events"}. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I receive [Game Over v] +stop [other scripts in sprite v] +``` + +\--- /task \--- + +\--- task \--- + +Test your game and see how long you can play before it's 'Game over'! + +\--- /task \--- \ No newline at end of file diff --git a/el-GR/step_8.md b/el-GR/step_8.md new file mode 100644 index 0000000..2c5cc08 --- /dev/null +++ b/el-GR/step_8.md @@ -0,0 +1,116 @@ +## Add a score + +The player should score a point every time Flappy makes it through a gap between pipes. + +\--- task \--- + +Make a new variable **for all sprites** and call it `score`{:class="block3variables"}. + +[[[generic-scratch3-add-variable]]] + +\--- /task \--- + +Each 'Pipes' sprite clone should `wait until`{:class="block3control"} Flappy has flown past and then increase the `score`{:class="block3variables"}. + +\--- task \--- + +First, `set score to 0`{:class="block3variables"} when the game begins: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked ++ set [score v] to [0] +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +\--- /task \--- + +\--- task \--- + +Then add the following code to the `Pipes` sprite: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> +``` + +\--- /task \--- + +\--- task \--- + +Add more code so that, when Flappy's `x` position is greater than the pipe clone's `x` position, the `score`{:class="block3variables"} increases by `1` and a sound of your choice plays. + +You could use the 'pop' sound if you want, or add a sound from the library, for example 'bird'. + +\--- hints \--- + +\--- hint \--- + +You need to `wait until`{:class="block3control"} `Flappy's x position`{:class="block3sensing"} is `greater than (>)`{:class="block3operators"} the `x position`{:class="block3motion"} of `Pipes`. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone ++ wait until <> +``` + +Then `change score by 1`{:class="block3variables"} and `play a sound`{:class="block3sound"}. + +\--- /hint \--- + +\--- hint \--- + +Use these blocks in the correct order: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> + +play sound (pop v) + +change [score v] by (1) + +[x position v] of (Flappy v) + +x position + +() > () +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <([x position v] of (Flappy v)) > (x position)> +change [score v] by (1) +play sound (pop v) +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code and make sure you score a point every time Flappy gets through a gap between pipes. Check whether the `score`{:class="block3variables"} is set to `0` when you start a new game. + +\--- /task \--- \ No newline at end of file diff --git a/el-GR/step_9.md b/el-GR/step_9.md new file mode 100644 index 0000000..2f4e2e6 --- /dev/null +++ b/el-GR/step_9.md @@ -0,0 +1,5 @@ +## Challenge: adjust the difficulty + +Is the game too hard or too easy for you? How many ways can you find to change the difficulty? + +Adjust the game until you are happy with its difficulty! \ No newline at end of file diff --git a/en-US/images/banner.png b/en-US/images/banner.png new file mode 100644 index 0000000..7a0da5b Binary files /dev/null and b/en-US/images/banner.png differ diff --git a/en-US/images/binary-showcase.png b/en-US/images/binary-showcase.png new file mode 100644 index 0000000..499aa29 Binary files /dev/null and b/en-US/images/binary-showcase.png differ diff --git a/en-US/images/flappy-clones-test.png b/en-US/images/flappy-clones-test.png new file mode 100644 index 0000000..f874059 Binary files /dev/null and b/en-US/images/flappy-clones-test.png differ diff --git a/en-US/images/flappy-falling.gif b/en-US/images/flappy-falling.gif new file mode 100644 index 0000000..970d833 Binary files /dev/null and b/en-US/images/flappy-falling.gif differ diff --git a/en-US/images/flappy-flying.gif b/en-US/images/flappy-flying.gif new file mode 100644 index 0000000..e259ff1 Binary files /dev/null and b/en-US/images/flappy-flying.gif differ diff --git a/en-US/images/flappy-height-test.png b/en-US/images/flappy-height-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/en-US/images/flappy-height-test.png differ diff --git a/en-US/images/flappy-parrot-showcase.png b/en-US/images/flappy-parrot-showcase.png new file mode 100644 index 0000000..493049b Binary files /dev/null and b/en-US/images/flappy-parrot-showcase.png differ diff --git a/en-US/images/flappy-pipes-duplicate1-annotated.png b/en-US/images/flappy-pipes-duplicate1-annotated.png new file mode 100644 index 0000000..65e32c6 Binary files /dev/null and b/en-US/images/flappy-pipes-duplicate1-annotated.png differ diff --git a/en-US/images/flappy-pipes-duplicate1.png b/en-US/images/flappy-pipes-duplicate1.png new file mode 100644 index 0000000..4239b67 Binary files /dev/null and b/en-US/images/flappy-pipes-duplicate1.png differ diff --git a/en-US/images/flappy-pipes-duplicate2.png b/en-US/images/flappy-pipes-duplicate2.png new file mode 100644 index 0000000..ba1a69a Binary files /dev/null and b/en-US/images/flappy-pipes-duplicate2.png differ diff --git a/en-US/images/flappy-pipes-ends.png b/en-US/images/flappy-pipes-ends.png new file mode 100644 index 0000000..ab59aaa Binary files /dev/null and b/en-US/images/flappy-pipes-ends.png differ diff --git a/en-US/images/flappy-pipes-fill-rectangle.png b/en-US/images/flappy-pipes-fill-rectangle.png new file mode 100644 index 0000000..7360b87 Binary files /dev/null and b/en-US/images/flappy-pipes-fill-rectangle.png differ diff --git a/en-US/images/flappy-pipes-filled.png b/en-US/images/flappy-pipes-filled.png new file mode 100644 index 0000000..7d2c0dd Binary files /dev/null and b/en-US/images/flappy-pipes-filled.png differ diff --git a/en-US/images/flappy-pipes-position.png b/en-US/images/flappy-pipes-position.png new file mode 100644 index 0000000..ca2b810 Binary files /dev/null and b/en-US/images/flappy-pipes-position.png differ diff --git a/en-US/images/flappy-pipes-rectangle.png b/en-US/images/flappy-pipes-rectangle.png new file mode 100644 index 0000000..6e3bf02 Binary files /dev/null and b/en-US/images/flappy-pipes-rectangle.png differ diff --git a/en-US/images/flappy-pipes-test.png b/en-US/images/flappy-pipes-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/en-US/images/flappy-pipes-test.png differ diff --git a/en-US/images/flappy-setup.png b/en-US/images/flappy-setup.png new file mode 100644 index 0000000..92f9eca Binary files /dev/null and b/en-US/images/flappy-setup.png differ diff --git a/en-US/images/flappy-sprite.png b/en-US/images/flappy-sprite.png new file mode 100644 index 0000000..6a0c590 Binary files /dev/null and b/en-US/images/flappy-sprite.png differ diff --git a/en-US/images/flappy-stage.png b/en-US/images/flappy-stage.png new file mode 100644 index 0000000..5efe03c Binary files /dev/null and b/en-US/images/flappy-stage.png differ diff --git a/en-US/images/flappy-starting-position.png b/en-US/images/flappy-starting-position.png new file mode 100644 index 0000000..9089c9e Binary files /dev/null and b/en-US/images/flappy-starting-position.png differ diff --git a/en-US/images/flappy-wings.png b/en-US/images/flappy-wings.png new file mode 100644 index 0000000..ef0aa8e Binary files /dev/null and b/en-US/images/flappy-wings.png differ diff --git a/en-US/images/pipes-sprite.png b/en-US/images/pipes-sprite.png new file mode 100644 index 0000000..a9882ed Binary files /dev/null and b/en-US/images/pipes-sprite.png differ diff --git a/en-US/meta.yml b/en-US/meta.yml new file mode 100644 index 0000000..c2fe5e6 --- /dev/null +++ b/en-US/meta.yml @@ -0,0 +1,34 @@ +--- +title: Flappy parrot +hero_image: images/banner.png +description: Create a game in which you guide a parrot past moving obstacles +listed: true +copyedit: true +version: 4.1 +last_tested: 2018-10-90 +steps: + - + title: Introduction + - + title: Add the pipes + - + title: "Challenge: make better pipes" + challenge: true + - + title: Make the pipes move + - + title: Make Flappy fall + - + title: Make Flappy fly + - + title: Detect collisions + - + title: Add a score + - + title: 'Challenge: adjust the difficulty' + challenge: true + - + title: 'Challenge: add a high score' + challenge: true + - + title: What next? diff --git a/en-US/scratch-translatable.txt b/en-US/scratch-translatable.txt new file mode 100644 index 0000000..214e66c --- /dev/null +++ b/en-US/scratch-translatable.txt @@ -0,0 +1,13 @@ +Pipes + +costume1 + +Flappy + +wings down + +wings up + +Game Over! + +score diff --git a/en-US/solutions/FlappyParrot-Solution.sb3 b/en-US/solutions/FlappyParrot-Solution.sb3 new file mode 100644 index 0000000..a0cd354 Binary files /dev/null and b/en-US/solutions/FlappyParrot-Solution.sb3 differ diff --git a/en-US/step_1.md b/en-US/step_1.md new file mode 100644 index 0000000..f7519ae --- /dev/null +++ b/en-US/step_1.md @@ -0,0 +1,69 @@ +\--- no-print \--- + +This is the **Scratch 3** version of the project. There is also a [Scratch 2 version of the project](https://projects.raspberrypi.org/en/projects/flappy-parrot-scratch2). + +\--- /no-print \--- + +## Introduction + +Create a game in which you have to guide a parrot past scrolling pipes to score points. + +### What you will make + +\--- no-print \--- + +Click the green flag to start the game. Press the space bar to make the parrot flap its wings, and try to get it to fly through the gaps in the pipes! You score one point for every pipe that you manage to get the parrot past. + +
+ + +
+ +\--- /no-print \--- + +\--- print-only \--- + +You will press the space bar to make the parrot flap its wings, and score one point for every pipe that you manage to get the parrot past. + +![flappy parrot game being played](images/flappy-parrot-showcase.png) + +\--- /print-only \--- + +## \--- collapse \--- + +## title: What you will need + +### Hardware + ++ A computer capable of running Scratch 3 + +### Software + ++ Scratch 3 (either [online](https://rpf.io/scratchon) or [offline](https://rpf.io/scratchoff)) + +\--- /collapse \--- + +## \--- collapse \--- + +## title: What you will learn + ++ How to create sprites using Vector mode ++ How to use sounds ++ How to detect collisions ++ How to control a sprite using the keyboard + +\--- /collapse \--- + +## \--- collapse \--- + +## title: Additional notes for educators + +\--- no-print \--- + +If you need to print this project, please use the [printer-friendly version](https://projects.raspberrypi.org/en/projects/flappy-parrot/print){:target="_blank"}. + +\--- /no-print \--- + +You can find the [completed project here](https://rpf.io/p/en/flappy-parrot-get). + +\--- /collapse \--- \ No newline at end of file diff --git a/en-US/step_10.md b/en-US/step_10.md new file mode 100644 index 0000000..a5808f3 --- /dev/null +++ b/en-US/step_10.md @@ -0,0 +1,9 @@ +## Challenge: add a high score + +\--- challenge \--- + +Can you add a high score to the game so that, in addition to keeping track of score for the current round, it keeps track of the highest score you've ever reached? + +[[[generic-scratch3-high-score]]] + +\--- /challenge \--- \ No newline at end of file diff --git a/en-US/step_11.md b/en-US/step_11.md new file mode 100644 index 0000000..02ae229 --- /dev/null +++ b/en-US/step_11.md @@ -0,0 +1,19 @@ +## What next? + +Try the [Binary hero](https://projects.raspberrypi.org/en/projects/binary-hero?utm_source=pathway&utm_medium=whatnext&utm_campaign=projects) project, where you will make a game in which you play the notes of a song as they scroll down the Stage. + +\--- no-print \--- + +Click the green flag to start the game. Use the z, x, c, and v keys to play the correct notes when these reach the bottom of the Stage. You'll score ten points for every correct note you play. + +
+ +
+ +\--- /no-print \--- + +\--- print-only \--- + +The notes will fall from above, and you will have to press keys to "catch" and play the notes. ![showcase](images/binary-showcase.png) + +\--- /print-only \--- \ No newline at end of file diff --git a/en-US/step_2.md b/en-US/step_2.md new file mode 100644 index 0000000..d8f2ce5 --- /dev/null +++ b/en-US/step_2.md @@ -0,0 +1,84 @@ +## Add the pipes + +First, create the pipes. + +\--- task \--- + +Open a new empty Scratch project. + +[[[generic-scratch3-new-project]]] + +\--- /task \--- + +\--- task \--- + +Add a backdrop with an outdoor landscape. 'Blue Sky' is a good choice. + +![screenshot](images/flappy-stage.png) + +[[[generic-scratch3-backdrop-from-library]]] + +\--- /task \--- + +\--- task \--- + +Create a new sprite and name it 'Pipes'. + +[[[generic-scratch3-draw-sprite]]] + +\--- /task \--- + +The 'Pipes' sprite should be a pair of pipes with a gap in the middle. By moving the sprite up or down, you can put the gap in a different place. + +This picture shows an example of how the pipes could be positioned. The parts of the sprite outside the Stage are normally hidden, you only see then when you drag the sprite: + +![screenshot](images/flappy-pipes-position.png) + +You can't draw a sprite as big as the pipes need to be, but you can increase the size at which the sprite shows on the Stage. + +\--- task \--- + +![pipes sprite](images/pipes-sprite.png) + +Add code to make the sprite bigger. + +```blocks3 +when green flag clicked +set size to (200) % +``` + +This makes it's easier to see how big the pipes should be. + +\--- /task \--- + +\--- task \--- + +Draw a rectangle for the top pipe as shown here: + +![rectangle for the pipe](images/flappy-pipes-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Fill the pipe with a colour you like. + +![fill the rectangle](images/flappy-pipes-fill-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Create a duplicate of the pipe by selecting it and then clicking on **Copy** and **Paste**. + +![copy and paste pipe](images/flappy-pipes-duplicate1-annotated.png) + +\--- /task \--- + +\--- task \--- + +Drag the copy of the pipe to the bottom of the screen so that the copy is in line with the other pipe. There needs to be a gap between the two pipes. + +![screenshot](images/flappy-pipes-duplicate2.png) + +\--- /task \--- \ No newline at end of file diff --git a/en-US/step_3.md b/en-US/step_3.md new file mode 100644 index 0000000..17f05f7 --- /dev/null +++ b/en-US/step_3.md @@ -0,0 +1,11 @@ +## Challenge: make better pipes + +Can you make your pipes look better? + ++ Shade your pipes with a left-to-right gradient. + +![screenshot](images/flappy-pipes-filled.png) + ++ Add extra rectangles to the ends of the pipes: + +![screenshot](images/flappy-pipes-ends.png) \ No newline at end of file diff --git a/en-US/step_4.md b/en-US/step_4.md new file mode 100644 index 0000000..2beedd9 --- /dev/null +++ b/en-US/step_4.md @@ -0,0 +1,65 @@ +## Make the pipes move + +Next you're going to make the pipes move across the screen to create an obstacle course. + +![pipes moving across the screen](images/flappy-clones-test.png) + +\--- task \--- + +First make the pipes appear by adding code to the Pipes sprite so that, `when the green flag is clicked`{:class="block3events"}, the sprite `forever`{:class="block3control"} `creates a clone of itself`{:class="block3control"} every two seconds. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +**Tip:** clones are just copies of a sprite, and they are really useful for creating games. + +\--- /task \--- + +\--- task \--- + +Next make the pipes move by adding code so that, `when a clone starts`{:class="block3control"}, the clone appears on the right side of the Stage and `glides`{:class="block3motion"} across to the left. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show +go to x: (240) y: (0) +glide (4) secs to x: (-240) y: (0) +delete this clone +``` + +**Tip:** you can stop the pipes scrolling by clicking the red **stop** button next to the green flag. + +\--- /task \--- + +Now you should have lots of pipes, but their gaps are always in the same place. + +You can add some variety by using a `random`{:class="block3operators"} number for the Pipes sprite's `y position`{:class="block3motion"}. + +![pipes at different heights](images/flappy-height-test.png) + +\--- task \--- + +Modify your sprite's code so that each sprite clone `picks a random number from -80 to 80`{:class="block3operators"} and `glides`{:class="block3motion"} to that `y position`{:class="block3motion"}: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show ++ go to x: (240) y: (pick random (-80) to (80)) ++ glide (4) secs to x: (-240) y: (y position) +delete this clone +``` + +\--- /task \--- \ No newline at end of file diff --git a/en-US/step_5.md b/en-US/step_5.md new file mode 100644 index 0000000..f9d79ce --- /dev/null +++ b/en-US/step_5.md @@ -0,0 +1,77 @@ +## Make Flappy fall + +Now add a sprite called Flappy and create code it so Flappy falls down the Stage. In the next step, you will add the code to make Flappy fly when you press a key. + +\--- no-print \--- + +![flappy falling animation](images/flappy-falling.gif) + +\--- /no-print \--- + +\--- task \--- + +Add a new sprite that has two costumes, for 'wings up' and 'wings down', and name it `Flappy`. + +The parrot sprite is a good choice. + +![parrot sprite](images/flappy-sprite.png) + +\--- /task \--- + +Flappy needs to be smaller. + +\--- task \--- + +Add code to `set Flappy's size to 25%`{:class="block3looks"} `when the green flag is clicked`{:class="block3events"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +``` + +\--- /task \--- + +When the game starts, Flappy needs to be just left of the centre of the Stage, at coordinates `-50, 0`. + +![flappy shown at the start position](images/flappy-starting-position.png) + +\--- task \--- + +Add code to make Flappy `go to the x and y`{:class="block3motion"} starting position of `x: -50`{:class="block3motion"} and `y: 0`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % ++ go to x: (-50) y: (0) +``` + +[[[generic-scratch3-set-coordinates]]] + +\--- /task \--- + +\--- task \--- + +Now make Flappy keep falling down the Stage by `forever`{:class="block3control"} `changing the sprite's y position by -3`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +go to x: (-50) y: (0) ++ forever + change y by (-3) +end +``` + +\--- /task \--- + +\--- task \--- + +Test your code to make sure Flappy starts in the middle of the screen and falls to the bottom. When you drag Flappy to the top of the Stage, the sprite should fall again. + +\--- /task \--- \ No newline at end of file diff --git a/en-US/step_6.md b/en-US/step_6.md new file mode 100644 index 0000000..1a98cb2 --- /dev/null +++ b/en-US/step_6.md @@ -0,0 +1,106 @@ +## Make Flappy fly + +Now you will make Flappy flap upwards when you press the space bar. When you play the game, you have to time your taps to get Flappy through the gaps in the pipes. + +\--- no-print \--- + +![flappy flying upwards when space bar is pressed](images/flappy-flying.gif) + +\--- /no-print \--- + +Make Flappy fly upwards when you tap the space bar. + +\--- task \--- + +When the `space key is pressed`{:class="block3events"}, Flappy should move upwards by `changing its y coordinate`{:class="block3motion"} by a small amount, for example `6`. + +Flappy flies upwards by `repeating`{:class="block3control"} this movement `10 times`{:class="block3control"}. + +Add this code to your `Flappy` sprite: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +repeat (10) + change y by (6) +end +``` + +\--- /task \--- + +Now you need to get Flappy's wings flapping! + +\--- task \--- + +Click on the **Costumes** tab, and name Flappy's costumes 'wings up' and 'wings down'. + +![naming the costumes](images/flappy-wings.png) + +\--- /task \--- + +\--- task \--- + +Can you make Flappy's costume change to `wings down` when you press space, and then change it back to `wings up` halfway through the upward movement? + +\--- hints \--- + +\--- hint \--- + +You need to split the upward motion in half so that you can use two `repeat`{:class="block3control"} blocks to change Flappy's costume at the beginning and in the middle of the movement. + +Add `switch costume to`{:class="block3looks"} blocks to change how Flappy looks. + +\--- /hint \--- \--- hint \--- + +You need to use these blocks: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +repeat (5) + change y by (6) +end + +repeat (5) + change y by (6) +end + +switch costume to (wings up v) + +switch costume to (wings down v) + +when [space v] key pressed +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +switch costume to (wings down v) +repeat (5) + change y by (6) +end +switch costume to (wings up v) +repeat (5) + change y by (6) +end +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code. As you see, at the moment nothing happens if you let Flappy hit a pipe. + +\--- /task \--- \ No newline at end of file diff --git a/en-US/step_7.md b/en-US/step_7.md new file mode 100644 index 0000000..40a2720 --- /dev/null +++ b/en-US/step_7.md @@ -0,0 +1,77 @@ +## Detect collisions + +To make the game a challenge, the player needs to guide Flappy through the gaps without letting the parrot touch the pipes or the edges of the Stage. You need to add some blocks to detect when Flappy hits something. + +This is called **collision detection**. + +\--- task \--- + +Import a sound from the library that you want to play when Flappy collides with something. The 'screech' sound is a good choice. + +[[[generic-scratch3-sound-from-library]]] + +\--- /task \--- + +A `wait until`{:class="block3control"} block is necessart to check whether Flappy is `touching the pipes`{:class="block3sensing"} `or`{:class="block3operators"} `touching the edge`{:class="block3sensing"}. + +\--- task \--- + +Add a new `when green flag clicked`{:class="block3control"} block to the 'Flappy' sprite, and also add the following code: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) +``` + +\--- /task \--- + +\--- task \--- + +Test your code. If Flappy touches a pipe, the 'screech' sound should play. + +\--- /task \--- + +Next, update the code so that the game stops when Flappy hits a pipe. + +\--- task \--- + +Add the following code to stop the game after a collision is detected: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) ++ say [Game Over!] ++ broadcast (Game Over v) ++ stop [other scripts in sprite v] +``` + +The `broadcast`{:class="block3events"} block tells other sprites that the game is over. + +The `stop`{:class="block3control"} block stops other Flappy scripts that are running so that Flappy stops falling after a collision. + +\--- /task \--- + +\--- task \--- + +Finally, add the following code to the `Pipes` sprite so that pipes `stop`{:class="block3control"} appearing `when the sprite receives Game Over`{:class="block3events"}. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I receive [Game Over v] +stop [other scripts in sprite v] +``` + +\--- /task \--- + +\--- task \--- + +Test your game and see how long you can play before it's 'Game over'! + +\--- /task \--- \ No newline at end of file diff --git a/en-US/step_8.md b/en-US/step_8.md new file mode 100644 index 0000000..2c5cc08 --- /dev/null +++ b/en-US/step_8.md @@ -0,0 +1,116 @@ +## Add a score + +The player should score a point every time Flappy makes it through a gap between pipes. + +\--- task \--- + +Make a new variable **for all sprites** and call it `score`{:class="block3variables"}. + +[[[generic-scratch3-add-variable]]] + +\--- /task \--- + +Each 'Pipes' sprite clone should `wait until`{:class="block3control"} Flappy has flown past and then increase the `score`{:class="block3variables"}. + +\--- task \--- + +First, `set score to 0`{:class="block3variables"} when the game begins: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked ++ set [score v] to [0] +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +\--- /task \--- + +\--- task \--- + +Then add the following code to the `Pipes` sprite: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> +``` + +\--- /task \--- + +\--- task \--- + +Add more code so that, when Flappy's `x` position is greater than the pipe clone's `x` position, the `score`{:class="block3variables"} increases by `1` and a sound of your choice plays. + +You could use the 'pop' sound if you want, or add a sound from the library, for example 'bird'. + +\--- hints \--- + +\--- hint \--- + +You need to `wait until`{:class="block3control"} `Flappy's x position`{:class="block3sensing"} is `greater than (>)`{:class="block3operators"} the `x position`{:class="block3motion"} of `Pipes`. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone ++ wait until <> +``` + +Then `change score by 1`{:class="block3variables"} and `play a sound`{:class="block3sound"}. + +\--- /hint \--- + +\--- hint \--- + +Use these blocks in the correct order: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> + +play sound (pop v) + +change [score v] by (1) + +[x position v] of (Flappy v) + +x position + +() > () +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <([x position v] of (Flappy v)) > (x position)> +change [score v] by (1) +play sound (pop v) +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code and make sure you score a point every time Flappy gets through a gap between pipes. Check whether the `score`{:class="block3variables"} is set to `0` when you start a new game. + +\--- /task \--- \ No newline at end of file diff --git a/en-US/step_9.md b/en-US/step_9.md new file mode 100644 index 0000000..2f4e2e6 --- /dev/null +++ b/en-US/step_9.md @@ -0,0 +1,5 @@ +## Challenge: adjust the difficulty + +Is the game too hard or too easy for you? How many ways can you find to change the difficulty? + +Adjust the game until you are happy with its difficulty! \ No newline at end of file diff --git a/es-ES/images/banner.png b/es-ES/images/banner.png new file mode 100644 index 0000000..7a0da5b Binary files /dev/null and b/es-ES/images/banner.png differ diff --git a/es-ES/images/binary-showcase.png b/es-ES/images/binary-showcase.png new file mode 100644 index 0000000..499aa29 Binary files /dev/null and b/es-ES/images/binary-showcase.png differ diff --git a/es-ES/images/flappy-clones-test.png b/es-ES/images/flappy-clones-test.png new file mode 100644 index 0000000..f874059 Binary files /dev/null and b/es-ES/images/flappy-clones-test.png differ diff --git a/es-ES/images/flappy-falling.gif b/es-ES/images/flappy-falling.gif new file mode 100644 index 0000000..970d833 Binary files /dev/null and b/es-ES/images/flappy-falling.gif differ diff --git a/es-ES/images/flappy-flying.gif b/es-ES/images/flappy-flying.gif new file mode 100644 index 0000000..e259ff1 Binary files /dev/null and b/es-ES/images/flappy-flying.gif differ diff --git a/es-ES/images/flappy-height-test.png b/es-ES/images/flappy-height-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/es-ES/images/flappy-height-test.png differ diff --git a/es-ES/images/flappy-parrot-showcase.png b/es-ES/images/flappy-parrot-showcase.png new file mode 100644 index 0000000..493049b Binary files /dev/null and b/es-ES/images/flappy-parrot-showcase.png differ diff --git a/es-ES/images/flappy-pipes-duplicate1-annotated.png b/es-ES/images/flappy-pipes-duplicate1-annotated.png new file mode 100644 index 0000000..65e32c6 Binary files /dev/null and b/es-ES/images/flappy-pipes-duplicate1-annotated.png differ diff --git a/es-ES/images/flappy-pipes-duplicate1.png b/es-ES/images/flappy-pipes-duplicate1.png new file mode 100644 index 0000000..4239b67 Binary files /dev/null and b/es-ES/images/flappy-pipes-duplicate1.png differ diff --git a/es-ES/images/flappy-pipes-duplicate2.png b/es-ES/images/flappy-pipes-duplicate2.png new file mode 100644 index 0000000..ba1a69a Binary files /dev/null and b/es-ES/images/flappy-pipes-duplicate2.png differ diff --git a/es-ES/images/flappy-pipes-ends.png b/es-ES/images/flappy-pipes-ends.png new file mode 100644 index 0000000..ab59aaa Binary files /dev/null and b/es-ES/images/flappy-pipes-ends.png differ diff --git a/es-ES/images/flappy-pipes-fill-rectangle.png b/es-ES/images/flappy-pipes-fill-rectangle.png new file mode 100644 index 0000000..7360b87 Binary files /dev/null and b/es-ES/images/flappy-pipes-fill-rectangle.png differ diff --git a/es-ES/images/flappy-pipes-filled.png b/es-ES/images/flappy-pipes-filled.png new file mode 100644 index 0000000..7d2c0dd Binary files /dev/null and b/es-ES/images/flappy-pipes-filled.png differ diff --git a/es-ES/images/flappy-pipes-position.png b/es-ES/images/flappy-pipes-position.png new file mode 100644 index 0000000..ca2b810 Binary files /dev/null and b/es-ES/images/flappy-pipes-position.png differ diff --git a/es-ES/images/flappy-pipes-rectangle.png b/es-ES/images/flappy-pipes-rectangle.png new file mode 100644 index 0000000..6e3bf02 Binary files /dev/null and b/es-ES/images/flappy-pipes-rectangle.png differ diff --git a/es-ES/images/flappy-pipes-test.png b/es-ES/images/flappy-pipes-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/es-ES/images/flappy-pipes-test.png differ diff --git a/es-ES/images/flappy-setup.png b/es-ES/images/flappy-setup.png new file mode 100644 index 0000000..92f9eca Binary files /dev/null and b/es-ES/images/flappy-setup.png differ diff --git a/es-ES/images/flappy-sprite.png b/es-ES/images/flappy-sprite.png new file mode 100644 index 0000000..6a0c590 Binary files /dev/null and b/es-ES/images/flappy-sprite.png differ diff --git a/es-ES/images/flappy-stage.png b/es-ES/images/flappy-stage.png new file mode 100644 index 0000000..5efe03c Binary files /dev/null and b/es-ES/images/flappy-stage.png differ diff --git a/es-ES/images/flappy-starting-position.png b/es-ES/images/flappy-starting-position.png new file mode 100644 index 0000000..9089c9e Binary files /dev/null and b/es-ES/images/flappy-starting-position.png differ diff --git a/es-ES/images/flappy-wings.png b/es-ES/images/flappy-wings.png new file mode 100644 index 0000000..ef0aa8e Binary files /dev/null and b/es-ES/images/flappy-wings.png differ diff --git a/es-ES/images/pipes-sprite.png b/es-ES/images/pipes-sprite.png new file mode 100644 index 0000000..a9882ed Binary files /dev/null and b/es-ES/images/pipes-sprite.png differ diff --git a/es-ES/meta.yml b/es-ES/meta.yml new file mode 100644 index 0000000..c2fe5e6 --- /dev/null +++ b/es-ES/meta.yml @@ -0,0 +1,34 @@ +--- +title: Flappy parrot +hero_image: images/banner.png +description: Create a game in which you guide a parrot past moving obstacles +listed: true +copyedit: true +version: 4.1 +last_tested: 2018-10-90 +steps: + - + title: Introduction + - + title: Add the pipes + - + title: "Challenge: make better pipes" + challenge: true + - + title: Make the pipes move + - + title: Make Flappy fall + - + title: Make Flappy fly + - + title: Detect collisions + - + title: Add a score + - + title: 'Challenge: adjust the difficulty' + challenge: true + - + title: 'Challenge: add a high score' + challenge: true + - + title: What next? diff --git a/es-ES/scratch-translatable.txt b/es-ES/scratch-translatable.txt new file mode 100644 index 0000000..214e66c --- /dev/null +++ b/es-ES/scratch-translatable.txt @@ -0,0 +1,13 @@ +Pipes + +costume1 + +Flappy + +wings down + +wings up + +Game Over! + +score diff --git a/es-ES/solutions/FlappyParrot-Solution.sb3 b/es-ES/solutions/FlappyParrot-Solution.sb3 new file mode 100644 index 0000000..a0cd354 Binary files /dev/null and b/es-ES/solutions/FlappyParrot-Solution.sb3 differ diff --git a/es-ES/step_1.md b/es-ES/step_1.md new file mode 100644 index 0000000..f7519ae --- /dev/null +++ b/es-ES/step_1.md @@ -0,0 +1,69 @@ +\--- no-print \--- + +This is the **Scratch 3** version of the project. There is also a [Scratch 2 version of the project](https://projects.raspberrypi.org/en/projects/flappy-parrot-scratch2). + +\--- /no-print \--- + +## Introduction + +Create a game in which you have to guide a parrot past scrolling pipes to score points. + +### What you will make + +\--- no-print \--- + +Click the green flag to start the game. Press the space bar to make the parrot flap its wings, and try to get it to fly through the gaps in the pipes! You score one point for every pipe that you manage to get the parrot past. + +
+ + +
+ +\--- /no-print \--- + +\--- print-only \--- + +You will press the space bar to make the parrot flap its wings, and score one point for every pipe that you manage to get the parrot past. + +![flappy parrot game being played](images/flappy-parrot-showcase.png) + +\--- /print-only \--- + +## \--- collapse \--- + +## title: What you will need + +### Hardware + ++ A computer capable of running Scratch 3 + +### Software + ++ Scratch 3 (either [online](https://rpf.io/scratchon) or [offline](https://rpf.io/scratchoff)) + +\--- /collapse \--- + +## \--- collapse \--- + +## title: What you will learn + ++ How to create sprites using Vector mode ++ How to use sounds ++ How to detect collisions ++ How to control a sprite using the keyboard + +\--- /collapse \--- + +## \--- collapse \--- + +## title: Additional notes for educators + +\--- no-print \--- + +If you need to print this project, please use the [printer-friendly version](https://projects.raspberrypi.org/en/projects/flappy-parrot/print){:target="_blank"}. + +\--- /no-print \--- + +You can find the [completed project here](https://rpf.io/p/en/flappy-parrot-get). + +\--- /collapse \--- \ No newline at end of file diff --git a/es-ES/step_10.md b/es-ES/step_10.md new file mode 100644 index 0000000..a5808f3 --- /dev/null +++ b/es-ES/step_10.md @@ -0,0 +1,9 @@ +## Challenge: add a high score + +\--- challenge \--- + +Can you add a high score to the game so that, in addition to keeping track of score for the current round, it keeps track of the highest score you've ever reached? + +[[[generic-scratch3-high-score]]] + +\--- /challenge \--- \ No newline at end of file diff --git a/es-ES/step_11.md b/es-ES/step_11.md new file mode 100644 index 0000000..02ae229 --- /dev/null +++ b/es-ES/step_11.md @@ -0,0 +1,19 @@ +## What next? + +Try the [Binary hero](https://projects.raspberrypi.org/en/projects/binary-hero?utm_source=pathway&utm_medium=whatnext&utm_campaign=projects) project, where you will make a game in which you play the notes of a song as they scroll down the Stage. + +\--- no-print \--- + +Click the green flag to start the game. Use the z, x, c, and v keys to play the correct notes when these reach the bottom of the Stage. You'll score ten points for every correct note you play. + +
+ +
+ +\--- /no-print \--- + +\--- print-only \--- + +The notes will fall from above, and you will have to press keys to "catch" and play the notes. ![showcase](images/binary-showcase.png) + +\--- /print-only \--- \ No newline at end of file diff --git a/es-ES/step_2.md b/es-ES/step_2.md new file mode 100644 index 0000000..d8f2ce5 --- /dev/null +++ b/es-ES/step_2.md @@ -0,0 +1,84 @@ +## Add the pipes + +First, create the pipes. + +\--- task \--- + +Open a new empty Scratch project. + +[[[generic-scratch3-new-project]]] + +\--- /task \--- + +\--- task \--- + +Add a backdrop with an outdoor landscape. 'Blue Sky' is a good choice. + +![screenshot](images/flappy-stage.png) + +[[[generic-scratch3-backdrop-from-library]]] + +\--- /task \--- + +\--- task \--- + +Create a new sprite and name it 'Pipes'. + +[[[generic-scratch3-draw-sprite]]] + +\--- /task \--- + +The 'Pipes' sprite should be a pair of pipes with a gap in the middle. By moving the sprite up or down, you can put the gap in a different place. + +This picture shows an example of how the pipes could be positioned. The parts of the sprite outside the Stage are normally hidden, you only see then when you drag the sprite: + +![screenshot](images/flappy-pipes-position.png) + +You can't draw a sprite as big as the pipes need to be, but you can increase the size at which the sprite shows on the Stage. + +\--- task \--- + +![pipes sprite](images/pipes-sprite.png) + +Add code to make the sprite bigger. + +```blocks3 +when green flag clicked +set size to (200) % +``` + +This makes it's easier to see how big the pipes should be. + +\--- /task \--- + +\--- task \--- + +Draw a rectangle for the top pipe as shown here: + +![rectangle for the pipe](images/flappy-pipes-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Fill the pipe with a colour you like. + +![fill the rectangle](images/flappy-pipes-fill-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Create a duplicate of the pipe by selecting it and then clicking on **Copy** and **Paste**. + +![copy and paste pipe](images/flappy-pipes-duplicate1-annotated.png) + +\--- /task \--- + +\--- task \--- + +Drag the copy of the pipe to the bottom of the screen so that the copy is in line with the other pipe. There needs to be a gap between the two pipes. + +![screenshot](images/flappy-pipes-duplicate2.png) + +\--- /task \--- \ No newline at end of file diff --git a/es-ES/step_3.md b/es-ES/step_3.md new file mode 100644 index 0000000..17f05f7 --- /dev/null +++ b/es-ES/step_3.md @@ -0,0 +1,11 @@ +## Challenge: make better pipes + +Can you make your pipes look better? + ++ Shade your pipes with a left-to-right gradient. + +![screenshot](images/flappy-pipes-filled.png) + ++ Add extra rectangles to the ends of the pipes: + +![screenshot](images/flappy-pipes-ends.png) \ No newline at end of file diff --git a/es-ES/step_4.md b/es-ES/step_4.md new file mode 100644 index 0000000..2beedd9 --- /dev/null +++ b/es-ES/step_4.md @@ -0,0 +1,65 @@ +## Make the pipes move + +Next you're going to make the pipes move across the screen to create an obstacle course. + +![pipes moving across the screen](images/flappy-clones-test.png) + +\--- task \--- + +First make the pipes appear by adding code to the Pipes sprite so that, `when the green flag is clicked`{:class="block3events"}, the sprite `forever`{:class="block3control"} `creates a clone of itself`{:class="block3control"} every two seconds. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +**Tip:** clones are just copies of a sprite, and they are really useful for creating games. + +\--- /task \--- + +\--- task \--- + +Next make the pipes move by adding code so that, `when a clone starts`{:class="block3control"}, the clone appears on the right side of the Stage and `glides`{:class="block3motion"} across to the left. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show +go to x: (240) y: (0) +glide (4) secs to x: (-240) y: (0) +delete this clone +``` + +**Tip:** you can stop the pipes scrolling by clicking the red **stop** button next to the green flag. + +\--- /task \--- + +Now you should have lots of pipes, but their gaps are always in the same place. + +You can add some variety by using a `random`{:class="block3operators"} number for the Pipes sprite's `y position`{:class="block3motion"}. + +![pipes at different heights](images/flappy-height-test.png) + +\--- task \--- + +Modify your sprite's code so that each sprite clone `picks a random number from -80 to 80`{:class="block3operators"} and `glides`{:class="block3motion"} to that `y position`{:class="block3motion"}: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show ++ go to x: (240) y: (pick random (-80) to (80)) ++ glide (4) secs to x: (-240) y: (y position) +delete this clone +``` + +\--- /task \--- \ No newline at end of file diff --git a/es-ES/step_5.md b/es-ES/step_5.md new file mode 100644 index 0000000..f9d79ce --- /dev/null +++ b/es-ES/step_5.md @@ -0,0 +1,77 @@ +## Make Flappy fall + +Now add a sprite called Flappy and create code it so Flappy falls down the Stage. In the next step, you will add the code to make Flappy fly when you press a key. + +\--- no-print \--- + +![flappy falling animation](images/flappy-falling.gif) + +\--- /no-print \--- + +\--- task \--- + +Add a new sprite that has two costumes, for 'wings up' and 'wings down', and name it `Flappy`. + +The parrot sprite is a good choice. + +![parrot sprite](images/flappy-sprite.png) + +\--- /task \--- + +Flappy needs to be smaller. + +\--- task \--- + +Add code to `set Flappy's size to 25%`{:class="block3looks"} `when the green flag is clicked`{:class="block3events"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +``` + +\--- /task \--- + +When the game starts, Flappy needs to be just left of the centre of the Stage, at coordinates `-50, 0`. + +![flappy shown at the start position](images/flappy-starting-position.png) + +\--- task \--- + +Add code to make Flappy `go to the x and y`{:class="block3motion"} starting position of `x: -50`{:class="block3motion"} and `y: 0`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % ++ go to x: (-50) y: (0) +``` + +[[[generic-scratch3-set-coordinates]]] + +\--- /task \--- + +\--- task \--- + +Now make Flappy keep falling down the Stage by `forever`{:class="block3control"} `changing the sprite's y position by -3`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +go to x: (-50) y: (0) ++ forever + change y by (-3) +end +``` + +\--- /task \--- + +\--- task \--- + +Test your code to make sure Flappy starts in the middle of the screen and falls to the bottom. When you drag Flappy to the top of the Stage, the sprite should fall again. + +\--- /task \--- \ No newline at end of file diff --git a/es-ES/step_6.md b/es-ES/step_6.md new file mode 100644 index 0000000..1a98cb2 --- /dev/null +++ b/es-ES/step_6.md @@ -0,0 +1,106 @@ +## Make Flappy fly + +Now you will make Flappy flap upwards when you press the space bar. When you play the game, you have to time your taps to get Flappy through the gaps in the pipes. + +\--- no-print \--- + +![flappy flying upwards when space bar is pressed](images/flappy-flying.gif) + +\--- /no-print \--- + +Make Flappy fly upwards when you tap the space bar. + +\--- task \--- + +When the `space key is pressed`{:class="block3events"}, Flappy should move upwards by `changing its y coordinate`{:class="block3motion"} by a small amount, for example `6`. + +Flappy flies upwards by `repeating`{:class="block3control"} this movement `10 times`{:class="block3control"}. + +Add this code to your `Flappy` sprite: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +repeat (10) + change y by (6) +end +``` + +\--- /task \--- + +Now you need to get Flappy's wings flapping! + +\--- task \--- + +Click on the **Costumes** tab, and name Flappy's costumes 'wings up' and 'wings down'. + +![naming the costumes](images/flappy-wings.png) + +\--- /task \--- + +\--- task \--- + +Can you make Flappy's costume change to `wings down` when you press space, and then change it back to `wings up` halfway through the upward movement? + +\--- hints \--- + +\--- hint \--- + +You need to split the upward motion in half so that you can use two `repeat`{:class="block3control"} blocks to change Flappy's costume at the beginning and in the middle of the movement. + +Add `switch costume to`{:class="block3looks"} blocks to change how Flappy looks. + +\--- /hint \--- \--- hint \--- + +You need to use these blocks: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +repeat (5) + change y by (6) +end + +repeat (5) + change y by (6) +end + +switch costume to (wings up v) + +switch costume to (wings down v) + +when [space v] key pressed +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +switch costume to (wings down v) +repeat (5) + change y by (6) +end +switch costume to (wings up v) +repeat (5) + change y by (6) +end +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code. As you see, at the moment nothing happens if you let Flappy hit a pipe. + +\--- /task \--- \ No newline at end of file diff --git a/es-ES/step_7.md b/es-ES/step_7.md new file mode 100644 index 0000000..40a2720 --- /dev/null +++ b/es-ES/step_7.md @@ -0,0 +1,77 @@ +## Detect collisions + +To make the game a challenge, the player needs to guide Flappy through the gaps without letting the parrot touch the pipes or the edges of the Stage. You need to add some blocks to detect when Flappy hits something. + +This is called **collision detection**. + +\--- task \--- + +Import a sound from the library that you want to play when Flappy collides with something. The 'screech' sound is a good choice. + +[[[generic-scratch3-sound-from-library]]] + +\--- /task \--- + +A `wait until`{:class="block3control"} block is necessart to check whether Flappy is `touching the pipes`{:class="block3sensing"} `or`{:class="block3operators"} `touching the edge`{:class="block3sensing"}. + +\--- task \--- + +Add a new `when green flag clicked`{:class="block3control"} block to the 'Flappy' sprite, and also add the following code: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) +``` + +\--- /task \--- + +\--- task \--- + +Test your code. If Flappy touches a pipe, the 'screech' sound should play. + +\--- /task \--- + +Next, update the code so that the game stops when Flappy hits a pipe. + +\--- task \--- + +Add the following code to stop the game after a collision is detected: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) ++ say [Game Over!] ++ broadcast (Game Over v) ++ stop [other scripts in sprite v] +``` + +The `broadcast`{:class="block3events"} block tells other sprites that the game is over. + +The `stop`{:class="block3control"} block stops other Flappy scripts that are running so that Flappy stops falling after a collision. + +\--- /task \--- + +\--- task \--- + +Finally, add the following code to the `Pipes` sprite so that pipes `stop`{:class="block3control"} appearing `when the sprite receives Game Over`{:class="block3events"}. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I receive [Game Over v] +stop [other scripts in sprite v] +``` + +\--- /task \--- + +\--- task \--- + +Test your game and see how long you can play before it's 'Game over'! + +\--- /task \--- \ No newline at end of file diff --git a/es-ES/step_8.md b/es-ES/step_8.md new file mode 100644 index 0000000..2c5cc08 --- /dev/null +++ b/es-ES/step_8.md @@ -0,0 +1,116 @@ +## Add a score + +The player should score a point every time Flappy makes it through a gap between pipes. + +\--- task \--- + +Make a new variable **for all sprites** and call it `score`{:class="block3variables"}. + +[[[generic-scratch3-add-variable]]] + +\--- /task \--- + +Each 'Pipes' sprite clone should `wait until`{:class="block3control"} Flappy has flown past and then increase the `score`{:class="block3variables"}. + +\--- task \--- + +First, `set score to 0`{:class="block3variables"} when the game begins: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked ++ set [score v] to [0] +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +\--- /task \--- + +\--- task \--- + +Then add the following code to the `Pipes` sprite: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> +``` + +\--- /task \--- + +\--- task \--- + +Add more code so that, when Flappy's `x` position is greater than the pipe clone's `x` position, the `score`{:class="block3variables"} increases by `1` and a sound of your choice plays. + +You could use the 'pop' sound if you want, or add a sound from the library, for example 'bird'. + +\--- hints \--- + +\--- hint \--- + +You need to `wait until`{:class="block3control"} `Flappy's x position`{:class="block3sensing"} is `greater than (>)`{:class="block3operators"} the `x position`{:class="block3motion"} of `Pipes`. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone ++ wait until <> +``` + +Then `change score by 1`{:class="block3variables"} and `play a sound`{:class="block3sound"}. + +\--- /hint \--- + +\--- hint \--- + +Use these blocks in the correct order: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> + +play sound (pop v) + +change [score v] by (1) + +[x position v] of (Flappy v) + +x position + +() > () +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <([x position v] of (Flappy v)) > (x position)> +change [score v] by (1) +play sound (pop v) +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code and make sure you score a point every time Flappy gets through a gap between pipes. Check whether the `score`{:class="block3variables"} is set to `0` when you start a new game. + +\--- /task \--- \ No newline at end of file diff --git a/es-ES/step_9.md b/es-ES/step_9.md new file mode 100644 index 0000000..2f4e2e6 --- /dev/null +++ b/es-ES/step_9.md @@ -0,0 +1,5 @@ +## Challenge: adjust the difficulty + +Is the game too hard or too easy for you? How many ways can you find to change the difficulty? + +Adjust the game until you are happy with its difficulty! \ No newline at end of file diff --git a/es-LA/images/banner.png b/es-LA/images/banner.png new file mode 100644 index 0000000..7a0da5b Binary files /dev/null and b/es-LA/images/banner.png differ diff --git a/es-LA/images/binary-showcase.png b/es-LA/images/binary-showcase.png new file mode 100644 index 0000000..499aa29 Binary files /dev/null and b/es-LA/images/binary-showcase.png differ diff --git a/es-LA/images/flappy-clones-test.png b/es-LA/images/flappy-clones-test.png new file mode 100644 index 0000000..f874059 Binary files /dev/null and b/es-LA/images/flappy-clones-test.png differ diff --git a/es-LA/images/flappy-falling.gif b/es-LA/images/flappy-falling.gif new file mode 100644 index 0000000..970d833 Binary files /dev/null and b/es-LA/images/flappy-falling.gif differ diff --git a/es-LA/images/flappy-flying.gif b/es-LA/images/flappy-flying.gif new file mode 100644 index 0000000..e259ff1 Binary files /dev/null and b/es-LA/images/flappy-flying.gif differ diff --git a/es-LA/images/flappy-height-test.png b/es-LA/images/flappy-height-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/es-LA/images/flappy-height-test.png differ diff --git a/es-LA/images/flappy-parrot-showcase.png b/es-LA/images/flappy-parrot-showcase.png new file mode 100644 index 0000000..fdadfa4 Binary files /dev/null and b/es-LA/images/flappy-parrot-showcase.png differ diff --git a/es-LA/images/flappy-pipes-duplicate1-annotated.png b/es-LA/images/flappy-pipes-duplicate1-annotated.png new file mode 100644 index 0000000..1c1d74f Binary files /dev/null and b/es-LA/images/flappy-pipes-duplicate1-annotated.png differ diff --git a/es-LA/images/flappy-pipes-duplicate1.png b/es-LA/images/flappy-pipes-duplicate1.png new file mode 100644 index 0000000..7d64426 Binary files /dev/null and b/es-LA/images/flappy-pipes-duplicate1.png differ diff --git a/es-LA/images/flappy-pipes-duplicate2.png b/es-LA/images/flappy-pipes-duplicate2.png new file mode 100644 index 0000000..bb05497 Binary files /dev/null and b/es-LA/images/flappy-pipes-duplicate2.png differ diff --git a/es-LA/images/flappy-pipes-ends.png b/es-LA/images/flappy-pipes-ends.png new file mode 100644 index 0000000..ab59aaa Binary files /dev/null and b/es-LA/images/flappy-pipes-ends.png differ diff --git a/es-LA/images/flappy-pipes-fill-rectangle.png b/es-LA/images/flappy-pipes-fill-rectangle.png new file mode 100644 index 0000000..50945ed Binary files /dev/null and b/es-LA/images/flappy-pipes-fill-rectangle.png differ diff --git a/es-LA/images/flappy-pipes-filled.png b/es-LA/images/flappy-pipes-filled.png new file mode 100644 index 0000000..7aa3c5b Binary files /dev/null and b/es-LA/images/flappy-pipes-filled.png differ diff --git a/es-LA/images/flappy-pipes-position.png b/es-LA/images/flappy-pipes-position.png new file mode 100644 index 0000000..ca2b810 Binary files /dev/null and b/es-LA/images/flappy-pipes-position.png differ diff --git a/es-LA/images/flappy-pipes-rectangle.png b/es-LA/images/flappy-pipes-rectangle.png new file mode 100644 index 0000000..cfc3c62 Binary files /dev/null and b/es-LA/images/flappy-pipes-rectangle.png differ diff --git a/es-LA/images/flappy-pipes-test.png b/es-LA/images/flappy-pipes-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/es-LA/images/flappy-pipes-test.png differ diff --git a/es-LA/images/flappy-setup.png b/es-LA/images/flappy-setup.png new file mode 100644 index 0000000..92f9eca Binary files /dev/null and b/es-LA/images/flappy-setup.png differ diff --git a/es-LA/images/flappy-sprite.png b/es-LA/images/flappy-sprite.png new file mode 100644 index 0000000..6a0c590 Binary files /dev/null and b/es-LA/images/flappy-sprite.png differ diff --git a/es-LA/images/flappy-stage.png b/es-LA/images/flappy-stage.png new file mode 100644 index 0000000..5efe03c Binary files /dev/null and b/es-LA/images/flappy-stage.png differ diff --git a/es-LA/images/flappy-starting-position.png b/es-LA/images/flappy-starting-position.png new file mode 100644 index 0000000..9089c9e Binary files /dev/null and b/es-LA/images/flappy-starting-position.png differ diff --git a/es-LA/images/flappy-wings.png b/es-LA/images/flappy-wings.png new file mode 100644 index 0000000..2499dd5 Binary files /dev/null and b/es-LA/images/flappy-wings.png differ diff --git a/es-LA/images/pipes-sprite.png b/es-LA/images/pipes-sprite.png new file mode 100644 index 0000000..a9882ed Binary files /dev/null and b/es-LA/images/pipes-sprite.png differ diff --git a/es-LA/meta.yml b/es-LA/meta.yml new file mode 100644 index 0000000..d931bd6 --- /dev/null +++ b/es-LA/meta.yml @@ -0,0 +1,34 @@ +--- +title: El papagayo Plumita +hero_image: images/banner.png +description: Crea un juego en el que guíes a un papagayo a través de obstáculos en movimiento +listed: true +copyedit: true +version: 4.1 +last_tested: 2018-10-90 +steps: + - + title: Introducción + - + title: Agrega las tuberías + - + title: "Desafío: haz mejores tuberías" + challenge: true + - + title: Haz que las tuberías se muevan + - + title: Haz que Plumita se caiga + - + title: Haz que Plumita vuele + - + title: Detectar colisiones + - + title: Añade una puntuación + - + title: 'Desafío: ajusta la dificultad' + challenge: true + - + title: 'Desafío: añade un puntaje' + challenge: true + - + title: '¿Qué sigue?' diff --git a/es-LA/scratch-translatable.txt b/es-LA/scratch-translatable.txt new file mode 100644 index 0000000..1df8a64 --- /dev/null +++ b/es-LA/scratch-translatable.txt @@ -0,0 +1,13 @@ +Tuberías + +disfraz1 + +Plumita + +alas abajo + +alas arriba + +¡Fin del juego! + +puntaje diff --git a/es-LA/solutions/FlappyParrot-Solution.sb3 b/es-LA/solutions/FlappyParrot-Solution.sb3 new file mode 100644 index 0000000..fdbf5db Binary files /dev/null and b/es-LA/solutions/FlappyParrot-Solution.sb3 differ diff --git a/es-LA/step_1.md b/es-LA/step_1.md new file mode 100644 index 0000000..91aa204 --- /dev/null +++ b/es-LA/step_1.md @@ -0,0 +1,69 @@ +\--- no-print \--- + +Esta es la versión **Scratch 3** del proyecto. También hay una [versión del proyecto en Scratch 2](https://projects.raspberrypi.org/en/projects/flappy-parrot-scratch2). + +\--- /no-print \--- + +## Introducción + +Crea un juego en el que tengas que guiar a un papagayo entre las tuberías para ganar puntos. + +### Lo que harás + +\--- no-print \--- + +Haz clic en la bandera verde para comenzar el juego. ¡Pulsa la barra espacio para hacer que el loro agite sus alas, e intenta que vuele a través de los espacios entre las tuberías! Obtienes un punto cada vez que logres pasar al papagayo entre las tuberías. + +
+ + +
+ +\--- /no-print \--- + +\--- print-only \--- + +Pulsarás la barra espacio para hacer que el papagayo agite sus alas y anotarás un punto cada vez que logres pasar al papagayo entre las tuberías. + +![Están jugando al papagayo Plumita](images/flappy-parrot-showcase.png) + +\--- /print-only \--- + +## \--- collapse \--- + +## title: Lo que necesitarás + +### Hardware + ++ Un computador capaz de ejecutar el Scratch 3 + +### Software + ++ Scratch 3 (ya sea [en línea](https://rpf.io/scratchon) o [sin conexión](https://rpf.io/scratchoff)) + +\--- /collapse \--- + +## \--- collapse \--- + +## title: Lo que aprenderás + ++ Cómo crear objetos al usar el modo Vector ++ Cómo usar sonidos ++ Cómo detectar colisiones ++ Cómo controlar un objeto al usar el teclado + +\--- /collapse \--- + +## \--- collapse \--- + +## título: Notas adicionales para educadores + +\--- no-print \--- + +Si necesitas imprimir este proyecto, usa la [versión para imprimir](https://projects.raspberrypi.org/en/projects/flappy-parrot/print){:target="_blank"}. + +\--- /no-print \--- + +Puedes [descargar el proyecto completo aquí](https://rpf.io/p/en/flappy-parrot-get). + +\--- /collapse \--- \ No newline at end of file diff --git a/es-LA/step_10.md b/es-LA/step_10.md new file mode 100644 index 0000000..eb6ccbf --- /dev/null +++ b/es-LA/step_10.md @@ -0,0 +1,9 @@ +## Desafío: añade un puntaje máximo + +\--- challenge \--- + +¿Puedes agregar un puntaje máximo al juego para que, además de llevar un registro del puntaje de la ronda actual, haga un seguimiento del puntaje más alto que hayas alcanzado? + +[[[generic-scratch3-high-score]]] + +\--- /challenge \--- \ No newline at end of file diff --git a/es-LA/step_11.md b/es-LA/step_11.md new file mode 100644 index 0000000..0d8bdfc --- /dev/null +++ b/es-LA/step_11.md @@ -0,0 +1,19 @@ +## ¿Qué sigue? + +Prueba el proyecto[El ídolo binario](https://projects.raspberrypi.org/en/projects/binary-hero?utm_source=pathway&utm_medium=whatnext&utm_campaign=projects) donde harás un juego en el que tocarás las notas de una canción a medida que se desplazan por el escenario. + +\--- no-print \--- + +Presiona la bandera verde para comenzar el juego. Usa las teclas z, x, c y v para tocar las notas correctas cuando éstas lleguen a la parte inferior del escenario. Obtendrás diez puntos por cada nota correcta que toques. + +
+ +
+ +\--- /no-print \--- + +\--- print-only \--- + +Las notas caerán desde arriba y tendrás que presionar las teclas para «capturar» y tocar las notas. ![vitrina](images/binary-showcase.png) + +\--- /print-only \--- \ No newline at end of file diff --git a/es-LA/step_2.md b/es-LA/step_2.md new file mode 100644 index 0000000..00c7224 --- /dev/null +++ b/es-LA/step_2.md @@ -0,0 +1,84 @@ +## Agrega las tuberías + +Primero, crea las tuberías. + +\--- task \--- + +Abre un nuevo proyecto vacío de Scratch. + +[[[generic-scratch3-new-project]]] + +\--- /task \--- + +\--- task \--- + +Añade un fondo con un paisaje al aire libre. «Blue Sky» es una buena opción. + +![captura de pantalla](images/flappy-stage.png) + +[[[generic-scratch3-backdrop-from-library]]] + +\--- /task \--- + +\--- task \--- + +Crea un nuevo objeto y llámalo «Tuberías». + +[[[generic-scratch3-draw-sprite]]] + +\--- /task \--- + +El objeto «Tuberías» debe tener un par de tuberías con un espacio en el medio. Al mover el objeto hacia arriba o hacia abajo, puedes poner el espacio en un lugar distinto. + +Esta imagen muestra un ejemplo de cómo se pueden colocar las tuberías. Por lo general, las partes del objeto que están fuera del escenario se encuentran ocultas, solo las ves cuando arrastras el objeto: + +![captura de pantalla](images/flappy-pipes-position.png) + +Al dibujar un objeto no podrás conseguir que sea tan grande como las tuberías deben ser, pero puedes aumentar el tamaño como se muestra el objeto en el escenario. + +\--- task \--- + +![objeto tuberías](images/pipes-sprite.png) + +Añade código para que el objeto sea más grande. + +```blocks3 +al hacer clic en la bandera verde +fijar tamaño a (200) % +``` + +Esto hace que sea más fácil ver que tan grandes deben ser las tuberías. + +\--- /task \--- + +\--- task \--- + +Dibuja un rectángulo para hacer la tubería superior, como se muestra aquí: + +![rectángulo para la tubería](images/flappy-pipes-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Rellena la tubería con el color que quieras. + +![rellena el rectángulo](images/flappy-pipes-fill-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Crea un duplicado de la tubería seleccionándola y luego haz clic en **Copiar** y **Pegar**. + +![copiar y pegar la tubería](images / flappy-pipes-duplicate1-annotated.png) + +\--- /task \--- + +\--- task \--- + +Arrastra la copia de la tubería a la parte inferior de la pantalla para que la copia esté alineada con la otra tubería. Debe haber un espacio entre las dos tuberías. + +![captura de pantalla](imagen/flappy-pipes-duplicate2.png) + +\--- /task \--- \ No newline at end of file diff --git a/es-LA/step_3.md b/es-LA/step_3.md new file mode 100644 index 0000000..3d31712 --- /dev/null +++ b/es-LA/step_3.md @@ -0,0 +1,11 @@ +## Desafío: haz mejores tuberías + +¿Puedes hacer que tus tuberías se vean mejor? + ++ Dale sombra a tus tuberías con un degradado de izquierda a derecha. + +![captura de pantalla](images/flappy-pipes-filled.png) + ++ Agrega unos rectángulos en los extremos de las tuberías: + +![captura de pantalla](images/flappy-pipes-ends.png) \ No newline at end of file diff --git a/es-LA/step_4.md b/es-LA/step_4.md new file mode 100644 index 0000000..31fcf7a --- /dev/null +++ b/es-LA/step_4.md @@ -0,0 +1,65 @@ +## Haz que las tuberías se muevan + +Luego vas a hacer que las tuberías se muevan a través de la pantalla para crear un rumbo con obstáculos. + +![las tuberías se mueven por la pantalla](images/flappy-clones-test.png) + +\--- task \--- + +Primero haz que las tuberías aparezcan, para ello añade código al objeto Tuberías, así, `cuando se haga clic en la bandera verde`{:class="block3events"}, el objeto `para siempre`{:class="block3control"} `creará un clon de sí mismo`{:class="block3control"} cada dos segundos. + +![objeto Tuberías](images/pipes-sprite.png) + +```blocks3 +al presionar la bandera verde +fijar tamaño a (200) % +ocultar +por siempre + crear clon de (mí mismo v) + esperar (2) segundos +fin +``` + +**Consejo:** los clones son sólo copias de un objeto y son muy útiles para crear juegos. + +\--- /task \--- + +\--- task \--- + +Luego, haz que las tuberías se muevan al agregar un código, para que `cuando comience un clon` {: class = "block3control"}, aparezca en el lado derecho del escenario y `se deslice` {: class = "block3motion"} hacia la izquierda. + +![objeto Tuberías](images/pipes-sprite.png) + +```blocks3 +Al comenzar como clon +mostrar +ir a x: (240) y: (0) +deslizar en (4) segs a x: (-240) y: (0) +eliminar este clon +``` + +**Consejo:** puedes parar el desplazamiento de las tuberías al hacer clic en el botón rojo **detener** junto a la bandera verde. + +\--- /task \--- + +Ahora deberías tener muchas tuberías, pero los espacios están siempre en el mismo lugar. + +Puedes añadir algo de variedad al usar un número `aleatorio`{:class="block3operators"} para la `posición en y<0> del objeto Tuberías{:class="block3motion"}.

+ +

las tuberías en diferentes alturas

+ +

--- task ---

+ +

Modifica el código de tu objeto para que cada clon de objetos elija un número aleatorio de -80 a 80`{:class="block3operators"} y `deslizamientos`{:class="block3motion"} a la `posición en y`{:class="block3motion"}: + +![objeto Tuberías](images/pipes-sprite.png) + +```blocks3 +Al comenzar como clon +mostrar ++ ir a x: (240) y: (número al azar entre (-80) y (80)) ++ deslizar en (4) segs a x: (-240) y: (posición en y) +eliminar este clon +``` + +\--- /task \--- \ No newline at end of file diff --git a/es-LA/step_5.md b/es-LA/step_5.md new file mode 100644 index 0000000..adfaeea --- /dev/null +++ b/es-LA/step_5.md @@ -0,0 +1,77 @@ +## Haz que Plumita se caiga + +Ahora añade un objeto que se llame Plumita y crea un código para que Plumita caiga por el escenario hacia abajo. En el siguiente paso, añadirás el código que haga volar a Plumita al pulsar una tecla. + +\--- no-print \--- + +![animación de Plumita cayendo](images/flappy-falling.gif) + +\--- /no-print \--- + +\--- task \--- + +Añade un nuevo objeto que tenga dos disfraces, para 'alas arriba' y 'alas abajo', luego dale el nombre de `Plumita`. + +El objeto papagayo es una buena opción. + +![objeto papagayo](images/flappy-sprite.png) + +\--- /task \--- + +Plumita tiene que ser más pequeño. + +\--- task \--- + +Agrega código a `establecer el tamaño de Plumita en 25%`{:class="block3looks"}`cuando se hace clic en la bandera verde`{:class="block3events"}. + +![objeto papagayo](images/flappy-sprite.png) + +```blocks3 +al presionar la bandera verde +fijar tamaño a (25) % +``` + +\--- /task \--- + +Cuando comienza el juego, Plumita debe estar a la izquierda del centro del escenario, en las coordenadas `-50, 0`. + +![Se ve a Plumita en la posición de inicio](images/flappy-starting-position.png) + +\--- task \--- + +Añade código para hacer que Plumita `vaya a x e y`{:class="block3motion"} en la posición inicial de `x: -50`{:class="block3motion"} e `y: 0`{:class="block3motion"}. + +![objeto papagayo](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % ++ go to x: (-50) y: (0) +``` + +[[[generic-scratch3-set-coordinates]]] + +\--- /task \--- + +\--- task \--- + +Ahora haz que Plumita siga cayendo por el escenario `por siempre`{:class="block3control"}`al cambiar la posición y del objeto a -3`{:class="block3motion"}. + +![objeto papagayo](images/flappy-sprite.png) + +```blocks3 +al presionar la bandera verde +fijar tamaño a (25) % ++ ir a x: (-50) y: (0) ++ por siempre + cambiar y en (-3) +fin +``` + +\--- /task \--- + +\--- task \--- + +Prueba tu código para asegurarte de que Plumita comienza en el centro de la pantalla y cae hasta el fondo. Cuando arrastras a Plumita hasta la parte superior del escenario, el objeto debería caer de nuevo. + +\--- /task \--- \ No newline at end of file diff --git a/es-LA/step_6.md b/es-LA/step_6.md new file mode 100644 index 0000000..a337cbf --- /dev/null +++ b/es-LA/step_6.md @@ -0,0 +1,106 @@ +## Haz que Plumita vuele + +Ahora harás que Plumita aletee al presionar la barra de espacio. Cuando juegues, debes cronometrar los tecleos necesarios para que Plumita atraviese los espacios entre las tuberías. + +\--- no-print \--- + +![Plumita vuela hacia arriba cuando se presiona la barra espaciadora](images/flappy-flying.gif) + +\--- /no-print \--- + +Haz que Plumita vuele hacia arriba cuando toques la barra espacio. + +\--- task \--- + +Cuando se presiona la tecla `espacio`{:class="block3events"}, Plumita debería moverse hacia arriba `al cambiar su coordenada y`{:class="block3motion"} a una pequeña cantidad, por ejemplo `6`. + +Plumita vuela hacia arriba `al repetir`{:class="block3control"} este movimiento `10 veces`{:class="block3control"}. + +Añade este código a tu objeto `Plumita`: + +![objeto papagayo](images/flappy-sprite.png) + +```blocks3 +Al presionar la tecla (espacio v) +repetir (10) + cambiar y en (6) +fin +``` + +\--- /task \--- + +¡Ahora necesitas agitar las alas de Plumita! + +\--- task \--- + +Haz clic en la pestaña **Disfraces** y llámalos: «alas hacia arriba» y «alas hacia abajo». + +![dar nombre a los disfraces](images/flappy-wings.png) + +\--- /task \--- + +\--- task \--- + +¿Puedes hacer que el disfraz de Plumita cambie a `alas abajo` cuando presionas espacio, y luego que cambie devuelta a `alas arriba` a mitad del movimiento ascendente? + +\--- hints \--- + +\--- hint \--- + +Necesitas dividir el movimiento ascendente a la mitad para poder usar dos bloques `repetir`{:class="block3control"} para cambiar el disfraz de Plumita al inicio y en el medio del movimiento. + +Añade el bloque `cambiar disfraz a`{:class="block3looks"} para cambiar el aspecto de Plumita. + +\--- /hint \--- \--- hint \--- + +Necesitas usar estos bloques: + +![objeto papagayo](images/flappy-sprite.png) + +```blocks3 +repetir (5) + cambiar y en (6) +final + +repetir (5) + cambiar y en (6) +final + +cambiar disfraz a (alas arriba v) + +cambiar disfraz a (alas abajo v) + +al presionar la tecla [espacio v] +``` + +\--- /hint \--- + +\--- hint \--- + +Tu código debería verse así: + +![objeto papagayo](images/flappy-sprite.png) + +```blocks3 +al presionar la tecla [espacio v] +cambiar disfraz a (alas abajo v) +repetir (5) + cambiar y en (6) +final +cambiar disfraz a (alas arriba v) +repetir (5) + cambiar y en (6) +fin +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Prueba tu código. Como ves, por el momento no pasa nada si dejas que Plumita golpee una tubería. + +\--- /task \--- \ No newline at end of file diff --git a/es-LA/step_7.md b/es-LA/step_7.md new file mode 100644 index 0000000..9d95a5e --- /dev/null +++ b/es-LA/step_7.md @@ -0,0 +1,77 @@ +## Detectar colisiones + +Para que el juego sea un desafío, el jugador debe guiar a Plumita a través de los espacios sin dejar que el papagayo toque las tuberías o los bordes del escenario. Necesitas añadir algunos bloques para detectar cuando Plumita golpea algo. + +A esto se le llama **detectar colisión**. + +\--- task \--- + +Importa un sonido, desde la biblioteca, que quieras reproducir cuando Plumita choca con algo. El sonido «bird» es una buena opción. + +[[[generic-scratch3-sound-from-library]]] + +\--- /task \--- + +Se necesita un bloque `esperar hasta que`{:class="block3control"} para comprobar si Plumita `tocando las tuberías`{:class="block3sensing"} `o`{:class="block3operators"} `tocando el borde`{:class="block3sensing"}. + +\--- task \--- + +Añade un nuevo bloque `al presionar la bandera verde`{:class="block3control"} al objeto «Plumita» y también añade el siguiente código: + +![objeto papagayo](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) +``` + +\--- /task \--- + +\--- task \--- + +Prueba tu código. Si Plumita toca una tubería, debe reproducirse el sonido «bird». + +\--- /task \--- + +A continuación, actualiza el código para que el juego se detenga cuando Plumita golpee una tubería. + +\--- task \--- + +Añade el siguiente código para detener el juego después de detectar una colisión: + +![objeto papagayo](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) ++ say [Game Over!] ++ broadcast (Game Over v) ++ stop [other scripts in sprite v] +``` + +El bloque `enviar`{:class="block3events"} indica a otros objetos que el juego ha terminado. + +El bloque `detener`{:class="block3control"} para a otros objetos de Plumita, que se están ejecutando, para que deje de caer después de una colisión. + +\--- /task \--- + +\--- task \--- + +Al final, añade el siguiente código al objeto `Tuberías` para que las tuberías reciban el comando `detener`{:class="block3control"} su aparición `cuando el objeto recibe Game Over`{:class="block3events"}. + +![objeto Tuberías](images/pipes-sprite.png) + +```blocks3 +al recibir [Game Over v] +detener [otros programas en el objeto] +``` + +\--- /task \--- + +\--- task \--- + +¡Prueba tu juego y mira cuánto tiempo puedes jugar antes de que termine el juego! + +\--- / tarea \--- \ No newline at end of file diff --git a/es-LA/step_8.md b/es-LA/step_8.md new file mode 100644 index 0000000..1ea2a59 --- /dev/null +++ b/es-LA/step_8.md @@ -0,0 +1,116 @@ +## Añade un puntaje + +Quien juega debe sumar un punto cada vez que Plumita atraviesa un espacio entre tuberías. + +\--- task \--- + +Crea una nueva variable **para todos los objetos** y dale el nombre de `puntaje`{:class="block3variables"}. + +[[[generic-scratch3-add-variable]]] + +\--- /task \--- + +Cada clon de objetos 'Tubería' debería `esperar hasta`{:class="block3control"} que Plumita haya pasado y luego que aumente el `puntaje`{:class="block3variables"}. + +\--- task \--- + +Primero, cuando comienza el juego `establece el puntaje en 0`{: class="block3variables"}: + +![objeto Tuberías](images/pipes-sprite.png) + +```blocks3 +al presionar la bandera verde ++ establecer [puntaje v] a [0] +fijar tamaño a (200) % +ocultar +por siempre + crear clon de (mí mismo v) + esperar (2) segundos +fin +``` + +\--- /task \--- + +\--- task \--- + +Luego añade el siguiente código al objeto `Tuberías`: + +![objeto Tuberías](images/pipes-sprite.png) + +```blocks3 +al comenzar como clon +esperar hasta que <> +``` + +\--- /task \--- + +\--- task \--- + +Añade más código para que cuando la posición `x` de Plumita sea mayor que la posición del clon de la tubería `x`, el `puntaje`{:class="block3variables"} aumente `1` y se reproduzca un sonido de tu elección. + +Podrías usar el sonido «pop» si quieres o añadir un sonido de la biblioteca, por ejemplo «bird». + +\--- hints \--- + +\--- hint \--- + +Necesitas `esperar hasta que`{:class="block3control"} `la posición x de Plumita`{:class="block3sensing"} sea `mayor a (>)`{:class="block3operators"} la posición `x`{:class="block3motion"} de `Tuberías`. + +![objeto Tuberías](images/pipes-sprite.png) + +```blocks3 +al comenzar como clon +esperar hasta que <> +``` + +Luego `cambia la puntuación en 1`{:class="block3variables"} y `reproduce un sonido`{:class="block3sound"}. + +\--- /hint \--- + +\--- hint \--- + +Usa estos bloques en el orden correcto: + +![objeto Tuberías](images/pipes-sprite.png) + +```blocks3 +al comenzar como clon +esperar hasta que <> + +tocar sonido (pop v) + +cambiar [puntaje v] en (1) + +[posición en x v] de (Plumita v) + +posición en x + +() > () +``` + +\--- /hint \--- + +\--- hint \--- + +Tu código debería verse así: + +![objeto Tuberías](images/pipes-sprite.png) + +```blocks3 +al comenzar como clon +esperar hasta que <([posición en x v] de (Plumita v)) > (posición en x)> +cambiar [puntaje v] en (1) +tocar sonido (pop v) +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Prueba tu código y asegúrate de marcar un punto cada vez que Plumita pasa por un espacio entre las tuberías. Comprueba que el `puntaje`{: class = "block3variables"} esté fijado en `0` cuando comiences un nuevo juego. + +\--- /task \--- \ No newline at end of file diff --git a/es-LA/step_9.md b/es-LA/step_9.md new file mode 100644 index 0000000..3e41074 --- /dev/null +++ b/es-LA/step_9.md @@ -0,0 +1,5 @@ +## Desafío: ajusta la dificultad + +¿El juego es demasiado difícil o muy fácil para ti? ¿Puedes encontrar otras formas para cambiar la dificultad? + +¡Ajusta el juego hasta que estés contento con la dificultad! \ No newline at end of file diff --git a/fi-FI/images/banner.png b/fi-FI/images/banner.png new file mode 100644 index 0000000..7a0da5b Binary files /dev/null and b/fi-FI/images/banner.png differ diff --git a/fi-FI/images/binary-showcase.png b/fi-FI/images/binary-showcase.png new file mode 100644 index 0000000..499aa29 Binary files /dev/null and b/fi-FI/images/binary-showcase.png differ diff --git a/fi-FI/images/flappy-clones-test.png b/fi-FI/images/flappy-clones-test.png new file mode 100644 index 0000000..f874059 Binary files /dev/null and b/fi-FI/images/flappy-clones-test.png differ diff --git a/fi-FI/images/flappy-falling.gif b/fi-FI/images/flappy-falling.gif new file mode 100644 index 0000000..970d833 Binary files /dev/null and b/fi-FI/images/flappy-falling.gif differ diff --git a/fi-FI/images/flappy-flying.gif b/fi-FI/images/flappy-flying.gif new file mode 100644 index 0000000..e259ff1 Binary files /dev/null and b/fi-FI/images/flappy-flying.gif differ diff --git a/fi-FI/images/flappy-height-test.png b/fi-FI/images/flappy-height-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/fi-FI/images/flappy-height-test.png differ diff --git a/fi-FI/images/flappy-parrot-showcase.png b/fi-FI/images/flappy-parrot-showcase.png new file mode 100644 index 0000000..493049b Binary files /dev/null and b/fi-FI/images/flappy-parrot-showcase.png differ diff --git a/fi-FI/images/flappy-pipes-duplicate1-annotated.png b/fi-FI/images/flappy-pipes-duplicate1-annotated.png new file mode 100644 index 0000000..65e32c6 Binary files /dev/null and b/fi-FI/images/flappy-pipes-duplicate1-annotated.png differ diff --git a/fi-FI/images/flappy-pipes-duplicate1.png b/fi-FI/images/flappy-pipes-duplicate1.png new file mode 100644 index 0000000..4239b67 Binary files /dev/null and b/fi-FI/images/flappy-pipes-duplicate1.png differ diff --git a/fi-FI/images/flappy-pipes-duplicate2.png b/fi-FI/images/flappy-pipes-duplicate2.png new file mode 100644 index 0000000..ba1a69a Binary files /dev/null and b/fi-FI/images/flappy-pipes-duplicate2.png differ diff --git a/fi-FI/images/flappy-pipes-ends.png b/fi-FI/images/flappy-pipes-ends.png new file mode 100644 index 0000000..ab59aaa Binary files /dev/null and b/fi-FI/images/flappy-pipes-ends.png differ diff --git a/fi-FI/images/flappy-pipes-fill-rectangle.png b/fi-FI/images/flappy-pipes-fill-rectangle.png new file mode 100644 index 0000000..7360b87 Binary files /dev/null and b/fi-FI/images/flappy-pipes-fill-rectangle.png differ diff --git a/fi-FI/images/flappy-pipes-filled.png b/fi-FI/images/flappy-pipes-filled.png new file mode 100644 index 0000000..7d2c0dd Binary files /dev/null and b/fi-FI/images/flappy-pipes-filled.png differ diff --git a/fi-FI/images/flappy-pipes-position.png b/fi-FI/images/flappy-pipes-position.png new file mode 100644 index 0000000..ca2b810 Binary files /dev/null and b/fi-FI/images/flappy-pipes-position.png differ diff --git a/fi-FI/images/flappy-pipes-rectangle.png b/fi-FI/images/flappy-pipes-rectangle.png new file mode 100644 index 0000000..6e3bf02 Binary files /dev/null and b/fi-FI/images/flappy-pipes-rectangle.png differ diff --git a/fi-FI/images/flappy-pipes-test.png b/fi-FI/images/flappy-pipes-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/fi-FI/images/flappy-pipes-test.png differ diff --git a/fi-FI/images/flappy-setup.png b/fi-FI/images/flappy-setup.png new file mode 100644 index 0000000..92f9eca Binary files /dev/null and b/fi-FI/images/flappy-setup.png differ diff --git a/fi-FI/images/flappy-sprite.png b/fi-FI/images/flappy-sprite.png new file mode 100644 index 0000000..6a0c590 Binary files /dev/null and b/fi-FI/images/flappy-sprite.png differ diff --git a/fi-FI/images/flappy-stage.png b/fi-FI/images/flappy-stage.png new file mode 100644 index 0000000..5efe03c Binary files /dev/null and b/fi-FI/images/flappy-stage.png differ diff --git a/fi-FI/images/flappy-starting-position.png b/fi-FI/images/flappy-starting-position.png new file mode 100644 index 0000000..9089c9e Binary files /dev/null and b/fi-FI/images/flappy-starting-position.png differ diff --git a/fi-FI/images/flappy-wings.png b/fi-FI/images/flappy-wings.png new file mode 100644 index 0000000..ef0aa8e Binary files /dev/null and b/fi-FI/images/flappy-wings.png differ diff --git a/fi-FI/images/pipes-sprite.png b/fi-FI/images/pipes-sprite.png new file mode 100644 index 0000000..a9882ed Binary files /dev/null and b/fi-FI/images/pipes-sprite.png differ diff --git a/fi-FI/meta.yml b/fi-FI/meta.yml new file mode 100644 index 0000000..c2fe5e6 --- /dev/null +++ b/fi-FI/meta.yml @@ -0,0 +1,34 @@ +--- +title: Flappy parrot +hero_image: images/banner.png +description: Create a game in which you guide a parrot past moving obstacles +listed: true +copyedit: true +version: 4.1 +last_tested: 2018-10-90 +steps: + - + title: Introduction + - + title: Add the pipes + - + title: "Challenge: make better pipes" + challenge: true + - + title: Make the pipes move + - + title: Make Flappy fall + - + title: Make Flappy fly + - + title: Detect collisions + - + title: Add a score + - + title: 'Challenge: adjust the difficulty' + challenge: true + - + title: 'Challenge: add a high score' + challenge: true + - + title: What next? diff --git a/fi-FI/scratch-translatable.txt b/fi-FI/scratch-translatable.txt new file mode 100644 index 0000000..214e66c --- /dev/null +++ b/fi-FI/scratch-translatable.txt @@ -0,0 +1,13 @@ +Pipes + +costume1 + +Flappy + +wings down + +wings up + +Game Over! + +score diff --git a/fi-FI/solutions/FlappyParrot-Solution.sb3 b/fi-FI/solutions/FlappyParrot-Solution.sb3 new file mode 100644 index 0000000..a0cd354 Binary files /dev/null and b/fi-FI/solutions/FlappyParrot-Solution.sb3 differ diff --git a/fi-FI/step_1.md b/fi-FI/step_1.md new file mode 100644 index 0000000..f7519ae --- /dev/null +++ b/fi-FI/step_1.md @@ -0,0 +1,69 @@ +\--- no-print \--- + +This is the **Scratch 3** version of the project. There is also a [Scratch 2 version of the project](https://projects.raspberrypi.org/en/projects/flappy-parrot-scratch2). + +\--- /no-print \--- + +## Introduction + +Create a game in which you have to guide a parrot past scrolling pipes to score points. + +### What you will make + +\--- no-print \--- + +Click the green flag to start the game. Press the space bar to make the parrot flap its wings, and try to get it to fly through the gaps in the pipes! You score one point for every pipe that you manage to get the parrot past. + +

+ + +
+ +\--- /no-print \--- + +\--- print-only \--- + +You will press the space bar to make the parrot flap its wings, and score one point for every pipe that you manage to get the parrot past. + +![flappy parrot game being played](images/flappy-parrot-showcase.png) + +\--- /print-only \--- + +## \--- collapse \--- + +## title: What you will need + +### Hardware + ++ A computer capable of running Scratch 3 + +### Software + ++ Scratch 3 (either [online](https://rpf.io/scratchon) or [offline](https://rpf.io/scratchoff)) + +\--- /collapse \--- + +## \--- collapse \--- + +## title: What you will learn + ++ How to create sprites using Vector mode ++ How to use sounds ++ How to detect collisions ++ How to control a sprite using the keyboard + +\--- /collapse \--- + +## \--- collapse \--- + +## title: Additional notes for educators + +\--- no-print \--- + +If you need to print this project, please use the [printer-friendly version](https://projects.raspberrypi.org/en/projects/flappy-parrot/print){:target="_blank"}. + +\--- /no-print \--- + +You can find the [completed project here](https://rpf.io/p/en/flappy-parrot-get). + +\--- /collapse \--- \ No newline at end of file diff --git a/fi-FI/step_10.md b/fi-FI/step_10.md new file mode 100644 index 0000000..a5808f3 --- /dev/null +++ b/fi-FI/step_10.md @@ -0,0 +1,9 @@ +## Challenge: add a high score + +\--- challenge \--- + +Can you add a high score to the game so that, in addition to keeping track of score for the current round, it keeps track of the highest score you've ever reached? + +[[[generic-scratch3-high-score]]] + +\--- /challenge \--- \ No newline at end of file diff --git a/fi-FI/step_11.md b/fi-FI/step_11.md new file mode 100644 index 0000000..02ae229 --- /dev/null +++ b/fi-FI/step_11.md @@ -0,0 +1,19 @@ +## What next? + +Try the [Binary hero](https://projects.raspberrypi.org/en/projects/binary-hero?utm_source=pathway&utm_medium=whatnext&utm_campaign=projects) project, where you will make a game in which you play the notes of a song as they scroll down the Stage. + +\--- no-print \--- + +Click the green flag to start the game. Use the z, x, c, and v keys to play the correct notes when these reach the bottom of the Stage. You'll score ten points for every correct note you play. + +
+ +
+ +\--- /no-print \--- + +\--- print-only \--- + +The notes will fall from above, and you will have to press keys to "catch" and play the notes. ![showcase](images/binary-showcase.png) + +\--- /print-only \--- \ No newline at end of file diff --git a/fi-FI/step_2.md b/fi-FI/step_2.md new file mode 100644 index 0000000..d8f2ce5 --- /dev/null +++ b/fi-FI/step_2.md @@ -0,0 +1,84 @@ +## Add the pipes + +First, create the pipes. + +\--- task \--- + +Open a new empty Scratch project. + +[[[generic-scratch3-new-project]]] + +\--- /task \--- + +\--- task \--- + +Add a backdrop with an outdoor landscape. 'Blue Sky' is a good choice. + +![screenshot](images/flappy-stage.png) + +[[[generic-scratch3-backdrop-from-library]]] + +\--- /task \--- + +\--- task \--- + +Create a new sprite and name it 'Pipes'. + +[[[generic-scratch3-draw-sprite]]] + +\--- /task \--- + +The 'Pipes' sprite should be a pair of pipes with a gap in the middle. By moving the sprite up or down, you can put the gap in a different place. + +This picture shows an example of how the pipes could be positioned. The parts of the sprite outside the Stage are normally hidden, you only see then when you drag the sprite: + +![screenshot](images/flappy-pipes-position.png) + +You can't draw a sprite as big as the pipes need to be, but you can increase the size at which the sprite shows on the Stage. + +\--- task \--- + +![pipes sprite](images/pipes-sprite.png) + +Add code to make the sprite bigger. + +```blocks3 +when green flag clicked +set size to (200) % +``` + +This makes it's easier to see how big the pipes should be. + +\--- /task \--- + +\--- task \--- + +Draw a rectangle for the top pipe as shown here: + +![rectangle for the pipe](images/flappy-pipes-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Fill the pipe with a colour you like. + +![fill the rectangle](images/flappy-pipes-fill-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Create a duplicate of the pipe by selecting it and then clicking on **Copy** and **Paste**. + +![copy and paste pipe](images/flappy-pipes-duplicate1-annotated.png) + +\--- /task \--- + +\--- task \--- + +Drag the copy of the pipe to the bottom of the screen so that the copy is in line with the other pipe. There needs to be a gap between the two pipes. + +![screenshot](images/flappy-pipes-duplicate2.png) + +\--- /task \--- \ No newline at end of file diff --git a/fi-FI/step_3.md b/fi-FI/step_3.md new file mode 100644 index 0000000..17f05f7 --- /dev/null +++ b/fi-FI/step_3.md @@ -0,0 +1,11 @@ +## Challenge: make better pipes + +Can you make your pipes look better? + ++ Shade your pipes with a left-to-right gradient. + +![screenshot](images/flappy-pipes-filled.png) + ++ Add extra rectangles to the ends of the pipes: + +![screenshot](images/flappy-pipes-ends.png) \ No newline at end of file diff --git a/fi-FI/step_4.md b/fi-FI/step_4.md new file mode 100644 index 0000000..2beedd9 --- /dev/null +++ b/fi-FI/step_4.md @@ -0,0 +1,65 @@ +## Make the pipes move + +Next you're going to make the pipes move across the screen to create an obstacle course. + +![pipes moving across the screen](images/flappy-clones-test.png) + +\--- task \--- + +First make the pipes appear by adding code to the Pipes sprite so that, `when the green flag is clicked`{:class="block3events"}, the sprite `forever`{:class="block3control"} `creates a clone of itself`{:class="block3control"} every two seconds. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +**Tip:** clones are just copies of a sprite, and they are really useful for creating games. + +\--- /task \--- + +\--- task \--- + +Next make the pipes move by adding code so that, `when a clone starts`{:class="block3control"}, the clone appears on the right side of the Stage and `glides`{:class="block3motion"} across to the left. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show +go to x: (240) y: (0) +glide (4) secs to x: (-240) y: (0) +delete this clone +``` + +**Tip:** you can stop the pipes scrolling by clicking the red **stop** button next to the green flag. + +\--- /task \--- + +Now you should have lots of pipes, but their gaps are always in the same place. + +You can add some variety by using a `random`{:class="block3operators"} number for the Pipes sprite's `y position`{:class="block3motion"}. + +![pipes at different heights](images/flappy-height-test.png) + +\--- task \--- + +Modify your sprite's code so that each sprite clone `picks a random number from -80 to 80`{:class="block3operators"} and `glides`{:class="block3motion"} to that `y position`{:class="block3motion"}: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show ++ go to x: (240) y: (pick random (-80) to (80)) ++ glide (4) secs to x: (-240) y: (y position) +delete this clone +``` + +\--- /task \--- \ No newline at end of file diff --git a/fi-FI/step_5.md b/fi-FI/step_5.md new file mode 100644 index 0000000..f9d79ce --- /dev/null +++ b/fi-FI/step_5.md @@ -0,0 +1,77 @@ +## Make Flappy fall + +Now add a sprite called Flappy and create code it so Flappy falls down the Stage. In the next step, you will add the code to make Flappy fly when you press a key. + +\--- no-print \--- + +![flappy falling animation](images/flappy-falling.gif) + +\--- /no-print \--- + +\--- task \--- + +Add a new sprite that has two costumes, for 'wings up' and 'wings down', and name it `Flappy`. + +The parrot sprite is a good choice. + +![parrot sprite](images/flappy-sprite.png) + +\--- /task \--- + +Flappy needs to be smaller. + +\--- task \--- + +Add code to `set Flappy's size to 25%`{:class="block3looks"} `when the green flag is clicked`{:class="block3events"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +``` + +\--- /task \--- + +When the game starts, Flappy needs to be just left of the centre of the Stage, at coordinates `-50, 0`. + +![flappy shown at the start position](images/flappy-starting-position.png) + +\--- task \--- + +Add code to make Flappy `go to the x and y`{:class="block3motion"} starting position of `x: -50`{:class="block3motion"} and `y: 0`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % ++ go to x: (-50) y: (0) +``` + +[[[generic-scratch3-set-coordinates]]] + +\--- /task \--- + +\--- task \--- + +Now make Flappy keep falling down the Stage by `forever`{:class="block3control"} `changing the sprite's y position by -3`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +go to x: (-50) y: (0) ++ forever + change y by (-3) +end +``` + +\--- /task \--- + +\--- task \--- + +Test your code to make sure Flappy starts in the middle of the screen and falls to the bottom. When you drag Flappy to the top of the Stage, the sprite should fall again. + +\--- /task \--- \ No newline at end of file diff --git a/fi-FI/step_6.md b/fi-FI/step_6.md new file mode 100644 index 0000000..1a98cb2 --- /dev/null +++ b/fi-FI/step_6.md @@ -0,0 +1,106 @@ +## Make Flappy fly + +Now you will make Flappy flap upwards when you press the space bar. When you play the game, you have to time your taps to get Flappy through the gaps in the pipes. + +\--- no-print \--- + +![flappy flying upwards when space bar is pressed](images/flappy-flying.gif) + +\--- /no-print \--- + +Make Flappy fly upwards when you tap the space bar. + +\--- task \--- + +When the `space key is pressed`{:class="block3events"}, Flappy should move upwards by `changing its y coordinate`{:class="block3motion"} by a small amount, for example `6`. + +Flappy flies upwards by `repeating`{:class="block3control"} this movement `10 times`{:class="block3control"}. + +Add this code to your `Flappy` sprite: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +repeat (10) + change y by (6) +end +``` + +\--- /task \--- + +Now you need to get Flappy's wings flapping! + +\--- task \--- + +Click on the **Costumes** tab, and name Flappy's costumes 'wings up' and 'wings down'. + +![naming the costumes](images/flappy-wings.png) + +\--- /task \--- + +\--- task \--- + +Can you make Flappy's costume change to `wings down` when you press space, and then change it back to `wings up` halfway through the upward movement? + +\--- hints \--- + +\--- hint \--- + +You need to split the upward motion in half so that you can use two `repeat`{:class="block3control"} blocks to change Flappy's costume at the beginning and in the middle of the movement. + +Add `switch costume to`{:class="block3looks"} blocks to change how Flappy looks. + +\--- /hint \--- \--- hint \--- + +You need to use these blocks: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +repeat (5) + change y by (6) +end + +repeat (5) + change y by (6) +end + +switch costume to (wings up v) + +switch costume to (wings down v) + +when [space v] key pressed +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +switch costume to (wings down v) +repeat (5) + change y by (6) +end +switch costume to (wings up v) +repeat (5) + change y by (6) +end +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code. As you see, at the moment nothing happens if you let Flappy hit a pipe. + +\--- /task \--- \ No newline at end of file diff --git a/fi-FI/step_7.md b/fi-FI/step_7.md new file mode 100644 index 0000000..40a2720 --- /dev/null +++ b/fi-FI/step_7.md @@ -0,0 +1,77 @@ +## Detect collisions + +To make the game a challenge, the player needs to guide Flappy through the gaps without letting the parrot touch the pipes or the edges of the Stage. You need to add some blocks to detect when Flappy hits something. + +This is called **collision detection**. + +\--- task \--- + +Import a sound from the library that you want to play when Flappy collides with something. The 'screech' sound is a good choice. + +[[[generic-scratch3-sound-from-library]]] + +\--- /task \--- + +A `wait until`{:class="block3control"} block is necessart to check whether Flappy is `touching the pipes`{:class="block3sensing"} `or`{:class="block3operators"} `touching the edge`{:class="block3sensing"}. + +\--- task \--- + +Add a new `when green flag clicked`{:class="block3control"} block to the 'Flappy' sprite, and also add the following code: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) +``` + +\--- /task \--- + +\--- task \--- + +Test your code. If Flappy touches a pipe, the 'screech' sound should play. + +\--- /task \--- + +Next, update the code so that the game stops when Flappy hits a pipe. + +\--- task \--- + +Add the following code to stop the game after a collision is detected: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) ++ say [Game Over!] ++ broadcast (Game Over v) ++ stop [other scripts in sprite v] +``` + +The `broadcast`{:class="block3events"} block tells other sprites that the game is over. + +The `stop`{:class="block3control"} block stops other Flappy scripts that are running so that Flappy stops falling after a collision. + +\--- /task \--- + +\--- task \--- + +Finally, add the following code to the `Pipes` sprite so that pipes `stop`{:class="block3control"} appearing `when the sprite receives Game Over`{:class="block3events"}. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I receive [Game Over v] +stop [other scripts in sprite v] +``` + +\--- /task \--- + +\--- task \--- + +Test your game and see how long you can play before it's 'Game over'! + +\--- /task \--- \ No newline at end of file diff --git a/fi-FI/step_8.md b/fi-FI/step_8.md new file mode 100644 index 0000000..2c5cc08 --- /dev/null +++ b/fi-FI/step_8.md @@ -0,0 +1,116 @@ +## Add a score + +The player should score a point every time Flappy makes it through a gap between pipes. + +\--- task \--- + +Make a new variable **for all sprites** and call it `score`{:class="block3variables"}. + +[[[generic-scratch3-add-variable]]] + +\--- /task \--- + +Each 'Pipes' sprite clone should `wait until`{:class="block3control"} Flappy has flown past and then increase the `score`{:class="block3variables"}. + +\--- task \--- + +First, `set score to 0`{:class="block3variables"} when the game begins: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked ++ set [score v] to [0] +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +\--- /task \--- + +\--- task \--- + +Then add the following code to the `Pipes` sprite: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> +``` + +\--- /task \--- + +\--- task \--- + +Add more code so that, when Flappy's `x` position is greater than the pipe clone's `x` position, the `score`{:class="block3variables"} increases by `1` and a sound of your choice plays. + +You could use the 'pop' sound if you want, or add a sound from the library, for example 'bird'. + +\--- hints \--- + +\--- hint \--- + +You need to `wait until`{:class="block3control"} `Flappy's x position`{:class="block3sensing"} is `greater than (>)`{:class="block3operators"} the `x position`{:class="block3motion"} of `Pipes`. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone ++ wait until <> +``` + +Then `change score by 1`{:class="block3variables"} and `play a sound`{:class="block3sound"}. + +\--- /hint \--- + +\--- hint \--- + +Use these blocks in the correct order: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> + +play sound (pop v) + +change [score v] by (1) + +[x position v] of (Flappy v) + +x position + +() > () +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <([x position v] of (Flappy v)) > (x position)> +change [score v] by (1) +play sound (pop v) +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code and make sure you score a point every time Flappy gets through a gap between pipes. Check whether the `score`{:class="block3variables"} is set to `0` when you start a new game. + +\--- /task \--- \ No newline at end of file diff --git a/fi-FI/step_9.md b/fi-FI/step_9.md new file mode 100644 index 0000000..2f4e2e6 --- /dev/null +++ b/fi-FI/step_9.md @@ -0,0 +1,5 @@ +## Challenge: adjust the difficulty + +Is the game too hard or too easy for you? How many ways can you find to change the difficulty? + +Adjust the game until you are happy with its difficulty! \ No newline at end of file diff --git a/fr-FR/images/banner.png b/fr-FR/images/banner.png new file mode 100644 index 0000000..7a0da5b Binary files /dev/null and b/fr-FR/images/banner.png differ diff --git a/fr-FR/images/binary-showcase.png b/fr-FR/images/binary-showcase.png new file mode 100644 index 0000000..499aa29 Binary files /dev/null and b/fr-FR/images/binary-showcase.png differ diff --git a/fr-FR/images/flappy-clones-test.png b/fr-FR/images/flappy-clones-test.png new file mode 100644 index 0000000..f874059 Binary files /dev/null and b/fr-FR/images/flappy-clones-test.png differ diff --git a/fr-FR/images/flappy-falling.gif b/fr-FR/images/flappy-falling.gif new file mode 100644 index 0000000..970d833 Binary files /dev/null and b/fr-FR/images/flappy-falling.gif differ diff --git a/fr-FR/images/flappy-flying.gif b/fr-FR/images/flappy-flying.gif new file mode 100644 index 0000000..e259ff1 Binary files /dev/null and b/fr-FR/images/flappy-flying.gif differ diff --git a/fr-FR/images/flappy-height-test.png b/fr-FR/images/flappy-height-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/fr-FR/images/flappy-height-test.png differ diff --git a/fr-FR/images/flappy-parrot-showcase.png b/fr-FR/images/flappy-parrot-showcase.png new file mode 100644 index 0000000..493049b Binary files /dev/null and b/fr-FR/images/flappy-parrot-showcase.png differ diff --git a/fr-FR/images/flappy-pipes-duplicate1-annotated.png b/fr-FR/images/flappy-pipes-duplicate1-annotated.png new file mode 100644 index 0000000..b0510bc Binary files /dev/null and b/fr-FR/images/flappy-pipes-duplicate1-annotated.png differ diff --git a/fr-FR/images/flappy-pipes-duplicate1.png b/fr-FR/images/flappy-pipes-duplicate1.png new file mode 100644 index 0000000..64aa53f Binary files /dev/null and b/fr-FR/images/flappy-pipes-duplicate1.png differ diff --git a/fr-FR/images/flappy-pipes-duplicate2.png b/fr-FR/images/flappy-pipes-duplicate2.png new file mode 100644 index 0000000..09a3320 Binary files /dev/null and b/fr-FR/images/flappy-pipes-duplicate2.png differ diff --git a/fr-FR/images/flappy-pipes-ends.png b/fr-FR/images/flappy-pipes-ends.png new file mode 100644 index 0000000..ab59aaa Binary files /dev/null and b/fr-FR/images/flappy-pipes-ends.png differ diff --git a/fr-FR/images/flappy-pipes-fill-rectangle.png b/fr-FR/images/flappy-pipes-fill-rectangle.png new file mode 100644 index 0000000..36a33ba Binary files /dev/null and b/fr-FR/images/flappy-pipes-fill-rectangle.png differ diff --git a/fr-FR/images/flappy-pipes-filled.png b/fr-FR/images/flappy-pipes-filled.png new file mode 100644 index 0000000..9ba0e4e Binary files /dev/null and b/fr-FR/images/flappy-pipes-filled.png differ diff --git a/fr-FR/images/flappy-pipes-position.png b/fr-FR/images/flappy-pipes-position.png new file mode 100644 index 0000000..b259338 Binary files /dev/null and b/fr-FR/images/flappy-pipes-position.png differ diff --git a/fr-FR/images/flappy-pipes-rectangle.png b/fr-FR/images/flappy-pipes-rectangle.png new file mode 100644 index 0000000..1772067 Binary files /dev/null and b/fr-FR/images/flappy-pipes-rectangle.png differ diff --git a/fr-FR/images/flappy-pipes-test.png b/fr-FR/images/flappy-pipes-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/fr-FR/images/flappy-pipes-test.png differ diff --git a/fr-FR/images/flappy-setup.png b/fr-FR/images/flappy-setup.png new file mode 100644 index 0000000..92f9eca Binary files /dev/null and b/fr-FR/images/flappy-setup.png differ diff --git a/fr-FR/images/flappy-sprite.png b/fr-FR/images/flappy-sprite.png new file mode 100644 index 0000000..6a0c590 Binary files /dev/null and b/fr-FR/images/flappy-sprite.png differ diff --git a/fr-FR/images/flappy-stage.png b/fr-FR/images/flappy-stage.png new file mode 100644 index 0000000..5efe03c Binary files /dev/null and b/fr-FR/images/flappy-stage.png differ diff --git a/fr-FR/images/flappy-starting-position.png b/fr-FR/images/flappy-starting-position.png new file mode 100644 index 0000000..9089c9e Binary files /dev/null and b/fr-FR/images/flappy-starting-position.png differ diff --git a/fr-FR/images/flappy-wings.png b/fr-FR/images/flappy-wings.png new file mode 100644 index 0000000..2ed14d7 Binary files /dev/null and b/fr-FR/images/flappy-wings.png differ diff --git a/fr-FR/images/pipes-sprite.png b/fr-FR/images/pipes-sprite.png new file mode 100644 index 0000000..a9882ed Binary files /dev/null and b/fr-FR/images/pipes-sprite.png differ diff --git a/fr-FR/meta.yml b/fr-FR/meta.yml new file mode 100644 index 0000000..b86de52 --- /dev/null +++ b/fr-FR/meta.yml @@ -0,0 +1,34 @@ +--- +title: Flappy parrot +hero_image: images/banner.png +description: Créer un jeu dans lequel tu guides un perroquet à travers des obstacles en mouvement +listed: true +copyedit: true +version: 4.1 +last_tested: 2018-10-90 +steps: + - + title: Introduction + - + title: Ajouter les tuyaux + - + title: "Défi : Créer de meilleurs tuyaux" + challenge: true + - + title: Faire bouger les tuyaux + - + title: Faire tomber Flappy + - + title: Faire voler Flappy + - + title: Détecter les collisions + - + title: Ajouter un score + - + title: 'Défi : Ajuster la difficulté' + challenge: true + - + title: 'Défi : Ajouter un meilleur score' + challenge: true + - + title: Et ensuite ? diff --git a/fr-FR/scratch-translatable.txt b/fr-FR/scratch-translatable.txt new file mode 100644 index 0000000..dc2c697 --- /dev/null +++ b/fr-FR/scratch-translatable.txt @@ -0,0 +1,13 @@ +Tuyaux + +costume1 + +Flappy + +ailes en bas + +ailes en haut + +Partie terminée ! + +score diff --git a/fr-FR/solutions/FlappyParrot-Solution.sb3 b/fr-FR/solutions/FlappyParrot-Solution.sb3 new file mode 100644 index 0000000..f4ed5fd Binary files /dev/null and b/fr-FR/solutions/FlappyParrot-Solution.sb3 differ diff --git a/fr-FR/step_1.md b/fr-FR/step_1.md new file mode 100644 index 0000000..163ecc6 --- /dev/null +++ b/fr-FR/step_1.md @@ -0,0 +1,69 @@ +\--- no-print \--- + +Ceci est la version **Scratch 3** du projet. Il existe également une version [Scratch 2 du projet](https://projects.raspberrypi.org/en/projects/flappy-parrot-scratch2). + +\--- /no-print \--- + +## Introduction + +Crée un jeu dans lequel tu dois guider un perroquet entre les tuyaux qui se déplacent pour marquer des points. + +### Ce que tu feras + +\--- no-print \--- + +Clique sur le drapeau vert pour démarrer le jeu. Appuie sur la barre d'espace pour faire battre les ailes du perroquet, et essaie de le faire passer entre les tuyaux ! Tu marques un point pour chaque tuyau que tu parviens à franchir avec le perroquet. + +
+ + +
+ +\--- /no-print \--- + +\--- print-only \--- + +Tu appuieras sur la barre d'espace pour faire battre les ailes du perroquet, et marquera un point pour chaque tuyau que tu parviens à franchir avec le perroquet. + +![jeu flappy parrot en cours de jeu](images/flappy-parrot-showcase.png) + +\--- /print-only \--- + +## \--- collapse \--- + +## title: Ce qu'il te faut + +### Matériel informatique + ++ Un ordinateur capable d'exécuter Scratch 3 + +### Logiciel + ++ Scratch 3 (soit [en ligne](https://rpf.io/scratchon) ou [hors ligne](https://rpf.io/scratchoff)) + +\--- /collapse \--- + +## \--- collapse \--- + +## title: Ce que tu vas apprendre + ++ Comment créer des sprites en utilisant le mode vectoriel ++ Comment utiliser les sons ++ Comment détecter les collisions ++ Comment contrôler un sprite à l'aide du clavier + +\--- /collapse \--- + +## \--- collapse \--- + +## title: Informations supplémentaires pour les éducateurs + +\--- no-print \--- + +Si vous avez besoin d'imprimer ce projet, merci d'utiliser la [version imprimable](https://projects.raspberrypi.org/en/projects/flappy-parrot/print) {:target="_blank"}. + +\--- /no-print \--- + +Vous pouvez trouver le [projet terminé ici](https://rpf.io/p/en/flappy-parrot-get) . + +\--- /collapse \--- \ No newline at end of file diff --git a/fr-FR/step_10.md b/fr-FR/step_10.md new file mode 100644 index 0000000..d318505 --- /dev/null +++ b/fr-FR/step_10.md @@ -0,0 +1,9 @@ +## Défi : Ajouter un meilleur score + +\--- challenge \--- + +Peux-tu ajouter un meilleur score au jeu afin qu'en plus de garder une trace du score pour la partie en cours, il garde une trace du score le plus élevé que tu aies jamais atteint ? + +[[[generic-scratch3-high-score]]] + +\--- /challenge \--- \ No newline at end of file diff --git a/fr-FR/step_11.md b/fr-FR/step_11.md new file mode 100644 index 0000000..56b9389 --- /dev/null +++ b/fr-FR/step_11.md @@ -0,0 +1,19 @@ +## Et ensuite ? + +Essaie le projet [Virtuose du binaire](https://projects.raspberrypi.org/en/projects/binary-hero?utm_source=pathway&utm_medium=whatnext&utm_campaign=projects) , dans lequel tu créeras un jeu dans lequel tu joueras les notes d'une chanson en faisant défiler la scène. + +\--- no-print \--- + +Clique sur le drapeau vert pour démarrer le jeu. Utilise les touches z, x, cet v pour jouer les notes correctes lorsque celles-ci atteignent le bas de la scène. Tu marqueras dix points pour chaque note correcte que tu joues. + +
+ +
+ +\--- /no-print \--- + +\--- print-only \--- + +Les notes tomberont d'en haut et tu devras appuyer sur les touches pour « attraper » et jouer les notes. ![démonstration](images/binary-showcase.png) + +\--- /print-only \--- \ No newline at end of file diff --git a/fr-FR/step_2.md b/fr-FR/step_2.md new file mode 100644 index 0000000..06ed81c --- /dev/null +++ b/fr-FR/step_2.md @@ -0,0 +1,84 @@ +## Ajouter les tuyaux + +Pour commencer, crée les tuyaux. + +\--- task \--- + +Ouvre un nouveau projet Scratch vide. + +[[[generic-scratch3-new-project]]] + +\--- /task \--- + +\--- task \--- + +Ajoute un arrière-plan avec un paysage. « Blue Sky » est un bon choix. + +![capture d'écran](images/flappy-stage.png) + +[[[generic-scratch3-backdrop-from-library]]] + +\--- /task \--- + +\--- task \--- + +Crée un nouveau sprite et nomme-le « Tuyaux ». + +[[[generic-scratch3-draw-sprite]]] + +\--- /task \--- + +Le sprite « Tuyaux » doit être une paire de tuyaux avec un espace au milieu. En déplaçant le sprite vers le haut ou vers le bas, tu peux placer l'espace à un autre endroit. + +Cette image montre un exemple de la façon dont les tuyaux pourraient être positionnés. Les parties du sprite en dehors de la scène sont normalement masquées, tu les vois quand tu fais glisser le sprite : + +![capture d'écran](images/flappy-pipes-position.png) + +Tu ne peux pas dessiner un sprite aussi grand que les tuyaux doivent l'être, mais tu peux augmenter la taille à laquelle le sprite apparaît sur la scène. + +\--- task \--- + +![sprite tuyaux](images/pipes-sprite.png) + +Ajoute du code pour agrandir le sprite. + +```blocks3 +quand le drapeau vert est cliqué +mettre la taille à (200) % de la taille initiale +``` + +Cela permet de voir plus facilement la taille des tuyaux. + +\--- /task \--- + +\--- task \--- + +Dessine un rectangle pour le tuyau supérieur comme indiqué ici : + +![rectangle pour le tuyau](images/flappy-pipes-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Remplis le tuyau par une couleur que tu aimes. + +![remplir le rectangle](images/flappy-pipes-fill-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Crée une copie du tuyau en le sélectionnant puis en cliquant sur **Copier** et **Coller**. + +![copier et coller le tuyau](images/flappy-pipes-duplicate1-annotated.png) + +\--- /task \--- + +\--- task \--- + +Fais glisser la copie du tuyau vers le bas de l'écran afin que la copie soit alignée avec l'autre tuyau. Il doit y avoir un espace entre les deux tuyaux. + +![capture d'écran](images/flappy-pipes-duplicate2.png) + +\--- /task \--- \ No newline at end of file diff --git a/fr-FR/step_3.md b/fr-FR/step_3.md new file mode 100644 index 0000000..86aa4ae --- /dev/null +++ b/fr-FR/step_3.md @@ -0,0 +1,11 @@ +## Défi : Créer de meilleurs tuyaux + +Peux-tu améliorer l'apparence de tes tuyaux ? + ++ Ombre tes tuyaux avec un dégradé de gauche à droite. + +![capture d'écran](images/flappy-pipes-filled.png) + ++ Ajoute des rectangles supplémentaires aux extrémités des tuyaux : + +![capture d’écran](images/flappy-pipes-ends.png) \ No newline at end of file diff --git a/fr-FR/step_4.md b/fr-FR/step_4.md new file mode 100644 index 0000000..1ed942b --- /dev/null +++ b/fr-FR/step_4.md @@ -0,0 +1,65 @@ +## Faire bouger les tuyaux + +Maintenant, tu vas faire bouger les tuyaux sur l'écran pour créer un parcours d'obstacles. + +![tuyaux se déplaçant sur l'écran](images/flappy-clones-test.png) + +\--- task \--- + +Commence par faire apparaître les tuyaux en ajoutant du code au sprite « Tuyaux » afin que, `quand le drapeau vert est cliqué`{:class="block3events"}, le sprite `répéter indéfiniment`{:class="block3control"} `crée un clone de lui-même`{:class="block3control"} toutes les deux secondes. + +![sprite tuyaux](images/pipes-sprite.png) + +```blocks3 +when green flag clicked +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +**Astuce :** les clones ne sont que des copies d'un sprite, et ils sont vraiment utiles pour créer des jeux. + +\--- /task \--- + +\--- task \--- + +Fais bouger les tuyaux en ajoutant du code de sorte que, `quand un clone démarre`{:class="block3control"}, le clone apparaît sur le côté droit de la scène et `glisse`{:class="block3motion"} sur la gauche. + +![sprite tuyaux](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show +go to x: (240) y: (0) +glide (4) secs to x: (-240) y: (0) +delete this clone +``` + +**Astuce :** tu peux arrêter le défilement des tuyaux en cliquant sur le bouton rouge **stop** à côté du drapeau vert. + +\--- /task \--- + +Maintenant, tu devrais avoir beaucoup de tuyaux, mais leurs espaces sont toujours au même endroit. + +Tu peux ajouter de la variété en utilisant un nombre `aléatoire`{:class="block3operators"} pour l'`ordonnée y` du sprite « Tuyaux »{:class="block3motion"}. + +![tuyaux à différentes hauteurs](images/flappy-height-test.png) + +\--- task \--- + +Modifie le code de ton sprite pour que chaque clone de sprite `choisis un nombre aléatoire entre -80 et 80`{:class="block3operators"} et `glisse`{:class="block3motion"} à cet `abscisse x`{:class="block3motion"} : + +![sprite tuyaux](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show ++ go to x: (240) y: (pick random (-80) to (80)) ++ glide (4) secs to x: (-240) y: (y position) +delete this clone +``` + +\--- /task \--- \ No newline at end of file diff --git a/fr-FR/step_5.md b/fr-FR/step_5.md new file mode 100644 index 0000000..16eea81 --- /dev/null +++ b/fr-FR/step_5.md @@ -0,0 +1,77 @@ +## Faire tomber Flappy + +Maintenant, ajoute un sprite appelé « Flappy » et crée le code pour que Flappy tombe sur la scène. Dans l'étape suivante, tu ajouteras le code pour faire voler Flappy lorsque tu appuies sur une touche. + +\--- no-print \--- + +![animation de chute flappy](images/flappy-falling.gif) + +\--- /no-print \--- + +\--- task \--- + +Ajoute un nouveau sprite qui a deux costumes, pour « ailes en haut » et « ailes en bas », et nomme-le `Flappy`. + +Le sprite « Parrot » est un bon choix. + +![sprite perroquet](images/flappy-sprite.png) + +\--- /task \--- + +Flappy doit être plus petit. + +\--- task \--- + +Ajoute du code pour `mettre la taille de Flappy à 25 %`{:class="block3looks"} `quand le drapeau vert est cliqué`{:class="block3events"}. + +![sprite perroquet](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +``` + +\--- /task \--- + +Lorsque le jeu commence, Flappy doit être juste à gauche du centre de la scène, aux coordonnées `-50, 0`. + +![flappy montré à la position de départ](images/flappy-starting-position.png) + +\--- task \--- + +Ajoute du code pour que Flappy `se déplace à x et y`{:class="block3motion"} de la position de départ `x: -50`{:class="block3motion"} et `y: 0`{:class="block3motion "}. + +![sprite perroquet](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % ++ go to x: (-50) y: (0) +``` + +[[[generic-scratch3-set-coordinates]]] + +\--- /task \--- + +\--- task \--- + +Maintenant, fais en sorte que Flappy continue de tomber sur la scène `indéfiniment`{:class="block3control"} en `ajoutant -3 à l'ordonnée y du sprite`{:class="block3motion"}. + +![sprite perroquet](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +go to x: (-50) y: (0) ++ forever + change y by (-3) +end +``` + +\--- /task \--- + +\--- task \--- + +Teste ton code pour t'assurer que Flappy démarre au milieu de l'écran et tombe vers le bas. Lorsque tu fais glisser Flappy vers le haut de la scène, le sprite doit tomber à nouveau. + +\--- /task \--- \ No newline at end of file diff --git a/fr-FR/step_6.md b/fr-FR/step_6.md new file mode 100644 index 0000000..e3e1b90 --- /dev/null +++ b/fr-FR/step_6.md @@ -0,0 +1,106 @@ +## Faire voler Flappy + +Maintenant, tu vas faire voler Flappy vers le haut lorsque tu appuies sur la barre d'espace. Lorsque tu joues au jeu, tu dois contrôler tes tapotements pour faire passer Flappy entre les tuyaux. + +\--- no-print \--- + +![flappy volant vers le haut quand la touche espace est pressée](images/flappy-flying.gif) + +\--- /no-print \--- + +Fais voler Flappy vers le haut lorsque tu appuies sur la barre d'espace. + +\--- task \--- + +Lorsque la `touche d'espace est pressée`{:class="block3events"}, Flappy doit se déplacer vers le haut en `ajoutant à l'ordonnée y`{:class="block3motion"} un petit nombre, par exemple `6`. + +Flappy vole vers le haut en `répétant`{:class="block3control"} ce mouvement `10 fois`{:class="block3control"}. + +Ajoute ce code à ton sprite `Flappy` : + +![sprite perroquet](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +repeat (10) + change y by (6) +end +``` + +\--- /task \--- + +Maintenant, tu dois faire battre les ailes de Flappy ! + +\--- task \--- + +Clique sur l'onglet **Costumes** et nomme les costumes de Flappy « ailes en haut » et « ailes en bas ». + +![nommer les costumes](images/flappy-wings.png) + +\--- /task \--- + +\--- task \--- + +Peux-tu faire changer le costume de Flappy sur `ailes en bas` lorsque tu appuies sur la barre d'espace, puis le changer sur `ailes en haut` à mi-chemin ? + +\--- hints \--- + +\--- hint \--- + +Tu dois diviser le mouvement vers le haut en deux afin de pouvoir utiliser deux `répéter`{:class="block3control"} pour changer le costume de Flappy au début et au milieu du mouvement. + +Ajoute le bloc `basculer sur le costume`{:class="block3looks"} pour changer l'apparence de Flappy. + +\--- /hint \--- \--- hint \--- + +Tu dois utiliser ces blocs : + +![sprite perroquet](images/flappy-sprite.png) + +```blocks3 +répéter (5) fois + ajouter (6) à y +fin + +répéter (5) fois + ajouter (6) à y +fin + +basculer sur le costume (ailes en haut v) + +basculer sur le costume (ailes en bas v) + +quand la touche [espace v] est pressée +``` + +\--- /hint \--- + +\--- hint \--- + +Ton code devrait ressembler à ceci : + +![sprite perroquet](images/flappy-sprite.png) + +```blocks3 +quand la touche [espace v] est pressée +basculer sur le costume (ailes en bas v) +répéter (5) fois + ajouter (6) à y +fin +basculer sur le costume (ailes en haut v) +répéter (5) fois + ajouter (6) à y +fin +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Teste ton code. Comme tu peux le voir, pour le moment, rien ne se passe si tu laisses Flappy toucher un tuyau. + +\--- /task \--- \ No newline at end of file diff --git a/fr-FR/step_7.md b/fr-FR/step_7.md new file mode 100644 index 0000000..06a8382 --- /dev/null +++ b/fr-FR/step_7.md @@ -0,0 +1,77 @@ +## Détecter les collisions + +Pour que ce soit un défi, le joueur doit guider Flappy entre les espaces sans laisser le perroquet toucher les tuyaux ou les bords de la scène. Tu dois ajouter des blocs pour détecter quand Flappy touche quelque chose. + +C'est ce qu'on appelle la **détection de collision**. + +\--- task \--- + +Importe un son à partir de la bibliothèque à utiliser lorsque Flappy entre en collision avec quelque chose. Le son « screech » est un bon choix. + +[[[generic-scratch3-sound-from-library]]] + +\--- /task \--- + +Un bloc `attendre jusqu'à ce que`{:class="block3control"} est nécessaire pour vérifier si Flappy `touche les tuyaux`{:class="block3sensing"} `ou`{:class="block3operators"} `touche le bord`{:class="block3sensing"}. + +\--- task \--- + +Ajoute un nouveau `quand le drapeau vert est cliqué`{:class="block3control"} au sprite « Flappy », et ajoute également le code suivant : + +![sprite perroquet](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) +``` + +\--- /task \--- + +\--- task \--- + +Teste ton code. Si Flappy touche un tuyau, le son « screech » doit être joué. + +\--- /task \--- + +Ensuite, mets à jour le code pour que le jeu s'arrête lorsque Flappy touche un tuyau. + +\--- task \--- + +Ajoute le code suivant pour arrêter le jeu après la détection d'une collision : + +![sprite perroquet](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) ++ say [Game Over!] ++ broadcast (Game Over v) ++ stop [other scripts in sprite v] +``` + +L'`envoyer à tous`{:class="block3events"} indique aux autres sprites que la partie est terminée. + +Le `stop`{:class="block3control"} arrête les autres scripts « Flappy » en cours d'exécution afin que Flappy arrête de tomber après une collision. + +\--- /task \--- + +\--- task \--- + +Enfin, ajoute le code suivant au `Tuyaux` afin qu'ils `s'arrêtent`{:class="block3control"} d'apparaître `quand le sprite reçoit partie terminée`{:class="block3events"}. + +![sprite tuyaux](images/pipes-sprite.png) + +```blocks3 +when I receive [Game Over v] +stop [other scripts in sprite v] +``` + +\--- /task \--- + +\--- task \--- + +Teste ton jeu et vois combien de temps tu peux jouer avant que ce soit « Partie terminée » ! + +\--- /task \--- \ No newline at end of file diff --git a/fr-FR/step_8.md b/fr-FR/step_8.md new file mode 100644 index 0000000..6e460ab --- /dev/null +++ b/fr-FR/step_8.md @@ -0,0 +1,116 @@ +## Ajouter un score + +Le joueur doit marquer un point à chaque fois que Flappy franchit un espace entre les tuyaux. + +\--- task \--- + +Crée une nouvelle variable **pour tous les sprites** et appelle-la `score`{:class="block3variables"}. + +[[[generic-scratch3-add-variable]]] + +\--- /task \--- + +Chaque clone de sprite « Tuyaux » doit `attendre jusqu'à ce que`{:class="block3control"} Flappy soit passé et ensuite augmente le `score`{:class="block3variables"}. + +\--- task \--- + +Tout d'abord, `mets le score à 0`{:class="block3variables"} lorsque le jeu commence : + +![sprite tuyaux](images/pipes-sprite.png) + +```blocks3 +when green flag clicked ++ set [score v] to [0] +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +\--- /task \--- + +\--- task \--- + +Ajoute ensuite le code suivant au sprite `Tuyaux` : + +![sprite tuyaux](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> +``` + +\--- /task \--- + +\--- task \--- + +Ajoute plus de code pour que, lorsque l'abscisse `x` de Flappy est supérieure à l'abscisse `x` du clone de tuyau, le `score`{:class="block3variables"} augmente de `1` et un son de ton choix est joué. + +Tu peux utiliser le son « pop » si tu le souhaites, ou ajoute un son à partir de la bibliothèque, par exemple « bird ». + +\--- hints \--- + +\--- hint \--- + +Tu dois `attendre jusqu'à ce que`{:class="block3control"} `l'abscisse x de Flappy `{:class="block3sensing"} soit `supérieur à (>)`{:class="block3operators"} `l' abscisse x`(:class="block3motion"} des `tuyaux`. + +![sprite tuyaux](images/pipes-sprite.png) + +```blocks3 +when I start as a clone ++ wait until <> +``` + +Ensuite, `ajoute 1 à score `{:class="block3variables"} et `joue un son`{:class="block3sound"}. + +\--- /hint \--- + +\--- hint \--- + +Utilise ces blocs dans le bon ordre : + +![sprite tuyaux](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> + +play sound (pop v) + +change [score v] by (1) + +[x position v] of (Flappy v) + +x position + +() > () +``` + +\--- /hint \--- + +\--- hint \--- + +Ton code devrait ressembler à ceci : + +![sprite tuyaux](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <([x position v] of (Flappy v)) > (x position)> +change [score v] by (1) +play sound (pop v) +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Teste ton code et assure-toi de marquer un point à chaque fois que Flappy traverse un espace entre les tuyaux. Vérifie si le `score`{:class="block3variables"} est défini sur `0` lorsque tu démarres une nouvelle partie. + +\--- /task \--- \ No newline at end of file diff --git a/fr-FR/step_9.md b/fr-FR/step_9.md new file mode 100644 index 0000000..65dc9ec --- /dev/null +++ b/fr-FR/step_9.md @@ -0,0 +1,5 @@ +## Défi : Ajuster la difficulté + +Le jeu est-il trop difficile ou trop facile pour toi ? Combien de façons peux-tu trouver pour changer la difficulté ? + +Ajuste le jeu jusqu'à ce que tu sois satisfait de sa difficulté ! \ No newline at end of file diff --git a/he-IL/images/banner.png b/he-IL/images/banner.png new file mode 100644 index 0000000..7a0da5b Binary files /dev/null and b/he-IL/images/banner.png differ diff --git a/he-IL/images/binary-showcase.png b/he-IL/images/binary-showcase.png new file mode 100644 index 0000000..499aa29 Binary files /dev/null and b/he-IL/images/binary-showcase.png differ diff --git a/he-IL/images/flappy-clones-test.png b/he-IL/images/flappy-clones-test.png new file mode 100644 index 0000000..f874059 Binary files /dev/null and b/he-IL/images/flappy-clones-test.png differ diff --git a/he-IL/images/flappy-falling.gif b/he-IL/images/flappy-falling.gif new file mode 100644 index 0000000..970d833 Binary files /dev/null and b/he-IL/images/flappy-falling.gif differ diff --git a/he-IL/images/flappy-flying.gif b/he-IL/images/flappy-flying.gif new file mode 100644 index 0000000..e259ff1 Binary files /dev/null and b/he-IL/images/flappy-flying.gif differ diff --git a/he-IL/images/flappy-height-test.png b/he-IL/images/flappy-height-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/he-IL/images/flappy-height-test.png differ diff --git a/he-IL/images/flappy-parrot-showcase.png b/he-IL/images/flappy-parrot-showcase.png new file mode 100644 index 0000000..493049b Binary files /dev/null and b/he-IL/images/flappy-parrot-showcase.png differ diff --git a/he-IL/images/flappy-pipes-duplicate1-annotated.png b/he-IL/images/flappy-pipes-duplicate1-annotated.png new file mode 100644 index 0000000..65e32c6 Binary files /dev/null and b/he-IL/images/flappy-pipes-duplicate1-annotated.png differ diff --git a/he-IL/images/flappy-pipes-duplicate1.png b/he-IL/images/flappy-pipes-duplicate1.png new file mode 100644 index 0000000..4239b67 Binary files /dev/null and b/he-IL/images/flappy-pipes-duplicate1.png differ diff --git a/he-IL/images/flappy-pipes-duplicate2.png b/he-IL/images/flappy-pipes-duplicate2.png new file mode 100644 index 0000000..ba1a69a Binary files /dev/null and b/he-IL/images/flappy-pipes-duplicate2.png differ diff --git a/he-IL/images/flappy-pipes-ends.png b/he-IL/images/flappy-pipes-ends.png new file mode 100644 index 0000000..ab59aaa Binary files /dev/null and b/he-IL/images/flappy-pipes-ends.png differ diff --git a/he-IL/images/flappy-pipes-fill-rectangle.png b/he-IL/images/flappy-pipes-fill-rectangle.png new file mode 100644 index 0000000..7360b87 Binary files /dev/null and b/he-IL/images/flappy-pipes-fill-rectangle.png differ diff --git a/he-IL/images/flappy-pipes-filled.png b/he-IL/images/flappy-pipes-filled.png new file mode 100644 index 0000000..7d2c0dd Binary files /dev/null and b/he-IL/images/flappy-pipes-filled.png differ diff --git a/he-IL/images/flappy-pipes-position.png b/he-IL/images/flappy-pipes-position.png new file mode 100644 index 0000000..ca2b810 Binary files /dev/null and b/he-IL/images/flappy-pipes-position.png differ diff --git a/he-IL/images/flappy-pipes-rectangle.png b/he-IL/images/flappy-pipes-rectangle.png new file mode 100644 index 0000000..6e3bf02 Binary files /dev/null and b/he-IL/images/flappy-pipes-rectangle.png differ diff --git a/he-IL/images/flappy-pipes-test.png b/he-IL/images/flappy-pipes-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/he-IL/images/flappy-pipes-test.png differ diff --git a/he-IL/images/flappy-setup.png b/he-IL/images/flappy-setup.png new file mode 100644 index 0000000..92f9eca Binary files /dev/null and b/he-IL/images/flappy-setup.png differ diff --git a/he-IL/images/flappy-sprite.png b/he-IL/images/flappy-sprite.png new file mode 100644 index 0000000..6a0c590 Binary files /dev/null and b/he-IL/images/flappy-sprite.png differ diff --git a/he-IL/images/flappy-stage.png b/he-IL/images/flappy-stage.png new file mode 100644 index 0000000..5efe03c Binary files /dev/null and b/he-IL/images/flappy-stage.png differ diff --git a/he-IL/images/flappy-starting-position.png b/he-IL/images/flappy-starting-position.png new file mode 100644 index 0000000..9089c9e Binary files /dev/null and b/he-IL/images/flappy-starting-position.png differ diff --git a/he-IL/images/flappy-wings.png b/he-IL/images/flappy-wings.png new file mode 100644 index 0000000..ef0aa8e Binary files /dev/null and b/he-IL/images/flappy-wings.png differ diff --git a/he-IL/images/pipes-sprite.png b/he-IL/images/pipes-sprite.png new file mode 100644 index 0000000..a9882ed Binary files /dev/null and b/he-IL/images/pipes-sprite.png differ diff --git a/he-IL/meta.yml b/he-IL/meta.yml new file mode 100644 index 0000000..c2fe5e6 --- /dev/null +++ b/he-IL/meta.yml @@ -0,0 +1,34 @@ +--- +title: Flappy parrot +hero_image: images/banner.png +description: Create a game in which you guide a parrot past moving obstacles +listed: true +copyedit: true +version: 4.1 +last_tested: 2018-10-90 +steps: + - + title: Introduction + - + title: Add the pipes + - + title: "Challenge: make better pipes" + challenge: true + - + title: Make the pipes move + - + title: Make Flappy fall + - + title: Make Flappy fly + - + title: Detect collisions + - + title: Add a score + - + title: 'Challenge: adjust the difficulty' + challenge: true + - + title: 'Challenge: add a high score' + challenge: true + - + title: What next? diff --git a/he-IL/scratch-translatable.txt b/he-IL/scratch-translatable.txt new file mode 100644 index 0000000..214e66c --- /dev/null +++ b/he-IL/scratch-translatable.txt @@ -0,0 +1,13 @@ +Pipes + +costume1 + +Flappy + +wings down + +wings up + +Game Over! + +score diff --git a/he-IL/solutions/FlappyParrot-Solution.sb3 b/he-IL/solutions/FlappyParrot-Solution.sb3 new file mode 100644 index 0000000..a0cd354 Binary files /dev/null and b/he-IL/solutions/FlappyParrot-Solution.sb3 differ diff --git a/he-IL/step_1.md b/he-IL/step_1.md new file mode 100644 index 0000000..f7519ae --- /dev/null +++ b/he-IL/step_1.md @@ -0,0 +1,69 @@ +\--- no-print \--- + +This is the **Scratch 3** version of the project. There is also a [Scratch 2 version of the project](https://projects.raspberrypi.org/en/projects/flappy-parrot-scratch2). + +\--- /no-print \--- + +## Introduction + +Create a game in which you have to guide a parrot past scrolling pipes to score points. + +### What you will make + +\--- no-print \--- + +Click the green flag to start the game. Press the space bar to make the parrot flap its wings, and try to get it to fly through the gaps in the pipes! You score one point for every pipe that you manage to get the parrot past. + +
+ + +
+ +\--- /no-print \--- + +\--- print-only \--- + +You will press the space bar to make the parrot flap its wings, and score one point for every pipe that you manage to get the parrot past. + +![flappy parrot game being played](images/flappy-parrot-showcase.png) + +\--- /print-only \--- + +## \--- collapse \--- + +## title: What you will need + +### Hardware + ++ A computer capable of running Scratch 3 + +### Software + ++ Scratch 3 (either [online](https://rpf.io/scratchon) or [offline](https://rpf.io/scratchoff)) + +\--- /collapse \--- + +## \--- collapse \--- + +## title: What you will learn + ++ How to create sprites using Vector mode ++ How to use sounds ++ How to detect collisions ++ How to control a sprite using the keyboard + +\--- /collapse \--- + +## \--- collapse \--- + +## title: Additional notes for educators + +\--- no-print \--- + +If you need to print this project, please use the [printer-friendly version](https://projects.raspberrypi.org/en/projects/flappy-parrot/print){:target="_blank"}. + +\--- /no-print \--- + +You can find the [completed project here](https://rpf.io/p/en/flappy-parrot-get). + +\--- /collapse \--- \ No newline at end of file diff --git a/he-IL/step_10.md b/he-IL/step_10.md new file mode 100644 index 0000000..a5808f3 --- /dev/null +++ b/he-IL/step_10.md @@ -0,0 +1,9 @@ +## Challenge: add a high score + +\--- challenge \--- + +Can you add a high score to the game so that, in addition to keeping track of score for the current round, it keeps track of the highest score you've ever reached? + +[[[generic-scratch3-high-score]]] + +\--- /challenge \--- \ No newline at end of file diff --git a/he-IL/step_11.md b/he-IL/step_11.md new file mode 100644 index 0000000..02ae229 --- /dev/null +++ b/he-IL/step_11.md @@ -0,0 +1,19 @@ +## What next? + +Try the [Binary hero](https://projects.raspberrypi.org/en/projects/binary-hero?utm_source=pathway&utm_medium=whatnext&utm_campaign=projects) project, where you will make a game in which you play the notes of a song as they scroll down the Stage. + +\--- no-print \--- + +Click the green flag to start the game. Use the z, x, c, and v keys to play the correct notes when these reach the bottom of the Stage. You'll score ten points for every correct note you play. + +
+ +
+ +\--- /no-print \--- + +\--- print-only \--- + +The notes will fall from above, and you will have to press keys to "catch" and play the notes. ![showcase](images/binary-showcase.png) + +\--- /print-only \--- \ No newline at end of file diff --git a/he-IL/step_2.md b/he-IL/step_2.md new file mode 100644 index 0000000..d8f2ce5 --- /dev/null +++ b/he-IL/step_2.md @@ -0,0 +1,84 @@ +## Add the pipes + +First, create the pipes. + +\--- task \--- + +Open a new empty Scratch project. + +[[[generic-scratch3-new-project]]] + +\--- /task \--- + +\--- task \--- + +Add a backdrop with an outdoor landscape. 'Blue Sky' is a good choice. + +![screenshot](images/flappy-stage.png) + +[[[generic-scratch3-backdrop-from-library]]] + +\--- /task \--- + +\--- task \--- + +Create a new sprite and name it 'Pipes'. + +[[[generic-scratch3-draw-sprite]]] + +\--- /task \--- + +The 'Pipes' sprite should be a pair of pipes with a gap in the middle. By moving the sprite up or down, you can put the gap in a different place. + +This picture shows an example of how the pipes could be positioned. The parts of the sprite outside the Stage are normally hidden, you only see then when you drag the sprite: + +![screenshot](images/flappy-pipes-position.png) + +You can't draw a sprite as big as the pipes need to be, but you can increase the size at which the sprite shows on the Stage. + +\--- task \--- + +![pipes sprite](images/pipes-sprite.png) + +Add code to make the sprite bigger. + +```blocks3 +when green flag clicked +set size to (200) % +``` + +This makes it's easier to see how big the pipes should be. + +\--- /task \--- + +\--- task \--- + +Draw a rectangle for the top pipe as shown here: + +![rectangle for the pipe](images/flappy-pipes-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Fill the pipe with a colour you like. + +![fill the rectangle](images/flappy-pipes-fill-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Create a duplicate of the pipe by selecting it and then clicking on **Copy** and **Paste**. + +![copy and paste pipe](images/flappy-pipes-duplicate1-annotated.png) + +\--- /task \--- + +\--- task \--- + +Drag the copy of the pipe to the bottom of the screen so that the copy is in line with the other pipe. There needs to be a gap between the two pipes. + +![screenshot](images/flappy-pipes-duplicate2.png) + +\--- /task \--- \ No newline at end of file diff --git a/he-IL/step_3.md b/he-IL/step_3.md new file mode 100644 index 0000000..17f05f7 --- /dev/null +++ b/he-IL/step_3.md @@ -0,0 +1,11 @@ +## Challenge: make better pipes + +Can you make your pipes look better? + ++ Shade your pipes with a left-to-right gradient. + +![screenshot](images/flappy-pipes-filled.png) + ++ Add extra rectangles to the ends of the pipes: + +![screenshot](images/flappy-pipes-ends.png) \ No newline at end of file diff --git a/he-IL/step_4.md b/he-IL/step_4.md new file mode 100644 index 0000000..2beedd9 --- /dev/null +++ b/he-IL/step_4.md @@ -0,0 +1,65 @@ +## Make the pipes move + +Next you're going to make the pipes move across the screen to create an obstacle course. + +![pipes moving across the screen](images/flappy-clones-test.png) + +\--- task \--- + +First make the pipes appear by adding code to the Pipes sprite so that, `when the green flag is clicked`{:class="block3events"}, the sprite `forever`{:class="block3control"} `creates a clone of itself`{:class="block3control"} every two seconds. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +**Tip:** clones are just copies of a sprite, and they are really useful for creating games. + +\--- /task \--- + +\--- task \--- + +Next make the pipes move by adding code so that, `when a clone starts`{:class="block3control"}, the clone appears on the right side of the Stage and `glides`{:class="block3motion"} across to the left. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show +go to x: (240) y: (0) +glide (4) secs to x: (-240) y: (0) +delete this clone +``` + +**Tip:** you can stop the pipes scrolling by clicking the red **stop** button next to the green flag. + +\--- /task \--- + +Now you should have lots of pipes, but their gaps are always in the same place. + +You can add some variety by using a `random`{:class="block3operators"} number for the Pipes sprite's `y position`{:class="block3motion"}. + +![pipes at different heights](images/flappy-height-test.png) + +\--- task \--- + +Modify your sprite's code so that each sprite clone `picks a random number from -80 to 80`{:class="block3operators"} and `glides`{:class="block3motion"} to that `y position`{:class="block3motion"}: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show ++ go to x: (240) y: (pick random (-80) to (80)) ++ glide (4) secs to x: (-240) y: (y position) +delete this clone +``` + +\--- /task \--- \ No newline at end of file diff --git a/he-IL/step_5.md b/he-IL/step_5.md new file mode 100644 index 0000000..f9d79ce --- /dev/null +++ b/he-IL/step_5.md @@ -0,0 +1,77 @@ +## Make Flappy fall + +Now add a sprite called Flappy and create code it so Flappy falls down the Stage. In the next step, you will add the code to make Flappy fly when you press a key. + +\--- no-print \--- + +![flappy falling animation](images/flappy-falling.gif) + +\--- /no-print \--- + +\--- task \--- + +Add a new sprite that has two costumes, for 'wings up' and 'wings down', and name it `Flappy`. + +The parrot sprite is a good choice. + +![parrot sprite](images/flappy-sprite.png) + +\--- /task \--- + +Flappy needs to be smaller. + +\--- task \--- + +Add code to `set Flappy's size to 25%`{:class="block3looks"} `when the green flag is clicked`{:class="block3events"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +``` + +\--- /task \--- + +When the game starts, Flappy needs to be just left of the centre of the Stage, at coordinates `-50, 0`. + +![flappy shown at the start position](images/flappy-starting-position.png) + +\--- task \--- + +Add code to make Flappy `go to the x and y`{:class="block3motion"} starting position of `x: -50`{:class="block3motion"} and `y: 0`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % ++ go to x: (-50) y: (0) +``` + +[[[generic-scratch3-set-coordinates]]] + +\--- /task \--- + +\--- task \--- + +Now make Flappy keep falling down the Stage by `forever`{:class="block3control"} `changing the sprite's y position by -3`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +go to x: (-50) y: (0) ++ forever + change y by (-3) +end +``` + +\--- /task \--- + +\--- task \--- + +Test your code to make sure Flappy starts in the middle of the screen and falls to the bottom. When you drag Flappy to the top of the Stage, the sprite should fall again. + +\--- /task \--- \ No newline at end of file diff --git a/he-IL/step_6.md b/he-IL/step_6.md new file mode 100644 index 0000000..1a98cb2 --- /dev/null +++ b/he-IL/step_6.md @@ -0,0 +1,106 @@ +## Make Flappy fly + +Now you will make Flappy flap upwards when you press the space bar. When you play the game, you have to time your taps to get Flappy through the gaps in the pipes. + +\--- no-print \--- + +![flappy flying upwards when space bar is pressed](images/flappy-flying.gif) + +\--- /no-print \--- + +Make Flappy fly upwards when you tap the space bar. + +\--- task \--- + +When the `space key is pressed`{:class="block3events"}, Flappy should move upwards by `changing its y coordinate`{:class="block3motion"} by a small amount, for example `6`. + +Flappy flies upwards by `repeating`{:class="block3control"} this movement `10 times`{:class="block3control"}. + +Add this code to your `Flappy` sprite: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +repeat (10) + change y by (6) +end +``` + +\--- /task \--- + +Now you need to get Flappy's wings flapping! + +\--- task \--- + +Click on the **Costumes** tab, and name Flappy's costumes 'wings up' and 'wings down'. + +![naming the costumes](images/flappy-wings.png) + +\--- /task \--- + +\--- task \--- + +Can you make Flappy's costume change to `wings down` when you press space, and then change it back to `wings up` halfway through the upward movement? + +\--- hints \--- + +\--- hint \--- + +You need to split the upward motion in half so that you can use two `repeat`{:class="block3control"} blocks to change Flappy's costume at the beginning and in the middle of the movement. + +Add `switch costume to`{:class="block3looks"} blocks to change how Flappy looks. + +\--- /hint \--- \--- hint \--- + +You need to use these blocks: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +repeat (5) + change y by (6) +end + +repeat (5) + change y by (6) +end + +switch costume to (wings up v) + +switch costume to (wings down v) + +when [space v] key pressed +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +switch costume to (wings down v) +repeat (5) + change y by (6) +end +switch costume to (wings up v) +repeat (5) + change y by (6) +end +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code. As you see, at the moment nothing happens if you let Flappy hit a pipe. + +\--- /task \--- \ No newline at end of file diff --git a/he-IL/step_7.md b/he-IL/step_7.md new file mode 100644 index 0000000..40a2720 --- /dev/null +++ b/he-IL/step_7.md @@ -0,0 +1,77 @@ +## Detect collisions + +To make the game a challenge, the player needs to guide Flappy through the gaps without letting the parrot touch the pipes or the edges of the Stage. You need to add some blocks to detect when Flappy hits something. + +This is called **collision detection**. + +\--- task \--- + +Import a sound from the library that you want to play when Flappy collides with something. The 'screech' sound is a good choice. + +[[[generic-scratch3-sound-from-library]]] + +\--- /task \--- + +A `wait until`{:class="block3control"} block is necessart to check whether Flappy is `touching the pipes`{:class="block3sensing"} `or`{:class="block3operators"} `touching the edge`{:class="block3sensing"}. + +\--- task \--- + +Add a new `when green flag clicked`{:class="block3control"} block to the 'Flappy' sprite, and also add the following code: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) +``` + +\--- /task \--- + +\--- task \--- + +Test your code. If Flappy touches a pipe, the 'screech' sound should play. + +\--- /task \--- + +Next, update the code so that the game stops when Flappy hits a pipe. + +\--- task \--- + +Add the following code to stop the game after a collision is detected: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) ++ say [Game Over!] ++ broadcast (Game Over v) ++ stop [other scripts in sprite v] +``` + +The `broadcast`{:class="block3events"} block tells other sprites that the game is over. + +The `stop`{:class="block3control"} block stops other Flappy scripts that are running so that Flappy stops falling after a collision. + +\--- /task \--- + +\--- task \--- + +Finally, add the following code to the `Pipes` sprite so that pipes `stop`{:class="block3control"} appearing `when the sprite receives Game Over`{:class="block3events"}. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I receive [Game Over v] +stop [other scripts in sprite v] +``` + +\--- /task \--- + +\--- task \--- + +Test your game and see how long you can play before it's 'Game over'! + +\--- /task \--- \ No newline at end of file diff --git a/he-IL/step_8.md b/he-IL/step_8.md new file mode 100644 index 0000000..2c5cc08 --- /dev/null +++ b/he-IL/step_8.md @@ -0,0 +1,116 @@ +## Add a score + +The player should score a point every time Flappy makes it through a gap between pipes. + +\--- task \--- + +Make a new variable **for all sprites** and call it `score`{:class="block3variables"}. + +[[[generic-scratch3-add-variable]]] + +\--- /task \--- + +Each 'Pipes' sprite clone should `wait until`{:class="block3control"} Flappy has flown past and then increase the `score`{:class="block3variables"}. + +\--- task \--- + +First, `set score to 0`{:class="block3variables"} when the game begins: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked ++ set [score v] to [0] +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +\--- /task \--- + +\--- task \--- + +Then add the following code to the `Pipes` sprite: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> +``` + +\--- /task \--- + +\--- task \--- + +Add more code so that, when Flappy's `x` position is greater than the pipe clone's `x` position, the `score`{:class="block3variables"} increases by `1` and a sound of your choice plays. + +You could use the 'pop' sound if you want, or add a sound from the library, for example 'bird'. + +\--- hints \--- + +\--- hint \--- + +You need to `wait until`{:class="block3control"} `Flappy's x position`{:class="block3sensing"} is `greater than (>)`{:class="block3operators"} the `x position`{:class="block3motion"} of `Pipes`. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone ++ wait until <> +``` + +Then `change score by 1`{:class="block3variables"} and `play a sound`{:class="block3sound"}. + +\--- /hint \--- + +\--- hint \--- + +Use these blocks in the correct order: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> + +play sound (pop v) + +change [score v] by (1) + +[x position v] of (Flappy v) + +x position + +() > () +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <([x position v] of (Flappy v)) > (x position)> +change [score v] by (1) +play sound (pop v) +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code and make sure you score a point every time Flappy gets through a gap between pipes. Check whether the `score`{:class="block3variables"} is set to `0` when you start a new game. + +\--- /task \--- \ No newline at end of file diff --git a/he-IL/step_9.md b/he-IL/step_9.md new file mode 100644 index 0000000..2f4e2e6 --- /dev/null +++ b/he-IL/step_9.md @@ -0,0 +1,5 @@ +## Challenge: adjust the difficulty + +Is the game too hard or too easy for you? How many ways can you find to change the difficulty? + +Adjust the game until you are happy with its difficulty! \ No newline at end of file diff --git a/hi-IN/images/banner.png b/hi-IN/images/banner.png new file mode 100644 index 0000000..7a0da5b Binary files /dev/null and b/hi-IN/images/banner.png differ diff --git a/hi-IN/images/binary-showcase.png b/hi-IN/images/binary-showcase.png new file mode 100644 index 0000000..499aa29 Binary files /dev/null and b/hi-IN/images/binary-showcase.png differ diff --git a/hi-IN/images/flappy-clones-test.png b/hi-IN/images/flappy-clones-test.png new file mode 100644 index 0000000..f874059 Binary files /dev/null and b/hi-IN/images/flappy-clones-test.png differ diff --git a/hi-IN/images/flappy-falling.gif b/hi-IN/images/flappy-falling.gif new file mode 100644 index 0000000..970d833 Binary files /dev/null and b/hi-IN/images/flappy-falling.gif differ diff --git a/hi-IN/images/flappy-flying-upwards.gif b/hi-IN/images/flappy-flying-upwards.gif new file mode 100644 index 0000000..b695eef Binary files /dev/null and b/hi-IN/images/flappy-flying-upwards.gif differ diff --git a/hi-IN/images/flappy-flying.gif b/hi-IN/images/flappy-flying.gif new file mode 100644 index 0000000..e259ff1 Binary files /dev/null and b/hi-IN/images/flappy-flying.gif differ diff --git a/hi-IN/images/flappy-height-test.png b/hi-IN/images/flappy-height-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/hi-IN/images/flappy-height-test.png differ diff --git a/hi-IN/images/flappy-parrot-showcase.png b/hi-IN/images/flappy-parrot-showcase.png new file mode 100644 index 0000000..493049b Binary files /dev/null and b/hi-IN/images/flappy-parrot-showcase.png differ diff --git a/hi-IN/images/flappy-pipes-duplicate1-annotated.png b/hi-IN/images/flappy-pipes-duplicate1-annotated.png new file mode 100644 index 0000000..65e32c6 Binary files /dev/null and b/hi-IN/images/flappy-pipes-duplicate1-annotated.png differ diff --git a/hi-IN/images/flappy-pipes-duplicate1.png b/hi-IN/images/flappy-pipes-duplicate1.png new file mode 100644 index 0000000..65e32c6 Binary files /dev/null and b/hi-IN/images/flappy-pipes-duplicate1.png differ diff --git a/hi-IN/images/flappy-pipes-duplicate2.png b/hi-IN/images/flappy-pipes-duplicate2.png new file mode 100644 index 0000000..ba1a69a Binary files /dev/null and b/hi-IN/images/flappy-pipes-duplicate2.png differ diff --git a/hi-IN/images/flappy-pipes-ends.png b/hi-IN/images/flappy-pipes-ends.png new file mode 100644 index 0000000..ab59aaa Binary files /dev/null and b/hi-IN/images/flappy-pipes-ends.png differ diff --git a/hi-IN/images/flappy-pipes-fill-rectangle.png b/hi-IN/images/flappy-pipes-fill-rectangle.png new file mode 100644 index 0000000..7360b87 Binary files /dev/null and b/hi-IN/images/flappy-pipes-fill-rectangle.png differ diff --git a/hi-IN/images/flappy-pipes-filled.png b/hi-IN/images/flappy-pipes-filled.png new file mode 100644 index 0000000..7d2c0dd Binary files /dev/null and b/hi-IN/images/flappy-pipes-filled.png differ diff --git a/hi-IN/images/flappy-pipes-position.png b/hi-IN/images/flappy-pipes-position.png new file mode 100644 index 0000000..ca2b810 Binary files /dev/null and b/hi-IN/images/flappy-pipes-position.png differ diff --git a/hi-IN/images/flappy-pipes-rectangle.png b/hi-IN/images/flappy-pipes-rectangle.png new file mode 100644 index 0000000..6e3bf02 Binary files /dev/null and b/hi-IN/images/flappy-pipes-rectangle.png differ diff --git a/hi-IN/images/flappy-pipes-test.png b/hi-IN/images/flappy-pipes-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/hi-IN/images/flappy-pipes-test.png differ diff --git a/hi-IN/images/flappy-screenshot.png b/hi-IN/images/flappy-screenshot.png new file mode 100644 index 0000000..49f2941 Binary files /dev/null and b/hi-IN/images/flappy-screenshot.png differ diff --git a/hi-IN/images/flappy-setup.png b/hi-IN/images/flappy-setup.png new file mode 100644 index 0000000..92f9eca Binary files /dev/null and b/hi-IN/images/flappy-setup.png differ diff --git a/hi-IN/images/flappy-sprite.png b/hi-IN/images/flappy-sprite.png new file mode 100644 index 0000000..6a0c590 Binary files /dev/null and b/hi-IN/images/flappy-sprite.png differ diff --git a/hi-IN/images/flappy-stage.png b/hi-IN/images/flappy-stage.png new file mode 100644 index 0000000..5efe03c Binary files /dev/null and b/hi-IN/images/flappy-stage.png differ diff --git a/hi-IN/images/flappy-starting-position.png b/hi-IN/images/flappy-starting-position.png new file mode 100644 index 0000000..9089c9e Binary files /dev/null and b/hi-IN/images/flappy-starting-position.png differ diff --git a/hi-IN/images/flappy-wings.png b/hi-IN/images/flappy-wings.png new file mode 100644 index 0000000..ef0aa8e Binary files /dev/null and b/hi-IN/images/flappy-wings.png differ diff --git a/hi-IN/images/pipe_design.png b/hi-IN/images/pipe_design.png new file mode 100644 index 0000000..c451e2a Binary files /dev/null and b/hi-IN/images/pipe_design.png differ diff --git a/hi-IN/images/pipes-sprite.png b/hi-IN/images/pipes-sprite.png new file mode 100644 index 0000000..a9882ed Binary files /dev/null and b/hi-IN/images/pipes-sprite.png differ diff --git a/hi-IN/meta.yml b/hi-IN/meta.yml new file mode 100644 index 0000000..84f27ea --- /dev/null +++ b/hi-IN/meta.yml @@ -0,0 +1,34 @@ +--- +title: फ्लैपी तोता +hero_image: images/banner.png +description: एक ऐसा गेम बनाएँ जिसमें आप एक तोते का चलती बाधाओं से निकलने के लिए मार्गदर्शन करें +listed: true +copyedit: true +version: 4.1 +last_tested: 2018-10-90 +steps: + - + title: भूमिका + - + title: पाइप जोड़ें + - + title: "चुनौती: बेहतर पाइप बनाएँ" + challenge: true + - + title: पाइपों को चलाएँ + - + title: फ्लैपी को गिराएँ + - + title: फ्लैपी को उड़ाएँ + - + title: टकरावों का पता लगाएँ + - + title: स्कोर जोड़ें + - + title: 'चुनौती: कठिनाई को समायोजित करें' + challenge: true + - + title: 'चुनौती: एक उच्च स्कोर जोड़ें' + challenge: true + - + title: आगे क्या? diff --git a/hi-IN/scratch-translatable.txt b/hi-IN/scratch-translatable.txt new file mode 100644 index 0000000..214e66c --- /dev/null +++ b/hi-IN/scratch-translatable.txt @@ -0,0 +1,13 @@ +Pipes + +costume1 + +Flappy + +wings down + +wings up + +Game Over! + +score diff --git a/hi-IN/solutions/FlappyParrot-Solution.sb3 b/hi-IN/solutions/FlappyParrot-Solution.sb3 new file mode 100644 index 0000000..a0cd354 Binary files /dev/null and b/hi-IN/solutions/FlappyParrot-Solution.sb3 differ diff --git a/hi-IN/step_1.md b/hi-IN/step_1.md new file mode 100644 index 0000000..2dec7a2 --- /dev/null +++ b/hi-IN/step_1.md @@ -0,0 +1,69 @@ +\--- no-print \--- + +यह इस प्रोजेक्ट का **Scratch 3** संस्करण है। [इस प्रोजेक्ट का Scratch 2 संस्करण](https://projects.raspberrypi.org/en/projects/flappy-parrot-scratch2) भी है। + +\--- /no-print \--- + +## भूमिका + +एक गेम बनाएँ जिसमें अंक प्राप्त करने के लिए आपको स्क्रॉलिंग (घुमावदार) पाइपों से निकलने में तोते का मार्गदर्शन करना होगा। + +### आप क्या बनाएँगे + +\--- no-print \--- + +गेम शुरू करने के लिए हरे झंडे पर क्लिक करें। तोता अपने पंखों को फड़फड़ाए इसके लिए space (स्पेस) बार दबाएँ, और उसे पाइपों में खाली जगहों के बीच में से उड़ने देने की कोशिश करें! आपको हर उस पाइप के लिए एक अंक मिलता है जिसमें से आप तोते को निकाल ले जाने में सफल हो जाते हैं। + +
+ + +
+ +\--- /no-print \--- + +\--- print-only \--- + +तोता अपने पंखों को फड़फड़ाए इसके लिए आप space (स्पेस) बार दबाएँगे, और आपको हर उस पाइप के लिए एक अंक मिलता है जिसमें से आप तोते को निकाल ले जाने में सफल हो जाते हैं। + +![फ्लैपी तोता गेम खेला जा रहा है](images/flappy-parrot-showcase.png) + +\--- /print-only \--- + +## \--- collapse \--- + +## title: आपको किन चीज़ों की आवश्यकता होगी + +### हार्डवेयर + ++ Scratch 3 चलाने में सक्षम कंप्यूटर + +### सॉफ्टवेयर + ++ Scratch 3 ([ऑनलाइन](https://rpf.io/scratchon) या [ऑफ़लाइन](https://rpf.io/scratchoff)) + +\--- /collapse \--- + +## \--- collapse \--- + +## title: आप क्या सीखेंगे + ++ वेक्टर मोड का उपयोग करके sprites कैसे बनाएँ ++ ध्वनियों का उपयोग कैसे करें ++ टकरावों का पता कैसे लगाएँ ++ कीबोर्ड का उपयोग करके sprite को कैसे नियंत्रित करें + +\--- /collapse \--- + +## \--- collapse \--- + +## title: शिक्षकों के लिए अतिरिक्त टिप्पणियाँ + +\--- no-print \--- + +अगर आपको इस परियोजना को प्रिंट करने की आवश्यकता है, तो कृपया [प्रिंटर अनुकूल वर्ज़न](https://projects.raspberrypi.org/en/projects/flappy-parrot/print){:target="_blank"} का उपयोग करें। + +\--- /no-print \--- + +आप यहां [पूर्ण की गई परियोजना](https://rpf.io/p/en/flappy-parrot-get) पा सकते हैं। + +\--- /collapse \--- \ No newline at end of file diff --git a/hi-IN/step_10.md b/hi-IN/step_10.md new file mode 100644 index 0000000..8b1cb4e --- /dev/null +++ b/hi-IN/step_10.md @@ -0,0 +1,9 @@ +## चुनौती: एक उच्च स्कोर जोड़ें + +\--- challenge \--- + +क्या आप खेल में एक उच्च स्कोर जोड़ सकते हैं ताकि वर्तमान राउंड के लिए स्कोर का ट्रैक रखने के अलावा, यह आपके द्वारा अब तक के उच्चतम स्कोर का ट्रैक रखता है? + +[[[generic-scratch3-high-score]]] + +\--- /challenge \--- \ No newline at end of file diff --git a/hi-IN/step_11.md b/hi-IN/step_11.md new file mode 100644 index 0000000..662bbd6 --- /dev/null +++ b/hi-IN/step_11.md @@ -0,0 +1,19 @@ +## आगे क्या? + +[बाइनरी हीरो](https://projects.raspberrypi.org/en/projects/binary-hero?utm_source=pathway&utm_medium=whatnext&utm_campaign=projects) प्रोजेक्ट आज़माएँ, जहाँ आप एक गेम बनाएँगे जिसमें आप किसी गाने के स्वर बजाते हैं जैसे-जैसे वे स्टेज से नीचे स्क्रॉल करते हैं। + +\--- no-print \--- + +गेम शुरू करने के लिए हरे झंडे पर क्लिक करें। सही स्वरों को बजाने के लिए z, x, c, और v बटनों का उपयोग करें जब ये स्टेज के नीचे पहुँच जाते हैं। आपके द्वारा बजाए जाने वाले प्रत्येक सही स्वर के लिए आपको दस अंक मिलेंगे। + +
+ +
+ +\--- /no-print \--- + +\--- print-only \--- + +स्वर ऊपर से गिरेंगे, और आपको स्वरों को "पकड़ने" और बजाने के लिए बटनों को दबाना होगा। ![शोकेस](images/binary-showcase.png) + +\--- /print-only \--- \ No newline at end of file diff --git a/hi-IN/step_2.md b/hi-IN/step_2.md new file mode 100644 index 0000000..759906c --- /dev/null +++ b/hi-IN/step_2.md @@ -0,0 +1,84 @@ +## पाइप जोड़ें + +पहले, पाइप बनाएँ। + +\--- task \--- + +एक नई खाली Scratch परियोजना खोलें। + +[[[generic-scratch3-new-project]]] + +\--- /task \--- + +\--- task \--- + +एक बाहरी परिदृश्य के साथ कोई पृष्ठभूमि जोड़ें। 'ब्लू स्काई' (नीला आसमान) एक अच्छा विकल्प है। + +![स्क्रीनशॉट](images/flappy-stage.png) + +[[[generic-scratch3-backdrop-from-library]]] + +\--- /task \--- + +\--- task \--- + +एक नया sprite बनाएँ और इसका नाम 'Pipes' रखें। + +[[[generic-scratch3-draw-sprite]]] + +\--- /task \--- + +'Pipes' sprite पाइपों की एक जोड़ी होनी चाहिए जिसके मध्य में खाली जगह हो। Sprite को ऊपर या नीचे ले जाकर, आप खाली जगह को किसी भिन्न स्थान पर रख सकते हैं। + +इस चित्र में एक उदाहरण दिखाया गया है कि पाइप किस तरह रखे जा सकते हैं। स्टेज के बाहर sprite के हिस्से सामान्य रूप से छिपे होते हैं, आप इन्हें तभी देखते हैं जब आप sprite को खिसकाते हैं: + +![स्क्रीनशॉट](images/flappy-pipes-position.png) + +आप किसी sprite को उतना बड़ा नहीं खींच सकते जितना कि पाइपों को होना चाहिए, लेकिन आप उस आकार को उतना बढ़ा सकते हैं जितना sprite स्टेज पर दिखाता है। + +\--- task \--- + +![पाइप्स sprite](images/pipes-sprite.png) + +Sprite को बड़ा करने के लिए कोड जोड़ें। + +```blocks3 +when green flag clicked +set size to (200) % +``` + +इससे यह देखना आसान हो जाता है कि पाइप कितने बड़े होने चाहिए। + +\--- /task \--- + +\--- task \--- + +शीर्ष पाइप के लिए एक आयत बनाएँ जैसा कि यहाँ दिखाया गया है: + +![पाइप के लिए आयत](images/flappy-pipes-rectangle.png) + +\--- /task \--- + +\--- task \--- + +पाइप में अपनी पसंद का रंग भरें। + +![आयत को भरें](images/flappy-pipes-fill-rectangle.png) + +\--- /task \--- + +\--- task \--- + +पाइप का डुप्लीकेट बनाने के लिए उसे चुनें और फिर **Copy** और **Paste** पर क्लिक करें। + +![पाइप को कॉपी और पेस्ट करें](images/flappy-pipes-duplicate1-annotated.png) + +\--- /task \--- + +\--- task \--- + +पाइप की कॉपी को स्क्रीन के नीचे तक खींचें ताकि कॉपी दूसरे पाइप के अनुरूप हो। दो पाइपों के बीच खाली जगह होनी चाहिए। + +![स्क्रीनशॉट](images/flappy-pipes-duplicate2.png) + +\--- /task \--- \ No newline at end of file diff --git a/hi-IN/step_3.md b/hi-IN/step_3.md new file mode 100644 index 0000000..cf34cca --- /dev/null +++ b/hi-IN/step_3.md @@ -0,0 +1,11 @@ +## चुनौती: बेहतर पाइप बनाएँ + +क्या आप अपने पाइप को बेहतर बना सकते हैं? + ++ अपने पाइपों को बाएँ से दाएँ ग्रेडिएंट में शेड करें। + +![स्क्रीनशॉट](images/flappy-pipes-filled.png) + ++ पाइपों के सिरों में अतिरिक्त आयतों को जोड़ें: + +![स्क्रीनशॉट](images/flappy-pipes-ends.png) \ No newline at end of file diff --git a/hi-IN/step_4.md b/hi-IN/step_4.md new file mode 100644 index 0000000..69b817a --- /dev/null +++ b/hi-IN/step_4.md @@ -0,0 +1,65 @@ +## पाइपों को चलाएँ + +इसके बाद आप एक बाधा पथ बनाने के लिए पाइपों को स्क्रीन पर चलाने जा रहे हैं। + +![पाइप्स​ स्क्रीन पर चल रहे हैं](images/flappy-clones-test.png) + +\--- task \--- + +पहले पाइप्स​ को दिखाने के पाइप्स sprite मे यह​ कोड जोडें, `when the green flag is clicked`{:class="block3events"}, sprite `forever`{:class="block3control"} हर दो सेकंड मे `creates a clone of itself`{:class="block3control"} + +![पाइप्स sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +**सुझाव:** क्लोन किसी sprite की प्रतियाँ मात्र हैं, और वे गेम बनाने के लिए वास्तव में उपयोगी हैं। + +\--- /task \--- + +\--- task \--- + +इसे बाद कोड जोड़कर पाइपों को चलाएँ ताकि, `when a clone starts`{:class="block3control"}, क्लोन स्टेज की दाईं ओर दिखाई दे और `glides`{:class="block3motion"} बाईं ओर ग्लाइड करे। + +![पाइप्स sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show +go to x: (240) y: (0) +glide (4) secs to x: (-240) y: (0) +delete this clone +``` + +**सुझाव:** आप हरे झंडे के आगे बने लाल **stop** (स्टॉप) बटन पर क्लिक करके पाइप को स्क्रॉल करने से रोक सकते हैं। + +\--- /task \--- + +अब आपके पास बहुत सारे पाइप होने चाहिए, लेकिन उनके बीच खाली जगह हमेशा एक ही स्थान पर होगी। + +आप पाइप स्प्राइट की `y position`{:class="block3motion"} के लिए `random`{:class="block3operators"} संख्या का उपयोग करके इसमें कुछ विविधता जोड़ सकते हैं। + +![विभिन्न ऊंचाइयों पर पाइप](images/flappy-height-test.png) + +\--- task \--- + +अपने sprite कोड को संशोधित करें ताकि प्रत्येक sprite क्लोन `picks a random number from -80 to 80`{:class="block3operators"} और `glides`{:class="block3motion"} करे `y position`{:class="block3motion"} तक​: + +![पाइप्स sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show ++ go to x: (240) y: (pick random (-80) to (80)) ++ glide (4) secs to x: (-240) y: (y position) +delete this clone +``` + +\--- /task \--- \ No newline at end of file diff --git a/hi-IN/step_5.md b/hi-IN/step_5.md new file mode 100644 index 0000000..ea86c86 --- /dev/null +++ b/hi-IN/step_5.md @@ -0,0 +1,77 @@ +## फ्लैपी को गिराएँ + +अब Flappy नामक sprite जोड़ें और कोड बनाएँ ताकि फ्लैपी स्टेज से नीचे गिर जाए। अगले चरण में, आप कोड जोड़ेंगे ताकि जब आप कोई key (की) दबाएँ तो फ्लैपी उड़ने लग जाए। + +\--- no-print \--- + +![फ्लैपी गिरने का एनिमेशन](images/flappy-falling.gif) + +\--- /no-print \--- + +\--- task \--- + +एक नया sprite जोड़ें जिसमें दो costumes हों, 'wings up' और 'wings down' के लिए, और इसका नाम `Flappy` रखें। + +तोता sprite एक अच्छा विकल्प है। + +![तोता sprite](images/flappy-sprite.png) + +\--- /task \--- + +फ्लैपी छोटा होना चाहिए। + +\--- task \--- + +`when the green flag is clicked`{:class="block3events"} `set Flappy's size to 25%`{:class="block3looks"} के लिए कोड जोड़ें। + +![तोता sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +``` + +\--- /task \--- + +जब गेम शुरू होता है, तो फ्लैपी स्टेज के मध्य में थोड़ा बाईं ओर, समन्वय `-50, 0` पर होना चाहिए। + +![फ्लैपी आरंभ की स्थिति में दिखाया गया](images/flappy-starting-position.png) + +\--- task \--- + +`go to the x and y`{:class="block3motion"} कोड जोड़ें फ्लैपी को `x: -50`{:class="block3motion"} और `y: 0`{:class="block3motion"} के प्रारंभिक स्थिति में ले जाने के लिए। + +![तोता sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % ++ go to x: (-50) y: (0) +``` + +[[[generic-scratch3-set-coordinates]]] + +\--- /task \--- + +\--- task \--- + +अब फ्लैपी को `forever`{:class="block3control"} `changing the sprite's y position by -3`{:class="block3motion"} से स्टेज से गिरते रहने दें। + +![तोता sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +go to x: (-50) y: (0) ++ forever + change y by (-3) +end +``` + +\--- /task \--- + +\--- task \--- + +यह सुनिश्चित करने के लिए अपने कोड का परीक्षण करें कि फ्लैपी स्क्रीन के मध्य में शुरू होता है और नीचे तक गिरता है। जब आप फ्लैपी को खिसका कर स्टेज के शीर्ष पर ले जाते हैं, तो sprite को फिर से गिरना चाहिए। + +\--- /task \--- \ No newline at end of file diff --git a/hi-IN/step_6.md b/hi-IN/step_6.md new file mode 100644 index 0000000..48b91c5 --- /dev/null +++ b/hi-IN/step_6.md @@ -0,0 +1,106 @@ +## फ्लैपी को उड़ाएँ + +अब जब आप space बार को दबाएँगे तो आपका फ्लैपी ऊपर की तरफ उड़ेगा। जब आप गेम खेलते हैं, तो आपको अपने बटन दबाने के समय पर ध्यान देना होगा ताकि फ्लैपी पाइपों की खाली जगहों में से निकल सके। + +\--- no-print \--- + +![जब स्पेस बार दबाया जाता है तो तोता ऊपर की ओर उड़ता है](images/flappy-flying.gif) + +\--- /no-print \--- + +जब आप space बार को दबाएँगे तो फ्लैपी ऊपर की तरफ उड़ेगा। + +\--- task \--- + +`space key is pressed`{:class="block3events"} होने पर, फ्लैपी ऊपर उठेगा `changing its y coordinate`{:class="block3motion"} थोड़ा सा, उदाहरण के लिए `6`। + +फ्लैपी ऊपर की ओर उड़ता है इस `repeating`{:class="block3control"} गतिविधि को `10 times`{:class="block3control"} बार करने पर। + +इस कोड को अपने `Flappy` sprite में जोड़ें: + +![तोता sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +repeat (10) + change y by (6) +end +``` + +\--- /task \--- + +अब आपको फ्लैपी के पंखों को फड़फड़ाना होगा! + +\--- task \--- + +**Costumes** टैब पर क्लिक करें, और फ्लैपी के costumes का नाम 'wings up' और 'wings down' रखें। + +![costumes का नामकरण](images/flappy-wings.png) + +\--- /task \--- + +\--- task \--- + +क्या आप फ्लैपी के costume को बीच रास्ते ऊपर की ओर उड़ते समय space दबाकर `wings down` में, और फिर इसे वापस `wings up` में बदल सकते हैं? + +\--- hints \--- + +\--- hint \--- + +आपको उर्ध्व गति को आधे हिस्से के रूप में बाँटना होगा ताकि आप फ्लैपी के costume को आरंभ में और बीच में बदलने के लिए दो `repeat`{:class="block3control"} खंडो का उपयोग कर सकें। + +फ्लैपी कैसा दिखता है इसे बदलने के लिए `switch costume to`{:class="block3looks"} खंड जोड़ें। + +\--- /hint \--- \--- hint \--- + +आपको इन खंडो का उपयोग करने की आवश्यकता है: + +![तोता sprite](images/flappy-sprite.png) + +```blocks3 +repeat (5) + change y by (6) +end + +repeat (5) + change y by (6) +end + +switch costume to (wings up v) + +switch costume to (wings down v) + +when [space v] key pressed +``` + +\--- /hint \--- + +\--- hint \--- + +आपका कोड इस प्रकार दिखना चाहिए: + +![तोता sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +switch costume to (wings down v) +repeat (5) + change y by (6) +end +switch costume to (wings up v) +repeat (5) + change y by (6) +end +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +अपने कोड का परीक्षण करें। जैसा कि आप देख रहे हैं, अगर आप फ्लैपी को पाइप से टकराने देते हैं तो इस समय कुछ भी नहीं होता है। + +\--- /task \--- \ No newline at end of file diff --git a/hi-IN/step_7.md b/hi-IN/step_7.md new file mode 100644 index 0000000..a4339ee --- /dev/null +++ b/hi-IN/step_7.md @@ -0,0 +1,77 @@ +## टकरावों का पता लगाएँ + +गेम को एक चुनौती बनाने के लिए, खिलाड़ी को फ्लैपी का मार्गदर्शन करने की आवश्यकता होती है ताकि वह पाइप या स्टेज के किनारों को छुए बिना खाली जगहों में से निकल सके। फ्लैपी जब किसी चीज़ से टकराता है तो उसका पता लगाने के लिए आपको कुछ खंड जोड़ने की ज़रूरत होती है। + +इसे **collision detection** (टकराव का पता लगाना) कहते हैं। + +\--- task \--- + +लाइब्रेरी से कोई ध्वनि आयात करें जिसे आप फ्लैपी के किसी चीज़ से टकरा जाने पर बजाना चाहते हैं। 'screech' की ध्वनि एक अच्छा विकल्प है। + +[[[generic-scratch3-sound-from-library]]] + +\--- /task \--- + +यह जाँच करने के लिए `wait until`{:class="block3control"} खंड आवश्यक है कि क्या फ्लैपी `touching the pipes`{:class="block3sensing"} `or`{:class="block3operators"} `touching the edge`{:class="block3sensing"} को छू रहा है। + +\--- task \--- + +'Flappy' (फ्लैपी) sprite में एक नया `when green flag clicked`{:class="block3control"} खंड जोड़ें, और निम्नलिखित कोड भी जोड़ें: + +![तोता sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) +``` + +\--- /task \--- + +\--- task \--- + +अपने कोड का परीक्षण करें। यदि तोता किसी पाइप को छूता है, तो 'screech' की ध्वनि बजनी चाहिए। + +\--- /task \--- + +इसके बाद, कोड को अपडेट करें ताकि जब फ्लैपी किसी पाइप से टकराए तो गेम रुक जाए। + +\--- task \--- + +टकराने का पता चलने के बाद गेम को रोकने के लिए निम्नलिखित कोड जोड़ें: + +![तोता sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) ++ say [Game Over!] ++ broadcast (Game Over v) ++ stop [other scripts in sprite v] +``` + +`broadcast`{:class="block3events"} खंड दूसरे sprites को बताता है कि गेम समाप्त हो गया है। + +`stop`{:class="block3control"} खंड चल रही दूसरी फ्लैपी स्क्रिप्ट को रोकता है ताकि टकराने के बाद फ्लैपी गिरना बंद हो जाए। + +\--- /task \--- + +\--- task \--- + +अंत में, `Pipes` sprite में निम्नलिखित कोड जोड़ें ताकि `when the sprite receives Game Over`{:class="block3events"} गेम समाप्त होने की सूचना मिलने पर पाइप `stop`{:class="block3control"} दिखने बंद हो जाएँ। + +![पाइप्स sprite](images/pipes-sprite.png) + +```blocks3 +when I receive [Game Over v] +stop [other scripts in sprite v] +``` + +\--- /task \--- + +\--- task \--- + +अपने गेम का परीक्षण करें और देखें कि आप 'Game over' होने से पहले कितनी देर तक खेल सकते हैं! + +\--- /task \--- \ No newline at end of file diff --git a/hi-IN/step_8.md b/hi-IN/step_8.md new file mode 100644 index 0000000..6334b14 --- /dev/null +++ b/hi-IN/step_8.md @@ -0,0 +1,116 @@ +## स्कोर जोड़ें + +हर बार जब फ्लैपी पाइपों के बीच की खाली जगह से निकल जाए तो खिलाड़ी को एक अंक प्राप्त होना चाहिए। + +\--- task \--- + +एक नया वेरिएबल बनाए **सभी sprites** के लिए और इसका नाम `score`{:class="block3variables"} रखें। + +[[[generic-scratch3-add-variable]]] + +\--- /task \--- + +प्रत्येक 'Pipes' (पाइप्स) sprite क्लोन को `wait until`{:class="block3control"} फ्लैपी के उड़ कर निकल जाने की प्रतीक्षा करनी चाहिए और फिर `score`{:class="block3variables"} में वृद्धि करनी चाहिए। + +\--- task \--- + +पहले, गेम के शुरू होने पर `set score to 0`{:class="block3variables"} का उपयोग करें: + +![पाइप्स sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked ++ set [score v] to [0] +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +\--- /task \--- + +\--- task \--- + +फिर `Pipes` sprite में निम्नलिखित कोड जोड़ें: + +![पाइप्स sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> +``` + +\--- /task \--- + +\--- task \--- + +और अधिक कोड जोड़ें ताकि, जब फ्लैपी की `x` स्थिति पाइप क्लोन की `x` स्थिति से अधिक हो, तो `score`{:class="block3variables"} में `1` की वृद्धि होती है और आपकी पसंद की ध्वनि बजती है। + +यदि आप चाहें तो 'pop' की ध्वनि का उपयोग कर सकते हैं, या लाइब्रेरी से कोई ध्वनि जोड़ सकते हैं, उदाहरण के लिए 'bird'। + +\--- hints \--- + +\--- hint \--- + +आपको `wait until`{:class="block3control"} तब तक प्रतीक्षा करनी होगी जब तक `Flappy's x position`{:class="block3sensing"} `Pipes` की `x position`{:class="block3motion"} स्थिति `greater than (>)`{:class="block3operators"} से अधिक हो। + +![पाइप्स sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone ++ wait until <> +``` + +फिर `change score by 1`{:class="block3variables"} और `play a sound`{:class="block3sound"}। + +\--- /hint \--- + +\--- hint \--- + +इन खंडो का सही क्रम में उपयोग करें: + +![पाइप्स sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> + +play sound (pop v) + +change [score v] by (1) + +[x position v] of (Flappy v) + +x position + +() > () +``` + +\--- /hint \--- + +\--- hint \--- + +आपका कोड इस प्रकार दिखना चाहिए: + +![पाइप्स sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <([x position v] of (Flappy v)) > (x position)> +change [score v] by (1) +play sound (pop v) +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +अपने कोड का परीक्षण करें और सुनिश्चित करें कि हर बार जब फ्लैपी पाइपों के बीच की खाली जगह में से निकलता है तो आप एक अंक स्कोर करते हैं। जाँच करें कि जब आप कोई नया गेम शुरू करते हैं तो `score`{:class="block3variables"} (स्कोर) `0` पर सेट किया होता है। + +\--- /task \--- \ No newline at end of file diff --git a/hi-IN/step_9.md b/hi-IN/step_9.md new file mode 100644 index 0000000..7d6007e --- /dev/null +++ b/hi-IN/step_9.md @@ -0,0 +1,5 @@ +## चुनौती: कठिनाई को समायोजित करें + +क्या गेम आपके लिए बहुत कठिन या बहुत आसान है? कठिनाई को बदलने के लिए आप कितने तरीके खोज सकते हैं? + +गेम को तब तक समायोजित करें जब तक आप इसकी कठिनाई से खुश न हों! \ No newline at end of file diff --git a/hu-HU/images/banner.png b/hu-HU/images/banner.png new file mode 100644 index 0000000..7a0da5b Binary files /dev/null and b/hu-HU/images/banner.png differ diff --git a/hu-HU/images/binary-showcase.png b/hu-HU/images/binary-showcase.png new file mode 100644 index 0000000..499aa29 Binary files /dev/null and b/hu-HU/images/binary-showcase.png differ diff --git a/hu-HU/images/flappy-clones-test.png b/hu-HU/images/flappy-clones-test.png new file mode 100644 index 0000000..f874059 Binary files /dev/null and b/hu-HU/images/flappy-clones-test.png differ diff --git a/hu-HU/images/flappy-falling.gif b/hu-HU/images/flappy-falling.gif new file mode 100644 index 0000000..970d833 Binary files /dev/null and b/hu-HU/images/flappy-falling.gif differ diff --git a/hu-HU/images/flappy-flying.gif b/hu-HU/images/flappy-flying.gif new file mode 100644 index 0000000..e259ff1 Binary files /dev/null and b/hu-HU/images/flappy-flying.gif differ diff --git a/hu-HU/images/flappy-height-test.png b/hu-HU/images/flappy-height-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/hu-HU/images/flappy-height-test.png differ diff --git a/hu-HU/images/flappy-parrot-showcase.png b/hu-HU/images/flappy-parrot-showcase.png new file mode 100644 index 0000000..493049b Binary files /dev/null and b/hu-HU/images/flappy-parrot-showcase.png differ diff --git a/hu-HU/images/flappy-pipes-duplicate1-annotated.png b/hu-HU/images/flappy-pipes-duplicate1-annotated.png new file mode 100644 index 0000000..65e32c6 Binary files /dev/null and b/hu-HU/images/flappy-pipes-duplicate1-annotated.png differ diff --git a/hu-HU/images/flappy-pipes-duplicate1.png b/hu-HU/images/flappy-pipes-duplicate1.png new file mode 100644 index 0000000..4239b67 Binary files /dev/null and b/hu-HU/images/flappy-pipes-duplicate1.png differ diff --git a/hu-HU/images/flappy-pipes-duplicate2.png b/hu-HU/images/flappy-pipes-duplicate2.png new file mode 100644 index 0000000..ba1a69a Binary files /dev/null and b/hu-HU/images/flappy-pipes-duplicate2.png differ diff --git a/hu-HU/images/flappy-pipes-ends.png b/hu-HU/images/flappy-pipes-ends.png new file mode 100644 index 0000000..ab59aaa Binary files /dev/null and b/hu-HU/images/flappy-pipes-ends.png differ diff --git a/hu-HU/images/flappy-pipes-fill-rectangle.png b/hu-HU/images/flappy-pipes-fill-rectangle.png new file mode 100644 index 0000000..7360b87 Binary files /dev/null and b/hu-HU/images/flappy-pipes-fill-rectangle.png differ diff --git a/hu-HU/images/flappy-pipes-filled.png b/hu-HU/images/flappy-pipes-filled.png new file mode 100644 index 0000000..7d2c0dd Binary files /dev/null and b/hu-HU/images/flappy-pipes-filled.png differ diff --git a/hu-HU/images/flappy-pipes-position.png b/hu-HU/images/flappy-pipes-position.png new file mode 100644 index 0000000..ca2b810 Binary files /dev/null and b/hu-HU/images/flappy-pipes-position.png differ diff --git a/hu-HU/images/flappy-pipes-rectangle.png b/hu-HU/images/flappy-pipes-rectangle.png new file mode 100644 index 0000000..6e3bf02 Binary files /dev/null and b/hu-HU/images/flappy-pipes-rectangle.png differ diff --git a/hu-HU/images/flappy-pipes-test.png b/hu-HU/images/flappy-pipes-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/hu-HU/images/flappy-pipes-test.png differ diff --git a/hu-HU/images/flappy-setup.png b/hu-HU/images/flappy-setup.png new file mode 100644 index 0000000..92f9eca Binary files /dev/null and b/hu-HU/images/flappy-setup.png differ diff --git a/hu-HU/images/flappy-sprite.png b/hu-HU/images/flappy-sprite.png new file mode 100644 index 0000000..6a0c590 Binary files /dev/null and b/hu-HU/images/flappy-sprite.png differ diff --git a/hu-HU/images/flappy-stage.png b/hu-HU/images/flappy-stage.png new file mode 100644 index 0000000..5efe03c Binary files /dev/null and b/hu-HU/images/flappy-stage.png differ diff --git a/hu-HU/images/flappy-starting-position.png b/hu-HU/images/flappy-starting-position.png new file mode 100644 index 0000000..9089c9e Binary files /dev/null and b/hu-HU/images/flappy-starting-position.png differ diff --git a/hu-HU/images/flappy-wings.png b/hu-HU/images/flappy-wings.png new file mode 100644 index 0000000..ef0aa8e Binary files /dev/null and b/hu-HU/images/flappy-wings.png differ diff --git a/hu-HU/images/pipes-sprite.png b/hu-HU/images/pipes-sprite.png new file mode 100644 index 0000000..a9882ed Binary files /dev/null and b/hu-HU/images/pipes-sprite.png differ diff --git a/hu-HU/meta.yml b/hu-HU/meta.yml new file mode 100644 index 0000000..c2fe5e6 --- /dev/null +++ b/hu-HU/meta.yml @@ -0,0 +1,34 @@ +--- +title: Flappy parrot +hero_image: images/banner.png +description: Create a game in which you guide a parrot past moving obstacles +listed: true +copyedit: true +version: 4.1 +last_tested: 2018-10-90 +steps: + - + title: Introduction + - + title: Add the pipes + - + title: "Challenge: make better pipes" + challenge: true + - + title: Make the pipes move + - + title: Make Flappy fall + - + title: Make Flappy fly + - + title: Detect collisions + - + title: Add a score + - + title: 'Challenge: adjust the difficulty' + challenge: true + - + title: 'Challenge: add a high score' + challenge: true + - + title: What next? diff --git a/hu-HU/scratch-translatable.txt b/hu-HU/scratch-translatable.txt new file mode 100644 index 0000000..214e66c --- /dev/null +++ b/hu-HU/scratch-translatable.txt @@ -0,0 +1,13 @@ +Pipes + +costume1 + +Flappy + +wings down + +wings up + +Game Over! + +score diff --git a/hu-HU/solutions/FlappyParrot-Solution.sb3 b/hu-HU/solutions/FlappyParrot-Solution.sb3 new file mode 100644 index 0000000..a0cd354 Binary files /dev/null and b/hu-HU/solutions/FlappyParrot-Solution.sb3 differ diff --git a/hu-HU/step_1.md b/hu-HU/step_1.md new file mode 100644 index 0000000..f7519ae --- /dev/null +++ b/hu-HU/step_1.md @@ -0,0 +1,69 @@ +\--- no-print \--- + +This is the **Scratch 3** version of the project. There is also a [Scratch 2 version of the project](https://projects.raspberrypi.org/en/projects/flappy-parrot-scratch2). + +\--- /no-print \--- + +## Introduction + +Create a game in which you have to guide a parrot past scrolling pipes to score points. + +### What you will make + +\--- no-print \--- + +Click the green flag to start the game. Press the space bar to make the parrot flap its wings, and try to get it to fly through the gaps in the pipes! You score one point for every pipe that you manage to get the parrot past. + +
+ + +
+ +\--- /no-print \--- + +\--- print-only \--- + +You will press the space bar to make the parrot flap its wings, and score one point for every pipe that you manage to get the parrot past. + +![flappy parrot game being played](images/flappy-parrot-showcase.png) + +\--- /print-only \--- + +## \--- collapse \--- + +## title: What you will need + +### Hardware + ++ A computer capable of running Scratch 3 + +### Software + ++ Scratch 3 (either [online](https://rpf.io/scratchon) or [offline](https://rpf.io/scratchoff)) + +\--- /collapse \--- + +## \--- collapse \--- + +## title: What you will learn + ++ How to create sprites using Vector mode ++ How to use sounds ++ How to detect collisions ++ How to control a sprite using the keyboard + +\--- /collapse \--- + +## \--- collapse \--- + +## title: Additional notes for educators + +\--- no-print \--- + +If you need to print this project, please use the [printer-friendly version](https://projects.raspberrypi.org/en/projects/flappy-parrot/print){:target="_blank"}. + +\--- /no-print \--- + +You can find the [completed project here](https://rpf.io/p/en/flappy-parrot-get). + +\--- /collapse \--- \ No newline at end of file diff --git a/hu-HU/step_10.md b/hu-HU/step_10.md new file mode 100644 index 0000000..a5808f3 --- /dev/null +++ b/hu-HU/step_10.md @@ -0,0 +1,9 @@ +## Challenge: add a high score + +\--- challenge \--- + +Can you add a high score to the game so that, in addition to keeping track of score for the current round, it keeps track of the highest score you've ever reached? + +[[[generic-scratch3-high-score]]] + +\--- /challenge \--- \ No newline at end of file diff --git a/hu-HU/step_11.md b/hu-HU/step_11.md new file mode 100644 index 0000000..02ae229 --- /dev/null +++ b/hu-HU/step_11.md @@ -0,0 +1,19 @@ +## What next? + +Try the [Binary hero](https://projects.raspberrypi.org/en/projects/binary-hero?utm_source=pathway&utm_medium=whatnext&utm_campaign=projects) project, where you will make a game in which you play the notes of a song as they scroll down the Stage. + +\--- no-print \--- + +Click the green flag to start the game. Use the z, x, c, and v keys to play the correct notes when these reach the bottom of the Stage. You'll score ten points for every correct note you play. + +
+ +
+ +\--- /no-print \--- + +\--- print-only \--- + +The notes will fall from above, and you will have to press keys to "catch" and play the notes. ![showcase](images/binary-showcase.png) + +\--- /print-only \--- \ No newline at end of file diff --git a/hu-HU/step_2.md b/hu-HU/step_2.md new file mode 100644 index 0000000..d8f2ce5 --- /dev/null +++ b/hu-HU/step_2.md @@ -0,0 +1,84 @@ +## Add the pipes + +First, create the pipes. + +\--- task \--- + +Open a new empty Scratch project. + +[[[generic-scratch3-new-project]]] + +\--- /task \--- + +\--- task \--- + +Add a backdrop with an outdoor landscape. 'Blue Sky' is a good choice. + +![screenshot](images/flappy-stage.png) + +[[[generic-scratch3-backdrop-from-library]]] + +\--- /task \--- + +\--- task \--- + +Create a new sprite and name it 'Pipes'. + +[[[generic-scratch3-draw-sprite]]] + +\--- /task \--- + +The 'Pipes' sprite should be a pair of pipes with a gap in the middle. By moving the sprite up or down, you can put the gap in a different place. + +This picture shows an example of how the pipes could be positioned. The parts of the sprite outside the Stage are normally hidden, you only see then when you drag the sprite: + +![screenshot](images/flappy-pipes-position.png) + +You can't draw a sprite as big as the pipes need to be, but you can increase the size at which the sprite shows on the Stage. + +\--- task \--- + +![pipes sprite](images/pipes-sprite.png) + +Add code to make the sprite bigger. + +```blocks3 +when green flag clicked +set size to (200) % +``` + +This makes it's easier to see how big the pipes should be. + +\--- /task \--- + +\--- task \--- + +Draw a rectangle for the top pipe as shown here: + +![rectangle for the pipe](images/flappy-pipes-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Fill the pipe with a colour you like. + +![fill the rectangle](images/flappy-pipes-fill-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Create a duplicate of the pipe by selecting it and then clicking on **Copy** and **Paste**. + +![copy and paste pipe](images/flappy-pipes-duplicate1-annotated.png) + +\--- /task \--- + +\--- task \--- + +Drag the copy of the pipe to the bottom of the screen so that the copy is in line with the other pipe. There needs to be a gap between the two pipes. + +![screenshot](images/flappy-pipes-duplicate2.png) + +\--- /task \--- \ No newline at end of file diff --git a/hu-HU/step_3.md b/hu-HU/step_3.md new file mode 100644 index 0000000..17f05f7 --- /dev/null +++ b/hu-HU/step_3.md @@ -0,0 +1,11 @@ +## Challenge: make better pipes + +Can you make your pipes look better? + ++ Shade your pipes with a left-to-right gradient. + +![screenshot](images/flappy-pipes-filled.png) + ++ Add extra rectangles to the ends of the pipes: + +![screenshot](images/flappy-pipes-ends.png) \ No newline at end of file diff --git a/hu-HU/step_4.md b/hu-HU/step_4.md new file mode 100644 index 0000000..2beedd9 --- /dev/null +++ b/hu-HU/step_4.md @@ -0,0 +1,65 @@ +## Make the pipes move + +Next you're going to make the pipes move across the screen to create an obstacle course. + +![pipes moving across the screen](images/flappy-clones-test.png) + +\--- task \--- + +First make the pipes appear by adding code to the Pipes sprite so that, `when the green flag is clicked`{:class="block3events"}, the sprite `forever`{:class="block3control"} `creates a clone of itself`{:class="block3control"} every two seconds. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +**Tip:** clones are just copies of a sprite, and they are really useful for creating games. + +\--- /task \--- + +\--- task \--- + +Next make the pipes move by adding code so that, `when a clone starts`{:class="block3control"}, the clone appears on the right side of the Stage and `glides`{:class="block3motion"} across to the left. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show +go to x: (240) y: (0) +glide (4) secs to x: (-240) y: (0) +delete this clone +``` + +**Tip:** you can stop the pipes scrolling by clicking the red **stop** button next to the green flag. + +\--- /task \--- + +Now you should have lots of pipes, but their gaps are always in the same place. + +You can add some variety by using a `random`{:class="block3operators"} number for the Pipes sprite's `y position`{:class="block3motion"}. + +![pipes at different heights](images/flappy-height-test.png) + +\--- task \--- + +Modify your sprite's code so that each sprite clone `picks a random number from -80 to 80`{:class="block3operators"} and `glides`{:class="block3motion"} to that `y position`{:class="block3motion"}: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show ++ go to x: (240) y: (pick random (-80) to (80)) ++ glide (4) secs to x: (-240) y: (y position) +delete this clone +``` + +\--- /task \--- \ No newline at end of file diff --git a/hu-HU/step_5.md b/hu-HU/step_5.md new file mode 100644 index 0000000..f9d79ce --- /dev/null +++ b/hu-HU/step_5.md @@ -0,0 +1,77 @@ +## Make Flappy fall + +Now add a sprite called Flappy and create code it so Flappy falls down the Stage. In the next step, you will add the code to make Flappy fly when you press a key. + +\--- no-print \--- + +![flappy falling animation](images/flappy-falling.gif) + +\--- /no-print \--- + +\--- task \--- + +Add a new sprite that has two costumes, for 'wings up' and 'wings down', and name it `Flappy`. + +The parrot sprite is a good choice. + +![parrot sprite](images/flappy-sprite.png) + +\--- /task \--- + +Flappy needs to be smaller. + +\--- task \--- + +Add code to `set Flappy's size to 25%`{:class="block3looks"} `when the green flag is clicked`{:class="block3events"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +``` + +\--- /task \--- + +When the game starts, Flappy needs to be just left of the centre of the Stage, at coordinates `-50, 0`. + +![flappy shown at the start position](images/flappy-starting-position.png) + +\--- task \--- + +Add code to make Flappy `go to the x and y`{:class="block3motion"} starting position of `x: -50`{:class="block3motion"} and `y: 0`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % ++ go to x: (-50) y: (0) +``` + +[[[generic-scratch3-set-coordinates]]] + +\--- /task \--- + +\--- task \--- + +Now make Flappy keep falling down the Stage by `forever`{:class="block3control"} `changing the sprite's y position by -3`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +go to x: (-50) y: (0) ++ forever + change y by (-3) +end +``` + +\--- /task \--- + +\--- task \--- + +Test your code to make sure Flappy starts in the middle of the screen and falls to the bottom. When you drag Flappy to the top of the Stage, the sprite should fall again. + +\--- /task \--- \ No newline at end of file diff --git a/hu-HU/step_6.md b/hu-HU/step_6.md new file mode 100644 index 0000000..1a98cb2 --- /dev/null +++ b/hu-HU/step_6.md @@ -0,0 +1,106 @@ +## Make Flappy fly + +Now you will make Flappy flap upwards when you press the space bar. When you play the game, you have to time your taps to get Flappy through the gaps in the pipes. + +\--- no-print \--- + +![flappy flying upwards when space bar is pressed](images/flappy-flying.gif) + +\--- /no-print \--- + +Make Flappy fly upwards when you tap the space bar. + +\--- task \--- + +When the `space key is pressed`{:class="block3events"}, Flappy should move upwards by `changing its y coordinate`{:class="block3motion"} by a small amount, for example `6`. + +Flappy flies upwards by `repeating`{:class="block3control"} this movement `10 times`{:class="block3control"}. + +Add this code to your `Flappy` sprite: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +repeat (10) + change y by (6) +end +``` + +\--- /task \--- + +Now you need to get Flappy's wings flapping! + +\--- task \--- + +Click on the **Costumes** tab, and name Flappy's costumes 'wings up' and 'wings down'. + +![naming the costumes](images/flappy-wings.png) + +\--- /task \--- + +\--- task \--- + +Can you make Flappy's costume change to `wings down` when you press space, and then change it back to `wings up` halfway through the upward movement? + +\--- hints \--- + +\--- hint \--- + +You need to split the upward motion in half so that you can use two `repeat`{:class="block3control"} blocks to change Flappy's costume at the beginning and in the middle of the movement. + +Add `switch costume to`{:class="block3looks"} blocks to change how Flappy looks. + +\--- /hint \--- \--- hint \--- + +You need to use these blocks: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +repeat (5) + change y by (6) +end + +repeat (5) + change y by (6) +end + +switch costume to (wings up v) + +switch costume to (wings down v) + +when [space v] key pressed +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +switch costume to (wings down v) +repeat (5) + change y by (6) +end +switch costume to (wings up v) +repeat (5) + change y by (6) +end +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code. As you see, at the moment nothing happens if you let Flappy hit a pipe. + +\--- /task \--- \ No newline at end of file diff --git a/hu-HU/step_7.md b/hu-HU/step_7.md new file mode 100644 index 0000000..40a2720 --- /dev/null +++ b/hu-HU/step_7.md @@ -0,0 +1,77 @@ +## Detect collisions + +To make the game a challenge, the player needs to guide Flappy through the gaps without letting the parrot touch the pipes or the edges of the Stage. You need to add some blocks to detect when Flappy hits something. + +This is called **collision detection**. + +\--- task \--- + +Import a sound from the library that you want to play when Flappy collides with something. The 'screech' sound is a good choice. + +[[[generic-scratch3-sound-from-library]]] + +\--- /task \--- + +A `wait until`{:class="block3control"} block is necessart to check whether Flappy is `touching the pipes`{:class="block3sensing"} `or`{:class="block3operators"} `touching the edge`{:class="block3sensing"}. + +\--- task \--- + +Add a new `when green flag clicked`{:class="block3control"} block to the 'Flappy' sprite, and also add the following code: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) +``` + +\--- /task \--- + +\--- task \--- + +Test your code. If Flappy touches a pipe, the 'screech' sound should play. + +\--- /task \--- + +Next, update the code so that the game stops when Flappy hits a pipe. + +\--- task \--- + +Add the following code to stop the game after a collision is detected: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) ++ say [Game Over!] ++ broadcast (Game Over v) ++ stop [other scripts in sprite v] +``` + +The `broadcast`{:class="block3events"} block tells other sprites that the game is over. + +The `stop`{:class="block3control"} block stops other Flappy scripts that are running so that Flappy stops falling after a collision. + +\--- /task \--- + +\--- task \--- + +Finally, add the following code to the `Pipes` sprite so that pipes `stop`{:class="block3control"} appearing `when the sprite receives Game Over`{:class="block3events"}. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I receive [Game Over v] +stop [other scripts in sprite v] +``` + +\--- /task \--- + +\--- task \--- + +Test your game and see how long you can play before it's 'Game over'! + +\--- /task \--- \ No newline at end of file diff --git a/hu-HU/step_8.md b/hu-HU/step_8.md new file mode 100644 index 0000000..2c5cc08 --- /dev/null +++ b/hu-HU/step_8.md @@ -0,0 +1,116 @@ +## Add a score + +The player should score a point every time Flappy makes it through a gap between pipes. + +\--- task \--- + +Make a new variable **for all sprites** and call it `score`{:class="block3variables"}. + +[[[generic-scratch3-add-variable]]] + +\--- /task \--- + +Each 'Pipes' sprite clone should `wait until`{:class="block3control"} Flappy has flown past and then increase the `score`{:class="block3variables"}. + +\--- task \--- + +First, `set score to 0`{:class="block3variables"} when the game begins: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked ++ set [score v] to [0] +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +\--- /task \--- + +\--- task \--- + +Then add the following code to the `Pipes` sprite: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> +``` + +\--- /task \--- + +\--- task \--- + +Add more code so that, when Flappy's `x` position is greater than the pipe clone's `x` position, the `score`{:class="block3variables"} increases by `1` and a sound of your choice plays. + +You could use the 'pop' sound if you want, or add a sound from the library, for example 'bird'. + +\--- hints \--- + +\--- hint \--- + +You need to `wait until`{:class="block3control"} `Flappy's x position`{:class="block3sensing"} is `greater than (>)`{:class="block3operators"} the `x position`{:class="block3motion"} of `Pipes`. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone ++ wait until <> +``` + +Then `change score by 1`{:class="block3variables"} and `play a sound`{:class="block3sound"}. + +\--- /hint \--- + +\--- hint \--- + +Use these blocks in the correct order: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> + +play sound (pop v) + +change [score v] by (1) + +[x position v] of (Flappy v) + +x position + +() > () +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <([x position v] of (Flappy v)) > (x position)> +change [score v] by (1) +play sound (pop v) +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code and make sure you score a point every time Flappy gets through a gap between pipes. Check whether the `score`{:class="block3variables"} is set to `0` when you start a new game. + +\--- /task \--- \ No newline at end of file diff --git a/hu-HU/step_9.md b/hu-HU/step_9.md new file mode 100644 index 0000000..2f4e2e6 --- /dev/null +++ b/hu-HU/step_9.md @@ -0,0 +1,5 @@ +## Challenge: adjust the difficulty + +Is the game too hard or too easy for you? How many ways can you find to change the difficulty? + +Adjust the game until you are happy with its difficulty! \ No newline at end of file diff --git a/it-IT/images/banner.png b/it-IT/images/banner.png new file mode 100644 index 0000000..7a0da5b Binary files /dev/null and b/it-IT/images/banner.png differ diff --git a/it-IT/images/binary-showcase.png b/it-IT/images/binary-showcase.png new file mode 100644 index 0000000..499aa29 Binary files /dev/null and b/it-IT/images/binary-showcase.png differ diff --git a/it-IT/images/flappy-clones-test.png b/it-IT/images/flappy-clones-test.png new file mode 100644 index 0000000..f874059 Binary files /dev/null and b/it-IT/images/flappy-clones-test.png differ diff --git a/it-IT/images/flappy-falling.gif b/it-IT/images/flappy-falling.gif new file mode 100644 index 0000000..970d833 Binary files /dev/null and b/it-IT/images/flappy-falling.gif differ diff --git a/it-IT/images/flappy-flying.gif b/it-IT/images/flappy-flying.gif new file mode 100644 index 0000000..e259ff1 Binary files /dev/null and b/it-IT/images/flappy-flying.gif differ diff --git a/it-IT/images/flappy-height-test.png b/it-IT/images/flappy-height-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/it-IT/images/flappy-height-test.png differ diff --git a/it-IT/images/flappy-parrot-showcase.png b/it-IT/images/flappy-parrot-showcase.png new file mode 100644 index 0000000..493049b Binary files /dev/null and b/it-IT/images/flappy-parrot-showcase.png differ diff --git a/it-IT/images/flappy-pipes-duplicate1-annotated.png b/it-IT/images/flappy-pipes-duplicate1-annotated.png new file mode 100644 index 0000000..65e32c6 Binary files /dev/null and b/it-IT/images/flappy-pipes-duplicate1-annotated.png differ diff --git a/it-IT/images/flappy-pipes-duplicate1.png b/it-IT/images/flappy-pipes-duplicate1.png new file mode 100644 index 0000000..4239b67 Binary files /dev/null and b/it-IT/images/flappy-pipes-duplicate1.png differ diff --git a/it-IT/images/flappy-pipes-duplicate2.png b/it-IT/images/flappy-pipes-duplicate2.png new file mode 100644 index 0000000..ba1a69a Binary files /dev/null and b/it-IT/images/flappy-pipes-duplicate2.png differ diff --git a/it-IT/images/flappy-pipes-ends.png b/it-IT/images/flappy-pipes-ends.png new file mode 100644 index 0000000..ab59aaa Binary files /dev/null and b/it-IT/images/flappy-pipes-ends.png differ diff --git a/it-IT/images/flappy-pipes-fill-rectangle.png b/it-IT/images/flappy-pipes-fill-rectangle.png new file mode 100644 index 0000000..7360b87 Binary files /dev/null and b/it-IT/images/flappy-pipes-fill-rectangle.png differ diff --git a/it-IT/images/flappy-pipes-filled.png b/it-IT/images/flappy-pipes-filled.png new file mode 100644 index 0000000..7d2c0dd Binary files /dev/null and b/it-IT/images/flappy-pipes-filled.png differ diff --git a/it-IT/images/flappy-pipes-position.png b/it-IT/images/flappy-pipes-position.png new file mode 100644 index 0000000..ca2b810 Binary files /dev/null and b/it-IT/images/flappy-pipes-position.png differ diff --git a/it-IT/images/flappy-pipes-rectangle.png b/it-IT/images/flappy-pipes-rectangle.png new file mode 100644 index 0000000..6e3bf02 Binary files /dev/null and b/it-IT/images/flappy-pipes-rectangle.png differ diff --git a/it-IT/images/flappy-pipes-test.png b/it-IT/images/flappy-pipes-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/it-IT/images/flappy-pipes-test.png differ diff --git a/it-IT/images/flappy-setup.png b/it-IT/images/flappy-setup.png new file mode 100644 index 0000000..92f9eca Binary files /dev/null and b/it-IT/images/flappy-setup.png differ diff --git a/it-IT/images/flappy-sprite.png b/it-IT/images/flappy-sprite.png new file mode 100644 index 0000000..6a0c590 Binary files /dev/null and b/it-IT/images/flappy-sprite.png differ diff --git a/it-IT/images/flappy-stage.png b/it-IT/images/flappy-stage.png new file mode 100644 index 0000000..5efe03c Binary files /dev/null and b/it-IT/images/flappy-stage.png differ diff --git a/it-IT/images/flappy-starting-position.png b/it-IT/images/flappy-starting-position.png new file mode 100644 index 0000000..9089c9e Binary files /dev/null and b/it-IT/images/flappy-starting-position.png differ diff --git a/it-IT/images/flappy-wings.png b/it-IT/images/flappy-wings.png new file mode 100644 index 0000000..ef0aa8e Binary files /dev/null and b/it-IT/images/flappy-wings.png differ diff --git a/it-IT/images/pipes-sprite.png b/it-IT/images/pipes-sprite.png new file mode 100644 index 0000000..a9882ed Binary files /dev/null and b/it-IT/images/pipes-sprite.png differ diff --git a/it-IT/meta.yml b/it-IT/meta.yml new file mode 100644 index 0000000..c2fe5e6 --- /dev/null +++ b/it-IT/meta.yml @@ -0,0 +1,34 @@ +--- +title: Flappy parrot +hero_image: images/banner.png +description: Create a game in which you guide a parrot past moving obstacles +listed: true +copyedit: true +version: 4.1 +last_tested: 2018-10-90 +steps: + - + title: Introduction + - + title: Add the pipes + - + title: "Challenge: make better pipes" + challenge: true + - + title: Make the pipes move + - + title: Make Flappy fall + - + title: Make Flappy fly + - + title: Detect collisions + - + title: Add a score + - + title: 'Challenge: adjust the difficulty' + challenge: true + - + title: 'Challenge: add a high score' + challenge: true + - + title: What next? diff --git a/it-IT/scratch-translatable.txt b/it-IT/scratch-translatable.txt new file mode 100644 index 0000000..214e66c --- /dev/null +++ b/it-IT/scratch-translatable.txt @@ -0,0 +1,13 @@ +Pipes + +costume1 + +Flappy + +wings down + +wings up + +Game Over! + +score diff --git a/it-IT/solutions/FlappyParrot-Solution.sb3 b/it-IT/solutions/FlappyParrot-Solution.sb3 new file mode 100644 index 0000000..a0cd354 Binary files /dev/null and b/it-IT/solutions/FlappyParrot-Solution.sb3 differ diff --git a/it-IT/step_1.md b/it-IT/step_1.md new file mode 100644 index 0000000..f7519ae --- /dev/null +++ b/it-IT/step_1.md @@ -0,0 +1,69 @@ +\--- no-print \--- + +This is the **Scratch 3** version of the project. There is also a [Scratch 2 version of the project](https://projects.raspberrypi.org/en/projects/flappy-parrot-scratch2). + +\--- /no-print \--- + +## Introduction + +Create a game in which you have to guide a parrot past scrolling pipes to score points. + +### What you will make + +\--- no-print \--- + +Click the green flag to start the game. Press the space bar to make the parrot flap its wings, and try to get it to fly through the gaps in the pipes! You score one point for every pipe that you manage to get the parrot past. + +
+ + +
+ +\--- /no-print \--- + +\--- print-only \--- + +You will press the space bar to make the parrot flap its wings, and score one point for every pipe that you manage to get the parrot past. + +![flappy parrot game being played](images/flappy-parrot-showcase.png) + +\--- /print-only \--- + +## \--- collapse \--- + +## title: What you will need + +### Hardware + ++ A computer capable of running Scratch 3 + +### Software + ++ Scratch 3 (either [online](https://rpf.io/scratchon) or [offline](https://rpf.io/scratchoff)) + +\--- /collapse \--- + +## \--- collapse \--- + +## title: What you will learn + ++ How to create sprites using Vector mode ++ How to use sounds ++ How to detect collisions ++ How to control a sprite using the keyboard + +\--- /collapse \--- + +## \--- collapse \--- + +## title: Additional notes for educators + +\--- no-print \--- + +If you need to print this project, please use the [printer-friendly version](https://projects.raspberrypi.org/en/projects/flappy-parrot/print){:target="_blank"}. + +\--- /no-print \--- + +You can find the [completed project here](https://rpf.io/p/en/flappy-parrot-get). + +\--- /collapse \--- \ No newline at end of file diff --git a/it-IT/step_10.md b/it-IT/step_10.md new file mode 100644 index 0000000..a5808f3 --- /dev/null +++ b/it-IT/step_10.md @@ -0,0 +1,9 @@ +## Challenge: add a high score + +\--- challenge \--- + +Can you add a high score to the game so that, in addition to keeping track of score for the current round, it keeps track of the highest score you've ever reached? + +[[[generic-scratch3-high-score]]] + +\--- /challenge \--- \ No newline at end of file diff --git a/it-IT/step_11.md b/it-IT/step_11.md new file mode 100644 index 0000000..02ae229 --- /dev/null +++ b/it-IT/step_11.md @@ -0,0 +1,19 @@ +## What next? + +Try the [Binary hero](https://projects.raspberrypi.org/en/projects/binary-hero?utm_source=pathway&utm_medium=whatnext&utm_campaign=projects) project, where you will make a game in which you play the notes of a song as they scroll down the Stage. + +\--- no-print \--- + +Click the green flag to start the game. Use the z, x, c, and v keys to play the correct notes when these reach the bottom of the Stage. You'll score ten points for every correct note you play. + +
+ +
+ +\--- /no-print \--- + +\--- print-only \--- + +The notes will fall from above, and you will have to press keys to "catch" and play the notes. ![showcase](images/binary-showcase.png) + +\--- /print-only \--- \ No newline at end of file diff --git a/it-IT/step_2.md b/it-IT/step_2.md new file mode 100644 index 0000000..d8f2ce5 --- /dev/null +++ b/it-IT/step_2.md @@ -0,0 +1,84 @@ +## Add the pipes + +First, create the pipes. + +\--- task \--- + +Open a new empty Scratch project. + +[[[generic-scratch3-new-project]]] + +\--- /task \--- + +\--- task \--- + +Add a backdrop with an outdoor landscape. 'Blue Sky' is a good choice. + +![screenshot](images/flappy-stage.png) + +[[[generic-scratch3-backdrop-from-library]]] + +\--- /task \--- + +\--- task \--- + +Create a new sprite and name it 'Pipes'. + +[[[generic-scratch3-draw-sprite]]] + +\--- /task \--- + +The 'Pipes' sprite should be a pair of pipes with a gap in the middle. By moving the sprite up or down, you can put the gap in a different place. + +This picture shows an example of how the pipes could be positioned. The parts of the sprite outside the Stage are normally hidden, you only see then when you drag the sprite: + +![screenshot](images/flappy-pipes-position.png) + +You can't draw a sprite as big as the pipes need to be, but you can increase the size at which the sprite shows on the Stage. + +\--- task \--- + +![pipes sprite](images/pipes-sprite.png) + +Add code to make the sprite bigger. + +```blocks3 +when green flag clicked +set size to (200) % +``` + +This makes it's easier to see how big the pipes should be. + +\--- /task \--- + +\--- task \--- + +Draw a rectangle for the top pipe as shown here: + +![rectangle for the pipe](images/flappy-pipes-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Fill the pipe with a colour you like. + +![fill the rectangle](images/flappy-pipes-fill-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Create a duplicate of the pipe by selecting it and then clicking on **Copy** and **Paste**. + +![copy and paste pipe](images/flappy-pipes-duplicate1-annotated.png) + +\--- /task \--- + +\--- task \--- + +Drag the copy of the pipe to the bottom of the screen so that the copy is in line with the other pipe. There needs to be a gap between the two pipes. + +![screenshot](images/flappy-pipes-duplicate2.png) + +\--- /task \--- \ No newline at end of file diff --git a/it-IT/step_3.md b/it-IT/step_3.md new file mode 100644 index 0000000..17f05f7 --- /dev/null +++ b/it-IT/step_3.md @@ -0,0 +1,11 @@ +## Challenge: make better pipes + +Can you make your pipes look better? + ++ Shade your pipes with a left-to-right gradient. + +![screenshot](images/flappy-pipes-filled.png) + ++ Add extra rectangles to the ends of the pipes: + +![screenshot](images/flappy-pipes-ends.png) \ No newline at end of file diff --git a/it-IT/step_4.md b/it-IT/step_4.md new file mode 100644 index 0000000..2beedd9 --- /dev/null +++ b/it-IT/step_4.md @@ -0,0 +1,65 @@ +## Make the pipes move + +Next you're going to make the pipes move across the screen to create an obstacle course. + +![pipes moving across the screen](images/flappy-clones-test.png) + +\--- task \--- + +First make the pipes appear by adding code to the Pipes sprite so that, `when the green flag is clicked`{:class="block3events"}, the sprite `forever`{:class="block3control"} `creates a clone of itself`{:class="block3control"} every two seconds. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +**Tip:** clones are just copies of a sprite, and they are really useful for creating games. + +\--- /task \--- + +\--- task \--- + +Next make the pipes move by adding code so that, `when a clone starts`{:class="block3control"}, the clone appears on the right side of the Stage and `glides`{:class="block3motion"} across to the left. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show +go to x: (240) y: (0) +glide (4) secs to x: (-240) y: (0) +delete this clone +``` + +**Tip:** you can stop the pipes scrolling by clicking the red **stop** button next to the green flag. + +\--- /task \--- + +Now you should have lots of pipes, but their gaps are always in the same place. + +You can add some variety by using a `random`{:class="block3operators"} number for the Pipes sprite's `y position`{:class="block3motion"}. + +![pipes at different heights](images/flappy-height-test.png) + +\--- task \--- + +Modify your sprite's code so that each sprite clone `picks a random number from -80 to 80`{:class="block3operators"} and `glides`{:class="block3motion"} to that `y position`{:class="block3motion"}: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show ++ go to x: (240) y: (pick random (-80) to (80)) ++ glide (4) secs to x: (-240) y: (y position) +delete this clone +``` + +\--- /task \--- \ No newline at end of file diff --git a/it-IT/step_5.md b/it-IT/step_5.md new file mode 100644 index 0000000..f9d79ce --- /dev/null +++ b/it-IT/step_5.md @@ -0,0 +1,77 @@ +## Make Flappy fall + +Now add a sprite called Flappy and create code it so Flappy falls down the Stage. In the next step, you will add the code to make Flappy fly when you press a key. + +\--- no-print \--- + +![flappy falling animation](images/flappy-falling.gif) + +\--- /no-print \--- + +\--- task \--- + +Add a new sprite that has two costumes, for 'wings up' and 'wings down', and name it `Flappy`. + +The parrot sprite is a good choice. + +![parrot sprite](images/flappy-sprite.png) + +\--- /task \--- + +Flappy needs to be smaller. + +\--- task \--- + +Add code to `set Flappy's size to 25%`{:class="block3looks"} `when the green flag is clicked`{:class="block3events"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +``` + +\--- /task \--- + +When the game starts, Flappy needs to be just left of the centre of the Stage, at coordinates `-50, 0`. + +![flappy shown at the start position](images/flappy-starting-position.png) + +\--- task \--- + +Add code to make Flappy `go to the x and y`{:class="block3motion"} starting position of `x: -50`{:class="block3motion"} and `y: 0`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % ++ go to x: (-50) y: (0) +``` + +[[[generic-scratch3-set-coordinates]]] + +\--- /task \--- + +\--- task \--- + +Now make Flappy keep falling down the Stage by `forever`{:class="block3control"} `changing the sprite's y position by -3`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +go to x: (-50) y: (0) ++ forever + change y by (-3) +end +``` + +\--- /task \--- + +\--- task \--- + +Test your code to make sure Flappy starts in the middle of the screen and falls to the bottom. When you drag Flappy to the top of the Stage, the sprite should fall again. + +\--- /task \--- \ No newline at end of file diff --git a/it-IT/step_6.md b/it-IT/step_6.md new file mode 100644 index 0000000..1a98cb2 --- /dev/null +++ b/it-IT/step_6.md @@ -0,0 +1,106 @@ +## Make Flappy fly + +Now you will make Flappy flap upwards when you press the space bar. When you play the game, you have to time your taps to get Flappy through the gaps in the pipes. + +\--- no-print \--- + +![flappy flying upwards when space bar is pressed](images/flappy-flying.gif) + +\--- /no-print \--- + +Make Flappy fly upwards when you tap the space bar. + +\--- task \--- + +When the `space key is pressed`{:class="block3events"}, Flappy should move upwards by `changing its y coordinate`{:class="block3motion"} by a small amount, for example `6`. + +Flappy flies upwards by `repeating`{:class="block3control"} this movement `10 times`{:class="block3control"}. + +Add this code to your `Flappy` sprite: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +repeat (10) + change y by (6) +end +``` + +\--- /task \--- + +Now you need to get Flappy's wings flapping! + +\--- task \--- + +Click on the **Costumes** tab, and name Flappy's costumes 'wings up' and 'wings down'. + +![naming the costumes](images/flappy-wings.png) + +\--- /task \--- + +\--- task \--- + +Can you make Flappy's costume change to `wings down` when you press space, and then change it back to `wings up` halfway through the upward movement? + +\--- hints \--- + +\--- hint \--- + +You need to split the upward motion in half so that you can use two `repeat`{:class="block3control"} blocks to change Flappy's costume at the beginning and in the middle of the movement. + +Add `switch costume to`{:class="block3looks"} blocks to change how Flappy looks. + +\--- /hint \--- \--- hint \--- + +You need to use these blocks: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +repeat (5) + change y by (6) +end + +repeat (5) + change y by (6) +end + +switch costume to (wings up v) + +switch costume to (wings down v) + +when [space v] key pressed +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +switch costume to (wings down v) +repeat (5) + change y by (6) +end +switch costume to (wings up v) +repeat (5) + change y by (6) +end +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code. As you see, at the moment nothing happens if you let Flappy hit a pipe. + +\--- /task \--- \ No newline at end of file diff --git a/it-IT/step_7.md b/it-IT/step_7.md new file mode 100644 index 0000000..40a2720 --- /dev/null +++ b/it-IT/step_7.md @@ -0,0 +1,77 @@ +## Detect collisions + +To make the game a challenge, the player needs to guide Flappy through the gaps without letting the parrot touch the pipes or the edges of the Stage. You need to add some blocks to detect when Flappy hits something. + +This is called **collision detection**. + +\--- task \--- + +Import a sound from the library that you want to play when Flappy collides with something. The 'screech' sound is a good choice. + +[[[generic-scratch3-sound-from-library]]] + +\--- /task \--- + +A `wait until`{:class="block3control"} block is necessart to check whether Flappy is `touching the pipes`{:class="block3sensing"} `or`{:class="block3operators"} `touching the edge`{:class="block3sensing"}. + +\--- task \--- + +Add a new `when green flag clicked`{:class="block3control"} block to the 'Flappy' sprite, and also add the following code: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) +``` + +\--- /task \--- + +\--- task \--- + +Test your code. If Flappy touches a pipe, the 'screech' sound should play. + +\--- /task \--- + +Next, update the code so that the game stops when Flappy hits a pipe. + +\--- task \--- + +Add the following code to stop the game after a collision is detected: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) ++ say [Game Over!] ++ broadcast (Game Over v) ++ stop [other scripts in sprite v] +``` + +The `broadcast`{:class="block3events"} block tells other sprites that the game is over. + +The `stop`{:class="block3control"} block stops other Flappy scripts that are running so that Flappy stops falling after a collision. + +\--- /task \--- + +\--- task \--- + +Finally, add the following code to the `Pipes` sprite so that pipes `stop`{:class="block3control"} appearing `when the sprite receives Game Over`{:class="block3events"}. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I receive [Game Over v] +stop [other scripts in sprite v] +``` + +\--- /task \--- + +\--- task \--- + +Test your game and see how long you can play before it's 'Game over'! + +\--- /task \--- \ No newline at end of file diff --git a/it-IT/step_8.md b/it-IT/step_8.md new file mode 100644 index 0000000..2c5cc08 --- /dev/null +++ b/it-IT/step_8.md @@ -0,0 +1,116 @@ +## Add a score + +The player should score a point every time Flappy makes it through a gap between pipes. + +\--- task \--- + +Make a new variable **for all sprites** and call it `score`{:class="block3variables"}. + +[[[generic-scratch3-add-variable]]] + +\--- /task \--- + +Each 'Pipes' sprite clone should `wait until`{:class="block3control"} Flappy has flown past and then increase the `score`{:class="block3variables"}. + +\--- task \--- + +First, `set score to 0`{:class="block3variables"} when the game begins: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked ++ set [score v] to [0] +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +\--- /task \--- + +\--- task \--- + +Then add the following code to the `Pipes` sprite: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> +``` + +\--- /task \--- + +\--- task \--- + +Add more code so that, when Flappy's `x` position is greater than the pipe clone's `x` position, the `score`{:class="block3variables"} increases by `1` and a sound of your choice plays. + +You could use the 'pop' sound if you want, or add a sound from the library, for example 'bird'. + +\--- hints \--- + +\--- hint \--- + +You need to `wait until`{:class="block3control"} `Flappy's x position`{:class="block3sensing"} is `greater than (>)`{:class="block3operators"} the `x position`{:class="block3motion"} of `Pipes`. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone ++ wait until <> +``` + +Then `change score by 1`{:class="block3variables"} and `play a sound`{:class="block3sound"}. + +\--- /hint \--- + +\--- hint \--- + +Use these blocks in the correct order: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> + +play sound (pop v) + +change [score v] by (1) + +[x position v] of (Flappy v) + +x position + +() > () +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <([x position v] of (Flappy v)) > (x position)> +change [score v] by (1) +play sound (pop v) +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code and make sure you score a point every time Flappy gets through a gap between pipes. Check whether the `score`{:class="block3variables"} is set to `0` when you start a new game. + +\--- /task \--- \ No newline at end of file diff --git a/it-IT/step_9.md b/it-IT/step_9.md new file mode 100644 index 0000000..2f4e2e6 --- /dev/null +++ b/it-IT/step_9.md @@ -0,0 +1,5 @@ +## Challenge: adjust the difficulty + +Is the game too hard or too easy for you? How many ways can you find to change the difficulty? + +Adjust the game until you are happy with its difficulty! \ No newline at end of file diff --git a/ja-JP/images/banner.png b/ja-JP/images/banner.png new file mode 100644 index 0000000..7a0da5b Binary files /dev/null and b/ja-JP/images/banner.png differ diff --git a/ja-JP/images/binary-showcase.png b/ja-JP/images/binary-showcase.png new file mode 100644 index 0000000..499aa29 Binary files /dev/null and b/ja-JP/images/binary-showcase.png differ diff --git a/ja-JP/images/flappy-clones-test.png b/ja-JP/images/flappy-clones-test.png new file mode 100644 index 0000000..f874059 Binary files /dev/null and b/ja-JP/images/flappy-clones-test.png differ diff --git a/ja-JP/images/flappy-falling.gif b/ja-JP/images/flappy-falling.gif new file mode 100644 index 0000000..970d833 Binary files /dev/null and b/ja-JP/images/flappy-falling.gif differ diff --git a/ja-JP/images/flappy-flying.gif b/ja-JP/images/flappy-flying.gif new file mode 100644 index 0000000..e259ff1 Binary files /dev/null and b/ja-JP/images/flappy-flying.gif differ diff --git a/ja-JP/images/flappy-height-test.png b/ja-JP/images/flappy-height-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/ja-JP/images/flappy-height-test.png differ diff --git a/ja-JP/images/flappy-parrot-showcase.png b/ja-JP/images/flappy-parrot-showcase.png new file mode 100644 index 0000000..493049b Binary files /dev/null and b/ja-JP/images/flappy-parrot-showcase.png differ diff --git a/ja-JP/images/flappy-pipes-duplicate1-annotated.png b/ja-JP/images/flappy-pipes-duplicate1-annotated.png new file mode 100644 index 0000000..65e32c6 Binary files /dev/null and b/ja-JP/images/flappy-pipes-duplicate1-annotated.png differ diff --git a/ja-JP/images/flappy-pipes-duplicate1.png b/ja-JP/images/flappy-pipes-duplicate1.png new file mode 100644 index 0000000..4239b67 Binary files /dev/null and b/ja-JP/images/flappy-pipes-duplicate1.png differ diff --git a/ja-JP/images/flappy-pipes-duplicate2.png b/ja-JP/images/flappy-pipes-duplicate2.png new file mode 100644 index 0000000..ba1a69a Binary files /dev/null and b/ja-JP/images/flappy-pipes-duplicate2.png differ diff --git a/ja-JP/images/flappy-pipes-ends.png b/ja-JP/images/flappy-pipes-ends.png new file mode 100644 index 0000000..ab59aaa Binary files /dev/null and b/ja-JP/images/flappy-pipes-ends.png differ diff --git a/ja-JP/images/flappy-pipes-fill-rectangle.png b/ja-JP/images/flappy-pipes-fill-rectangle.png new file mode 100644 index 0000000..7360b87 Binary files /dev/null and b/ja-JP/images/flappy-pipes-fill-rectangle.png differ diff --git a/ja-JP/images/flappy-pipes-filled.png b/ja-JP/images/flappy-pipes-filled.png new file mode 100644 index 0000000..7d2c0dd Binary files /dev/null and b/ja-JP/images/flappy-pipes-filled.png differ diff --git a/ja-JP/images/flappy-pipes-position.png b/ja-JP/images/flappy-pipes-position.png new file mode 100644 index 0000000..ca2b810 Binary files /dev/null and b/ja-JP/images/flappy-pipes-position.png differ diff --git a/ja-JP/images/flappy-pipes-rectangle.png b/ja-JP/images/flappy-pipes-rectangle.png new file mode 100644 index 0000000..6e3bf02 Binary files /dev/null and b/ja-JP/images/flappy-pipes-rectangle.png differ diff --git a/ja-JP/images/flappy-pipes-test.png b/ja-JP/images/flappy-pipes-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/ja-JP/images/flappy-pipes-test.png differ diff --git a/ja-JP/images/flappy-setup.png b/ja-JP/images/flappy-setup.png new file mode 100644 index 0000000..92f9eca Binary files /dev/null and b/ja-JP/images/flappy-setup.png differ diff --git a/ja-JP/images/flappy-sprite.png b/ja-JP/images/flappy-sprite.png new file mode 100644 index 0000000..6a0c590 Binary files /dev/null and b/ja-JP/images/flappy-sprite.png differ diff --git a/ja-JP/images/flappy-stage.png b/ja-JP/images/flappy-stage.png new file mode 100644 index 0000000..5efe03c Binary files /dev/null and b/ja-JP/images/flappy-stage.png differ diff --git a/ja-JP/images/flappy-starting-position.png b/ja-JP/images/flappy-starting-position.png new file mode 100644 index 0000000..9089c9e Binary files /dev/null and b/ja-JP/images/flappy-starting-position.png differ diff --git a/ja-JP/images/flappy-wings.png b/ja-JP/images/flappy-wings.png new file mode 100644 index 0000000..ef0aa8e Binary files /dev/null and b/ja-JP/images/flappy-wings.png differ diff --git a/ja-JP/images/pipes-sprite.png b/ja-JP/images/pipes-sprite.png new file mode 100644 index 0000000..a9882ed Binary files /dev/null and b/ja-JP/images/pipes-sprite.png differ diff --git a/ja-JP/meta.yml b/ja-JP/meta.yml new file mode 100644 index 0000000..c2fe5e6 --- /dev/null +++ b/ja-JP/meta.yml @@ -0,0 +1,34 @@ +--- +title: Flappy parrot +hero_image: images/banner.png +description: Create a game in which you guide a parrot past moving obstacles +listed: true +copyedit: true +version: 4.1 +last_tested: 2018-10-90 +steps: + - + title: Introduction + - + title: Add the pipes + - + title: "Challenge: make better pipes" + challenge: true + - + title: Make the pipes move + - + title: Make Flappy fall + - + title: Make Flappy fly + - + title: Detect collisions + - + title: Add a score + - + title: 'Challenge: adjust the difficulty' + challenge: true + - + title: 'Challenge: add a high score' + challenge: true + - + title: What next? diff --git a/ja-JP/scratch-translatable.txt b/ja-JP/scratch-translatable.txt new file mode 100644 index 0000000..214e66c --- /dev/null +++ b/ja-JP/scratch-translatable.txt @@ -0,0 +1,13 @@ +Pipes + +costume1 + +Flappy + +wings down + +wings up + +Game Over! + +score diff --git a/ja-JP/solutions/FlappyParrot-Solution.sb3 b/ja-JP/solutions/FlappyParrot-Solution.sb3 new file mode 100644 index 0000000..a0cd354 Binary files /dev/null and b/ja-JP/solutions/FlappyParrot-Solution.sb3 differ diff --git a/ja-JP/step_1.md b/ja-JP/step_1.md new file mode 100644 index 0000000..f7519ae --- /dev/null +++ b/ja-JP/step_1.md @@ -0,0 +1,69 @@ +\--- no-print \--- + +This is the **Scratch 3** version of the project. There is also a [Scratch 2 version of the project](https://projects.raspberrypi.org/en/projects/flappy-parrot-scratch2). + +\--- /no-print \--- + +## Introduction + +Create a game in which you have to guide a parrot past scrolling pipes to score points. + +### What you will make + +\--- no-print \--- + +Click the green flag to start the game. Press the space bar to make the parrot flap its wings, and try to get it to fly through the gaps in the pipes! You score one point for every pipe that you manage to get the parrot past. + +
+ + +
+ +\--- /no-print \--- + +\--- print-only \--- + +You will press the space bar to make the parrot flap its wings, and score one point for every pipe that you manage to get the parrot past. + +![flappy parrot game being played](images/flappy-parrot-showcase.png) + +\--- /print-only \--- + +## \--- collapse \--- + +## title: What you will need + +### Hardware + ++ A computer capable of running Scratch 3 + +### Software + ++ Scratch 3 (either [online](https://rpf.io/scratchon) or [offline](https://rpf.io/scratchoff)) + +\--- /collapse \--- + +## \--- collapse \--- + +## title: What you will learn + ++ How to create sprites using Vector mode ++ How to use sounds ++ How to detect collisions ++ How to control a sprite using the keyboard + +\--- /collapse \--- + +## \--- collapse \--- + +## title: Additional notes for educators + +\--- no-print \--- + +If you need to print this project, please use the [printer-friendly version](https://projects.raspberrypi.org/en/projects/flappy-parrot/print){:target="_blank"}. + +\--- /no-print \--- + +You can find the [completed project here](https://rpf.io/p/en/flappy-parrot-get). + +\--- /collapse \--- \ No newline at end of file diff --git a/ja-JP/step_10.md b/ja-JP/step_10.md new file mode 100644 index 0000000..a5808f3 --- /dev/null +++ b/ja-JP/step_10.md @@ -0,0 +1,9 @@ +## Challenge: add a high score + +\--- challenge \--- + +Can you add a high score to the game so that, in addition to keeping track of score for the current round, it keeps track of the highest score you've ever reached? + +[[[generic-scratch3-high-score]]] + +\--- /challenge \--- \ No newline at end of file diff --git a/ja-JP/step_11.md b/ja-JP/step_11.md new file mode 100644 index 0000000..02ae229 --- /dev/null +++ b/ja-JP/step_11.md @@ -0,0 +1,19 @@ +## What next? + +Try the [Binary hero](https://projects.raspberrypi.org/en/projects/binary-hero?utm_source=pathway&utm_medium=whatnext&utm_campaign=projects) project, where you will make a game in which you play the notes of a song as they scroll down the Stage. + +\--- no-print \--- + +Click the green flag to start the game. Use the z, x, c, and v keys to play the correct notes when these reach the bottom of the Stage. You'll score ten points for every correct note you play. + +
+ +
+ +\--- /no-print \--- + +\--- print-only \--- + +The notes will fall from above, and you will have to press keys to "catch" and play the notes. ![showcase](images/binary-showcase.png) + +\--- /print-only \--- \ No newline at end of file diff --git a/ja-JP/step_2.md b/ja-JP/step_2.md new file mode 100644 index 0000000..d8f2ce5 --- /dev/null +++ b/ja-JP/step_2.md @@ -0,0 +1,84 @@ +## Add the pipes + +First, create the pipes. + +\--- task \--- + +Open a new empty Scratch project. + +[[[generic-scratch3-new-project]]] + +\--- /task \--- + +\--- task \--- + +Add a backdrop with an outdoor landscape. 'Blue Sky' is a good choice. + +![screenshot](images/flappy-stage.png) + +[[[generic-scratch3-backdrop-from-library]]] + +\--- /task \--- + +\--- task \--- + +Create a new sprite and name it 'Pipes'. + +[[[generic-scratch3-draw-sprite]]] + +\--- /task \--- + +The 'Pipes' sprite should be a pair of pipes with a gap in the middle. By moving the sprite up or down, you can put the gap in a different place. + +This picture shows an example of how the pipes could be positioned. The parts of the sprite outside the Stage are normally hidden, you only see then when you drag the sprite: + +![screenshot](images/flappy-pipes-position.png) + +You can't draw a sprite as big as the pipes need to be, but you can increase the size at which the sprite shows on the Stage. + +\--- task \--- + +![pipes sprite](images/pipes-sprite.png) + +Add code to make the sprite bigger. + +```blocks3 +when green flag clicked +set size to (200) % +``` + +This makes it's easier to see how big the pipes should be. + +\--- /task \--- + +\--- task \--- + +Draw a rectangle for the top pipe as shown here: + +![rectangle for the pipe](images/flappy-pipes-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Fill the pipe with a colour you like. + +![fill the rectangle](images/flappy-pipes-fill-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Create a duplicate of the pipe by selecting it and then clicking on **Copy** and **Paste**. + +![copy and paste pipe](images/flappy-pipes-duplicate1-annotated.png) + +\--- /task \--- + +\--- task \--- + +Drag the copy of the pipe to the bottom of the screen so that the copy is in line with the other pipe. There needs to be a gap between the two pipes. + +![screenshot](images/flappy-pipes-duplicate2.png) + +\--- /task \--- \ No newline at end of file diff --git a/ja-JP/step_3.md b/ja-JP/step_3.md new file mode 100644 index 0000000..17f05f7 --- /dev/null +++ b/ja-JP/step_3.md @@ -0,0 +1,11 @@ +## Challenge: make better pipes + +Can you make your pipes look better? + ++ Shade your pipes with a left-to-right gradient. + +![screenshot](images/flappy-pipes-filled.png) + ++ Add extra rectangles to the ends of the pipes: + +![screenshot](images/flappy-pipes-ends.png) \ No newline at end of file diff --git a/ja-JP/step_4.md b/ja-JP/step_4.md new file mode 100644 index 0000000..2beedd9 --- /dev/null +++ b/ja-JP/step_4.md @@ -0,0 +1,65 @@ +## Make the pipes move + +Next you're going to make the pipes move across the screen to create an obstacle course. + +![pipes moving across the screen](images/flappy-clones-test.png) + +\--- task \--- + +First make the pipes appear by adding code to the Pipes sprite so that, `when the green flag is clicked`{:class="block3events"}, the sprite `forever`{:class="block3control"} `creates a clone of itself`{:class="block3control"} every two seconds. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +**Tip:** clones are just copies of a sprite, and they are really useful for creating games. + +\--- /task \--- + +\--- task \--- + +Next make the pipes move by adding code so that, `when a clone starts`{:class="block3control"}, the clone appears on the right side of the Stage and `glides`{:class="block3motion"} across to the left. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show +go to x: (240) y: (0) +glide (4) secs to x: (-240) y: (0) +delete this clone +``` + +**Tip:** you can stop the pipes scrolling by clicking the red **stop** button next to the green flag. + +\--- /task \--- + +Now you should have lots of pipes, but their gaps are always in the same place. + +You can add some variety by using a `random`{:class="block3operators"} number for the Pipes sprite's `y position`{:class="block3motion"}. + +![pipes at different heights](images/flappy-height-test.png) + +\--- task \--- + +Modify your sprite's code so that each sprite clone `picks a random number from -80 to 80`{:class="block3operators"} and `glides`{:class="block3motion"} to that `y position`{:class="block3motion"}: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show ++ go to x: (240) y: (pick random (-80) to (80)) ++ glide (4) secs to x: (-240) y: (y position) +delete this clone +``` + +\--- /task \--- \ No newline at end of file diff --git a/ja-JP/step_5.md b/ja-JP/step_5.md new file mode 100644 index 0000000..f9d79ce --- /dev/null +++ b/ja-JP/step_5.md @@ -0,0 +1,77 @@ +## Make Flappy fall + +Now add a sprite called Flappy and create code it so Flappy falls down the Stage. In the next step, you will add the code to make Flappy fly when you press a key. + +\--- no-print \--- + +![flappy falling animation](images/flappy-falling.gif) + +\--- /no-print \--- + +\--- task \--- + +Add a new sprite that has two costumes, for 'wings up' and 'wings down', and name it `Flappy`. + +The parrot sprite is a good choice. + +![parrot sprite](images/flappy-sprite.png) + +\--- /task \--- + +Flappy needs to be smaller. + +\--- task \--- + +Add code to `set Flappy's size to 25%`{:class="block3looks"} `when the green flag is clicked`{:class="block3events"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +``` + +\--- /task \--- + +When the game starts, Flappy needs to be just left of the centre of the Stage, at coordinates `-50, 0`. + +![flappy shown at the start position](images/flappy-starting-position.png) + +\--- task \--- + +Add code to make Flappy `go to the x and y`{:class="block3motion"} starting position of `x: -50`{:class="block3motion"} and `y: 0`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % ++ go to x: (-50) y: (0) +``` + +[[[generic-scratch3-set-coordinates]]] + +\--- /task \--- + +\--- task \--- + +Now make Flappy keep falling down the Stage by `forever`{:class="block3control"} `changing the sprite's y position by -3`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +go to x: (-50) y: (0) ++ forever + change y by (-3) +end +``` + +\--- /task \--- + +\--- task \--- + +Test your code to make sure Flappy starts in the middle of the screen and falls to the bottom. When you drag Flappy to the top of the Stage, the sprite should fall again. + +\--- /task \--- \ No newline at end of file diff --git a/ja-JP/step_6.md b/ja-JP/step_6.md new file mode 100644 index 0000000..1a98cb2 --- /dev/null +++ b/ja-JP/step_6.md @@ -0,0 +1,106 @@ +## Make Flappy fly + +Now you will make Flappy flap upwards when you press the space bar. When you play the game, you have to time your taps to get Flappy through the gaps in the pipes. + +\--- no-print \--- + +![flappy flying upwards when space bar is pressed](images/flappy-flying.gif) + +\--- /no-print \--- + +Make Flappy fly upwards when you tap the space bar. + +\--- task \--- + +When the `space key is pressed`{:class="block3events"}, Flappy should move upwards by `changing its y coordinate`{:class="block3motion"} by a small amount, for example `6`. + +Flappy flies upwards by `repeating`{:class="block3control"} this movement `10 times`{:class="block3control"}. + +Add this code to your `Flappy` sprite: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +repeat (10) + change y by (6) +end +``` + +\--- /task \--- + +Now you need to get Flappy's wings flapping! + +\--- task \--- + +Click on the **Costumes** tab, and name Flappy's costumes 'wings up' and 'wings down'. + +![naming the costumes](images/flappy-wings.png) + +\--- /task \--- + +\--- task \--- + +Can you make Flappy's costume change to `wings down` when you press space, and then change it back to `wings up` halfway through the upward movement? + +\--- hints \--- + +\--- hint \--- + +You need to split the upward motion in half so that you can use two `repeat`{:class="block3control"} blocks to change Flappy's costume at the beginning and in the middle of the movement. + +Add `switch costume to`{:class="block3looks"} blocks to change how Flappy looks. + +\--- /hint \--- \--- hint \--- + +You need to use these blocks: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +repeat (5) + change y by (6) +end + +repeat (5) + change y by (6) +end + +switch costume to (wings up v) + +switch costume to (wings down v) + +when [space v] key pressed +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +switch costume to (wings down v) +repeat (5) + change y by (6) +end +switch costume to (wings up v) +repeat (5) + change y by (6) +end +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code. As you see, at the moment nothing happens if you let Flappy hit a pipe. + +\--- /task \--- \ No newline at end of file diff --git a/ja-JP/step_7.md b/ja-JP/step_7.md new file mode 100644 index 0000000..40a2720 --- /dev/null +++ b/ja-JP/step_7.md @@ -0,0 +1,77 @@ +## Detect collisions + +To make the game a challenge, the player needs to guide Flappy through the gaps without letting the parrot touch the pipes or the edges of the Stage. You need to add some blocks to detect when Flappy hits something. + +This is called **collision detection**. + +\--- task \--- + +Import a sound from the library that you want to play when Flappy collides with something. The 'screech' sound is a good choice. + +[[[generic-scratch3-sound-from-library]]] + +\--- /task \--- + +A `wait until`{:class="block3control"} block is necessart to check whether Flappy is `touching the pipes`{:class="block3sensing"} `or`{:class="block3operators"} `touching the edge`{:class="block3sensing"}. + +\--- task \--- + +Add a new `when green flag clicked`{:class="block3control"} block to the 'Flappy' sprite, and also add the following code: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) +``` + +\--- /task \--- + +\--- task \--- + +Test your code. If Flappy touches a pipe, the 'screech' sound should play. + +\--- /task \--- + +Next, update the code so that the game stops when Flappy hits a pipe. + +\--- task \--- + +Add the following code to stop the game after a collision is detected: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) ++ say [Game Over!] ++ broadcast (Game Over v) ++ stop [other scripts in sprite v] +``` + +The `broadcast`{:class="block3events"} block tells other sprites that the game is over. + +The `stop`{:class="block3control"} block stops other Flappy scripts that are running so that Flappy stops falling after a collision. + +\--- /task \--- + +\--- task \--- + +Finally, add the following code to the `Pipes` sprite so that pipes `stop`{:class="block3control"} appearing `when the sprite receives Game Over`{:class="block3events"}. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I receive [Game Over v] +stop [other scripts in sprite v] +``` + +\--- /task \--- + +\--- task \--- + +Test your game and see how long you can play before it's 'Game over'! + +\--- /task \--- \ No newline at end of file diff --git a/ja-JP/step_8.md b/ja-JP/step_8.md new file mode 100644 index 0000000..2c5cc08 --- /dev/null +++ b/ja-JP/step_8.md @@ -0,0 +1,116 @@ +## Add a score + +The player should score a point every time Flappy makes it through a gap between pipes. + +\--- task \--- + +Make a new variable **for all sprites** and call it `score`{:class="block3variables"}. + +[[[generic-scratch3-add-variable]]] + +\--- /task \--- + +Each 'Pipes' sprite clone should `wait until`{:class="block3control"} Flappy has flown past and then increase the `score`{:class="block3variables"}. + +\--- task \--- + +First, `set score to 0`{:class="block3variables"} when the game begins: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked ++ set [score v] to [0] +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +\--- /task \--- + +\--- task \--- + +Then add the following code to the `Pipes` sprite: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> +``` + +\--- /task \--- + +\--- task \--- + +Add more code so that, when Flappy's `x` position is greater than the pipe clone's `x` position, the `score`{:class="block3variables"} increases by `1` and a sound of your choice plays. + +You could use the 'pop' sound if you want, or add a sound from the library, for example 'bird'. + +\--- hints \--- + +\--- hint \--- + +You need to `wait until`{:class="block3control"} `Flappy's x position`{:class="block3sensing"} is `greater than (>)`{:class="block3operators"} the `x position`{:class="block3motion"} of `Pipes`. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone ++ wait until <> +``` + +Then `change score by 1`{:class="block3variables"} and `play a sound`{:class="block3sound"}. + +\--- /hint \--- + +\--- hint \--- + +Use these blocks in the correct order: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> + +play sound (pop v) + +change [score v] by (1) + +[x position v] of (Flappy v) + +x position + +() > () +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <([x position v] of (Flappy v)) > (x position)> +change [score v] by (1) +play sound (pop v) +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code and make sure you score a point every time Flappy gets through a gap between pipes. Check whether the `score`{:class="block3variables"} is set to `0` when you start a new game. + +\--- /task \--- \ No newline at end of file diff --git a/ja-JP/step_9.md b/ja-JP/step_9.md new file mode 100644 index 0000000..2f4e2e6 --- /dev/null +++ b/ja-JP/step_9.md @@ -0,0 +1,5 @@ +## Challenge: adjust the difficulty + +Is the game too hard or too easy for you? How many ways can you find to change the difficulty? + +Adjust the game until you are happy with its difficulty! \ No newline at end of file diff --git a/ko-KR/images/banner.png b/ko-KR/images/banner.png new file mode 100644 index 0000000..7a0da5b Binary files /dev/null and b/ko-KR/images/banner.png differ diff --git a/ko-KR/images/binary-showcase.png b/ko-KR/images/binary-showcase.png new file mode 100644 index 0000000..499aa29 Binary files /dev/null and b/ko-KR/images/binary-showcase.png differ diff --git a/ko-KR/images/flappy-clones-test.png b/ko-KR/images/flappy-clones-test.png new file mode 100644 index 0000000..f874059 Binary files /dev/null and b/ko-KR/images/flappy-clones-test.png differ diff --git a/ko-KR/images/flappy-falling.gif b/ko-KR/images/flappy-falling.gif new file mode 100644 index 0000000..970d833 Binary files /dev/null and b/ko-KR/images/flappy-falling.gif differ diff --git a/ko-KR/images/flappy-flying.gif b/ko-KR/images/flappy-flying.gif new file mode 100644 index 0000000..e259ff1 Binary files /dev/null and b/ko-KR/images/flappy-flying.gif differ diff --git a/ko-KR/images/flappy-height-test.png b/ko-KR/images/flappy-height-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/ko-KR/images/flappy-height-test.png differ diff --git a/ko-KR/images/flappy-parrot-showcase.png b/ko-KR/images/flappy-parrot-showcase.png new file mode 100644 index 0000000..493049b Binary files /dev/null and b/ko-KR/images/flappy-parrot-showcase.png differ diff --git a/ko-KR/images/flappy-pipes-duplicate1-annotated.png b/ko-KR/images/flappy-pipes-duplicate1-annotated.png new file mode 100644 index 0000000..65e32c6 Binary files /dev/null and b/ko-KR/images/flappy-pipes-duplicate1-annotated.png differ diff --git a/ko-KR/images/flappy-pipes-duplicate1.png b/ko-KR/images/flappy-pipes-duplicate1.png new file mode 100644 index 0000000..4239b67 Binary files /dev/null and b/ko-KR/images/flappy-pipes-duplicate1.png differ diff --git a/ko-KR/images/flappy-pipes-duplicate2.png b/ko-KR/images/flappy-pipes-duplicate2.png new file mode 100644 index 0000000..ba1a69a Binary files /dev/null and b/ko-KR/images/flappy-pipes-duplicate2.png differ diff --git a/ko-KR/images/flappy-pipes-ends.png b/ko-KR/images/flappy-pipes-ends.png new file mode 100644 index 0000000..ab59aaa Binary files /dev/null and b/ko-KR/images/flappy-pipes-ends.png differ diff --git a/ko-KR/images/flappy-pipes-fill-rectangle.png b/ko-KR/images/flappy-pipes-fill-rectangle.png new file mode 100644 index 0000000..7360b87 Binary files /dev/null and b/ko-KR/images/flappy-pipes-fill-rectangle.png differ diff --git a/ko-KR/images/flappy-pipes-filled.png b/ko-KR/images/flappy-pipes-filled.png new file mode 100644 index 0000000..7d2c0dd Binary files /dev/null and b/ko-KR/images/flappy-pipes-filled.png differ diff --git a/ko-KR/images/flappy-pipes-position.png b/ko-KR/images/flappy-pipes-position.png new file mode 100644 index 0000000..ca2b810 Binary files /dev/null and b/ko-KR/images/flappy-pipes-position.png differ diff --git a/ko-KR/images/flappy-pipes-rectangle.png b/ko-KR/images/flappy-pipes-rectangle.png new file mode 100644 index 0000000..6e3bf02 Binary files /dev/null and b/ko-KR/images/flappy-pipes-rectangle.png differ diff --git a/ko-KR/images/flappy-pipes-test.png b/ko-KR/images/flappy-pipes-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/ko-KR/images/flappy-pipes-test.png differ diff --git a/ko-KR/images/flappy-setup.png b/ko-KR/images/flappy-setup.png new file mode 100644 index 0000000..92f9eca Binary files /dev/null and b/ko-KR/images/flappy-setup.png differ diff --git a/ko-KR/images/flappy-sprite.png b/ko-KR/images/flappy-sprite.png new file mode 100644 index 0000000..6a0c590 Binary files /dev/null and b/ko-KR/images/flappy-sprite.png differ diff --git a/ko-KR/images/flappy-stage.png b/ko-KR/images/flappy-stage.png new file mode 100644 index 0000000..5efe03c Binary files /dev/null and b/ko-KR/images/flappy-stage.png differ diff --git a/ko-KR/images/flappy-starting-position.png b/ko-KR/images/flappy-starting-position.png new file mode 100644 index 0000000..9089c9e Binary files /dev/null and b/ko-KR/images/flappy-starting-position.png differ diff --git a/ko-KR/images/flappy-wings.png b/ko-KR/images/flappy-wings.png new file mode 100644 index 0000000..ef0aa8e Binary files /dev/null and b/ko-KR/images/flappy-wings.png differ diff --git a/ko-KR/images/pipes-sprite.png b/ko-KR/images/pipes-sprite.png new file mode 100644 index 0000000..a9882ed Binary files /dev/null and b/ko-KR/images/pipes-sprite.png differ diff --git a/ko-KR/meta.yml b/ko-KR/meta.yml new file mode 100644 index 0000000..c2fe5e6 --- /dev/null +++ b/ko-KR/meta.yml @@ -0,0 +1,34 @@ +--- +title: Flappy parrot +hero_image: images/banner.png +description: Create a game in which you guide a parrot past moving obstacles +listed: true +copyedit: true +version: 4.1 +last_tested: 2018-10-90 +steps: + - + title: Introduction + - + title: Add the pipes + - + title: "Challenge: make better pipes" + challenge: true + - + title: Make the pipes move + - + title: Make Flappy fall + - + title: Make Flappy fly + - + title: Detect collisions + - + title: Add a score + - + title: 'Challenge: adjust the difficulty' + challenge: true + - + title: 'Challenge: add a high score' + challenge: true + - + title: What next? diff --git a/ko-KR/scratch-translatable.txt b/ko-KR/scratch-translatable.txt new file mode 100644 index 0000000..214e66c --- /dev/null +++ b/ko-KR/scratch-translatable.txt @@ -0,0 +1,13 @@ +Pipes + +costume1 + +Flappy + +wings down + +wings up + +Game Over! + +score diff --git a/ko-KR/solutions/FlappyParrot-Solution.sb3 b/ko-KR/solutions/FlappyParrot-Solution.sb3 new file mode 100644 index 0000000..a0cd354 Binary files /dev/null and b/ko-KR/solutions/FlappyParrot-Solution.sb3 differ diff --git a/ko-KR/step_1.md b/ko-KR/step_1.md new file mode 100644 index 0000000..f7519ae --- /dev/null +++ b/ko-KR/step_1.md @@ -0,0 +1,69 @@ +\--- no-print \--- + +This is the **Scratch 3** version of the project. There is also a [Scratch 2 version of the project](https://projects.raspberrypi.org/en/projects/flappy-parrot-scratch2). + +\--- /no-print \--- + +## Introduction + +Create a game in which you have to guide a parrot past scrolling pipes to score points. + +### What you will make + +\--- no-print \--- + +Click the green flag to start the game. Press the space bar to make the parrot flap its wings, and try to get it to fly through the gaps in the pipes! You score one point for every pipe that you manage to get the parrot past. + +
+ + +
+ +\--- /no-print \--- + +\--- print-only \--- + +You will press the space bar to make the parrot flap its wings, and score one point for every pipe that you manage to get the parrot past. + +![flappy parrot game being played](images/flappy-parrot-showcase.png) + +\--- /print-only \--- + +## \--- collapse \--- + +## title: What you will need + +### Hardware + ++ A computer capable of running Scratch 3 + +### Software + ++ Scratch 3 (either [online](https://rpf.io/scratchon) or [offline](https://rpf.io/scratchoff)) + +\--- /collapse \--- + +## \--- collapse \--- + +## title: What you will learn + ++ How to create sprites using Vector mode ++ How to use sounds ++ How to detect collisions ++ How to control a sprite using the keyboard + +\--- /collapse \--- + +## \--- collapse \--- + +## title: Additional notes for educators + +\--- no-print \--- + +If you need to print this project, please use the [printer-friendly version](https://projects.raspberrypi.org/en/projects/flappy-parrot/print){:target="_blank"}. + +\--- /no-print \--- + +You can find the [completed project here](https://rpf.io/p/en/flappy-parrot-get). + +\--- /collapse \--- \ No newline at end of file diff --git a/ko-KR/step_10.md b/ko-KR/step_10.md new file mode 100644 index 0000000..a5808f3 --- /dev/null +++ b/ko-KR/step_10.md @@ -0,0 +1,9 @@ +## Challenge: add a high score + +\--- challenge \--- + +Can you add a high score to the game so that, in addition to keeping track of score for the current round, it keeps track of the highest score you've ever reached? + +[[[generic-scratch3-high-score]]] + +\--- /challenge \--- \ No newline at end of file diff --git a/ko-KR/step_11.md b/ko-KR/step_11.md new file mode 100644 index 0000000..02ae229 --- /dev/null +++ b/ko-KR/step_11.md @@ -0,0 +1,19 @@ +## What next? + +Try the [Binary hero](https://projects.raspberrypi.org/en/projects/binary-hero?utm_source=pathway&utm_medium=whatnext&utm_campaign=projects) project, where you will make a game in which you play the notes of a song as they scroll down the Stage. + +\--- no-print \--- + +Click the green flag to start the game. Use the z, x, c, and v keys to play the correct notes when these reach the bottom of the Stage. You'll score ten points for every correct note you play. + +
+ +
+ +\--- /no-print \--- + +\--- print-only \--- + +The notes will fall from above, and you will have to press keys to "catch" and play the notes. ![showcase](images/binary-showcase.png) + +\--- /print-only \--- \ No newline at end of file diff --git a/ko-KR/step_2.md b/ko-KR/step_2.md new file mode 100644 index 0000000..d8f2ce5 --- /dev/null +++ b/ko-KR/step_2.md @@ -0,0 +1,84 @@ +## Add the pipes + +First, create the pipes. + +\--- task \--- + +Open a new empty Scratch project. + +[[[generic-scratch3-new-project]]] + +\--- /task \--- + +\--- task \--- + +Add a backdrop with an outdoor landscape. 'Blue Sky' is a good choice. + +![screenshot](images/flappy-stage.png) + +[[[generic-scratch3-backdrop-from-library]]] + +\--- /task \--- + +\--- task \--- + +Create a new sprite and name it 'Pipes'. + +[[[generic-scratch3-draw-sprite]]] + +\--- /task \--- + +The 'Pipes' sprite should be a pair of pipes with a gap in the middle. By moving the sprite up or down, you can put the gap in a different place. + +This picture shows an example of how the pipes could be positioned. The parts of the sprite outside the Stage are normally hidden, you only see then when you drag the sprite: + +![screenshot](images/flappy-pipes-position.png) + +You can't draw a sprite as big as the pipes need to be, but you can increase the size at which the sprite shows on the Stage. + +\--- task \--- + +![pipes sprite](images/pipes-sprite.png) + +Add code to make the sprite bigger. + +```blocks3 +when green flag clicked +set size to (200) % +``` + +This makes it's easier to see how big the pipes should be. + +\--- /task \--- + +\--- task \--- + +Draw a rectangle for the top pipe as shown here: + +![rectangle for the pipe](images/flappy-pipes-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Fill the pipe with a colour you like. + +![fill the rectangle](images/flappy-pipes-fill-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Create a duplicate of the pipe by selecting it and then clicking on **Copy** and **Paste**. + +![copy and paste pipe](images/flappy-pipes-duplicate1-annotated.png) + +\--- /task \--- + +\--- task \--- + +Drag the copy of the pipe to the bottom of the screen so that the copy is in line with the other pipe. There needs to be a gap between the two pipes. + +![screenshot](images/flappy-pipes-duplicate2.png) + +\--- /task \--- \ No newline at end of file diff --git a/ko-KR/step_3.md b/ko-KR/step_3.md new file mode 100644 index 0000000..17f05f7 --- /dev/null +++ b/ko-KR/step_3.md @@ -0,0 +1,11 @@ +## Challenge: make better pipes + +Can you make your pipes look better? + ++ Shade your pipes with a left-to-right gradient. + +![screenshot](images/flappy-pipes-filled.png) + ++ Add extra rectangles to the ends of the pipes: + +![screenshot](images/flappy-pipes-ends.png) \ No newline at end of file diff --git a/ko-KR/step_4.md b/ko-KR/step_4.md new file mode 100644 index 0000000..2beedd9 --- /dev/null +++ b/ko-KR/step_4.md @@ -0,0 +1,65 @@ +## Make the pipes move + +Next you're going to make the pipes move across the screen to create an obstacle course. + +![pipes moving across the screen](images/flappy-clones-test.png) + +\--- task \--- + +First make the pipes appear by adding code to the Pipes sprite so that, `when the green flag is clicked`{:class="block3events"}, the sprite `forever`{:class="block3control"} `creates a clone of itself`{:class="block3control"} every two seconds. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +**Tip:** clones are just copies of a sprite, and they are really useful for creating games. + +\--- /task \--- + +\--- task \--- + +Next make the pipes move by adding code so that, `when a clone starts`{:class="block3control"}, the clone appears on the right side of the Stage and `glides`{:class="block3motion"} across to the left. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show +go to x: (240) y: (0) +glide (4) secs to x: (-240) y: (0) +delete this clone +``` + +**Tip:** you can stop the pipes scrolling by clicking the red **stop** button next to the green flag. + +\--- /task \--- + +Now you should have lots of pipes, but their gaps are always in the same place. + +You can add some variety by using a `random`{:class="block3operators"} number for the Pipes sprite's `y position`{:class="block3motion"}. + +![pipes at different heights](images/flappy-height-test.png) + +\--- task \--- + +Modify your sprite's code so that each sprite clone `picks a random number from -80 to 80`{:class="block3operators"} and `glides`{:class="block3motion"} to that `y position`{:class="block3motion"}: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show ++ go to x: (240) y: (pick random (-80) to (80)) ++ glide (4) secs to x: (-240) y: (y position) +delete this clone +``` + +\--- /task \--- \ No newline at end of file diff --git a/ko-KR/step_5.md b/ko-KR/step_5.md new file mode 100644 index 0000000..f9d79ce --- /dev/null +++ b/ko-KR/step_5.md @@ -0,0 +1,77 @@ +## Make Flappy fall + +Now add a sprite called Flappy and create code it so Flappy falls down the Stage. In the next step, you will add the code to make Flappy fly when you press a key. + +\--- no-print \--- + +![flappy falling animation](images/flappy-falling.gif) + +\--- /no-print \--- + +\--- task \--- + +Add a new sprite that has two costumes, for 'wings up' and 'wings down', and name it `Flappy`. + +The parrot sprite is a good choice. + +![parrot sprite](images/flappy-sprite.png) + +\--- /task \--- + +Flappy needs to be smaller. + +\--- task \--- + +Add code to `set Flappy's size to 25%`{:class="block3looks"} `when the green flag is clicked`{:class="block3events"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +``` + +\--- /task \--- + +When the game starts, Flappy needs to be just left of the centre of the Stage, at coordinates `-50, 0`. + +![flappy shown at the start position](images/flappy-starting-position.png) + +\--- task \--- + +Add code to make Flappy `go to the x and y`{:class="block3motion"} starting position of `x: -50`{:class="block3motion"} and `y: 0`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % ++ go to x: (-50) y: (0) +``` + +[[[generic-scratch3-set-coordinates]]] + +\--- /task \--- + +\--- task \--- + +Now make Flappy keep falling down the Stage by `forever`{:class="block3control"} `changing the sprite's y position by -3`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +go to x: (-50) y: (0) ++ forever + change y by (-3) +end +``` + +\--- /task \--- + +\--- task \--- + +Test your code to make sure Flappy starts in the middle of the screen and falls to the bottom. When you drag Flappy to the top of the Stage, the sprite should fall again. + +\--- /task \--- \ No newline at end of file diff --git a/ko-KR/step_6.md b/ko-KR/step_6.md new file mode 100644 index 0000000..1a98cb2 --- /dev/null +++ b/ko-KR/step_6.md @@ -0,0 +1,106 @@ +## Make Flappy fly + +Now you will make Flappy flap upwards when you press the space bar. When you play the game, you have to time your taps to get Flappy through the gaps in the pipes. + +\--- no-print \--- + +![flappy flying upwards when space bar is pressed](images/flappy-flying.gif) + +\--- /no-print \--- + +Make Flappy fly upwards when you tap the space bar. + +\--- task \--- + +When the `space key is pressed`{:class="block3events"}, Flappy should move upwards by `changing its y coordinate`{:class="block3motion"} by a small amount, for example `6`. + +Flappy flies upwards by `repeating`{:class="block3control"} this movement `10 times`{:class="block3control"}. + +Add this code to your `Flappy` sprite: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +repeat (10) + change y by (6) +end +``` + +\--- /task \--- + +Now you need to get Flappy's wings flapping! + +\--- task \--- + +Click on the **Costumes** tab, and name Flappy's costumes 'wings up' and 'wings down'. + +![naming the costumes](images/flappy-wings.png) + +\--- /task \--- + +\--- task \--- + +Can you make Flappy's costume change to `wings down` when you press space, and then change it back to `wings up` halfway through the upward movement? + +\--- hints \--- + +\--- hint \--- + +You need to split the upward motion in half so that you can use two `repeat`{:class="block3control"} blocks to change Flappy's costume at the beginning and in the middle of the movement. + +Add `switch costume to`{:class="block3looks"} blocks to change how Flappy looks. + +\--- /hint \--- \--- hint \--- + +You need to use these blocks: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +repeat (5) + change y by (6) +end + +repeat (5) + change y by (6) +end + +switch costume to (wings up v) + +switch costume to (wings down v) + +when [space v] key pressed +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +switch costume to (wings down v) +repeat (5) + change y by (6) +end +switch costume to (wings up v) +repeat (5) + change y by (6) +end +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code. As you see, at the moment nothing happens if you let Flappy hit a pipe. + +\--- /task \--- \ No newline at end of file diff --git a/ko-KR/step_7.md b/ko-KR/step_7.md new file mode 100644 index 0000000..40a2720 --- /dev/null +++ b/ko-KR/step_7.md @@ -0,0 +1,77 @@ +## Detect collisions + +To make the game a challenge, the player needs to guide Flappy through the gaps without letting the parrot touch the pipes or the edges of the Stage. You need to add some blocks to detect when Flappy hits something. + +This is called **collision detection**. + +\--- task \--- + +Import a sound from the library that you want to play when Flappy collides with something. The 'screech' sound is a good choice. + +[[[generic-scratch3-sound-from-library]]] + +\--- /task \--- + +A `wait until`{:class="block3control"} block is necessart to check whether Flappy is `touching the pipes`{:class="block3sensing"} `or`{:class="block3operators"} `touching the edge`{:class="block3sensing"}. + +\--- task \--- + +Add a new `when green flag clicked`{:class="block3control"} block to the 'Flappy' sprite, and also add the following code: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) +``` + +\--- /task \--- + +\--- task \--- + +Test your code. If Flappy touches a pipe, the 'screech' sound should play. + +\--- /task \--- + +Next, update the code so that the game stops when Flappy hits a pipe. + +\--- task \--- + +Add the following code to stop the game after a collision is detected: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) ++ say [Game Over!] ++ broadcast (Game Over v) ++ stop [other scripts in sprite v] +``` + +The `broadcast`{:class="block3events"} block tells other sprites that the game is over. + +The `stop`{:class="block3control"} block stops other Flappy scripts that are running so that Flappy stops falling after a collision. + +\--- /task \--- + +\--- task \--- + +Finally, add the following code to the `Pipes` sprite so that pipes `stop`{:class="block3control"} appearing `when the sprite receives Game Over`{:class="block3events"}. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I receive [Game Over v] +stop [other scripts in sprite v] +``` + +\--- /task \--- + +\--- task \--- + +Test your game and see how long you can play before it's 'Game over'! + +\--- /task \--- \ No newline at end of file diff --git a/ko-KR/step_8.md b/ko-KR/step_8.md new file mode 100644 index 0000000..2c5cc08 --- /dev/null +++ b/ko-KR/step_8.md @@ -0,0 +1,116 @@ +## Add a score + +The player should score a point every time Flappy makes it through a gap between pipes. + +\--- task \--- + +Make a new variable **for all sprites** and call it `score`{:class="block3variables"}. + +[[[generic-scratch3-add-variable]]] + +\--- /task \--- + +Each 'Pipes' sprite clone should `wait until`{:class="block3control"} Flappy has flown past and then increase the `score`{:class="block3variables"}. + +\--- task \--- + +First, `set score to 0`{:class="block3variables"} when the game begins: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked ++ set [score v] to [0] +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +\--- /task \--- + +\--- task \--- + +Then add the following code to the `Pipes` sprite: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> +``` + +\--- /task \--- + +\--- task \--- + +Add more code so that, when Flappy's `x` position is greater than the pipe clone's `x` position, the `score`{:class="block3variables"} increases by `1` and a sound of your choice plays. + +You could use the 'pop' sound if you want, or add a sound from the library, for example 'bird'. + +\--- hints \--- + +\--- hint \--- + +You need to `wait until`{:class="block3control"} `Flappy's x position`{:class="block3sensing"} is `greater than (>)`{:class="block3operators"} the `x position`{:class="block3motion"} of `Pipes`. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone ++ wait until <> +``` + +Then `change score by 1`{:class="block3variables"} and `play a sound`{:class="block3sound"}. + +\--- /hint \--- + +\--- hint \--- + +Use these blocks in the correct order: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> + +play sound (pop v) + +change [score v] by (1) + +[x position v] of (Flappy v) + +x position + +() > () +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <([x position v] of (Flappy v)) > (x position)> +change [score v] by (1) +play sound (pop v) +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code and make sure you score a point every time Flappy gets through a gap between pipes. Check whether the `score`{:class="block3variables"} is set to `0` when you start a new game. + +\--- /task \--- \ No newline at end of file diff --git a/ko-KR/step_9.md b/ko-KR/step_9.md new file mode 100644 index 0000000..2f4e2e6 --- /dev/null +++ b/ko-KR/step_9.md @@ -0,0 +1,5 @@ +## Challenge: adjust the difficulty + +Is the game too hard or too easy for you? How many ways can you find to change the difficulty? + +Adjust the game until you are happy with its difficulty! \ No newline at end of file diff --git a/nl-NL/images/banner.png b/nl-NL/images/banner.png new file mode 100644 index 0000000..7a0da5b Binary files /dev/null and b/nl-NL/images/banner.png differ diff --git a/nl-NL/images/binary-showcase.png b/nl-NL/images/binary-showcase.png new file mode 100644 index 0000000..499aa29 Binary files /dev/null and b/nl-NL/images/binary-showcase.png differ diff --git a/nl-NL/images/flappy-clones-test.png b/nl-NL/images/flappy-clones-test.png new file mode 100644 index 0000000..f874059 Binary files /dev/null and b/nl-NL/images/flappy-clones-test.png differ diff --git a/nl-NL/images/flappy-falling.gif b/nl-NL/images/flappy-falling.gif new file mode 100644 index 0000000..970d833 Binary files /dev/null and b/nl-NL/images/flappy-falling.gif differ diff --git a/nl-NL/images/flappy-flying.gif b/nl-NL/images/flappy-flying.gif new file mode 100644 index 0000000..e259ff1 Binary files /dev/null and b/nl-NL/images/flappy-flying.gif differ diff --git a/nl-NL/images/flappy-height-test.png b/nl-NL/images/flappy-height-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/nl-NL/images/flappy-height-test.png differ diff --git a/nl-NL/images/flappy-parrot-showcase.png b/nl-NL/images/flappy-parrot-showcase.png new file mode 100644 index 0000000..493049b Binary files /dev/null and b/nl-NL/images/flappy-parrot-showcase.png differ diff --git a/nl-NL/images/flappy-pipes-duplicate1-annotated.png b/nl-NL/images/flappy-pipes-duplicate1-annotated.png new file mode 100644 index 0000000..3226d7d Binary files /dev/null and b/nl-NL/images/flappy-pipes-duplicate1-annotated.png differ diff --git a/nl-NL/images/flappy-pipes-duplicate1.png b/nl-NL/images/flappy-pipes-duplicate1.png new file mode 100644 index 0000000..4ddb6f6 Binary files /dev/null and b/nl-NL/images/flappy-pipes-duplicate1.png differ diff --git a/nl-NL/images/flappy-pipes-duplicate2.png b/nl-NL/images/flappy-pipes-duplicate2.png new file mode 100644 index 0000000..047529f Binary files /dev/null and b/nl-NL/images/flappy-pipes-duplicate2.png differ diff --git a/nl-NL/images/flappy-pipes-ends.png b/nl-NL/images/flappy-pipes-ends.png new file mode 100644 index 0000000..ab59aaa Binary files /dev/null and b/nl-NL/images/flappy-pipes-ends.png differ diff --git a/nl-NL/images/flappy-pipes-fill-rectangle.png b/nl-NL/images/flappy-pipes-fill-rectangle.png new file mode 100644 index 0000000..216fcde Binary files /dev/null and b/nl-NL/images/flappy-pipes-fill-rectangle.png differ diff --git a/nl-NL/images/flappy-pipes-filled.png b/nl-NL/images/flappy-pipes-filled.png new file mode 100644 index 0000000..0b93d7f Binary files /dev/null and b/nl-NL/images/flappy-pipes-filled.png differ diff --git a/nl-NL/images/flappy-pipes-position.png b/nl-NL/images/flappy-pipes-position.png new file mode 100644 index 0000000..ca2b810 Binary files /dev/null and b/nl-NL/images/flappy-pipes-position.png differ diff --git a/nl-NL/images/flappy-pipes-rectangle.png b/nl-NL/images/flappy-pipes-rectangle.png new file mode 100644 index 0000000..a92801d Binary files /dev/null and b/nl-NL/images/flappy-pipes-rectangle.png differ diff --git a/nl-NL/images/flappy-pipes-test.png b/nl-NL/images/flappy-pipes-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/nl-NL/images/flappy-pipes-test.png differ diff --git a/nl-NL/images/flappy-setup.png b/nl-NL/images/flappy-setup.png new file mode 100644 index 0000000..92f9eca Binary files /dev/null and b/nl-NL/images/flappy-setup.png differ diff --git a/nl-NL/images/flappy-sprite.png b/nl-NL/images/flappy-sprite.png new file mode 100644 index 0000000..6a0c590 Binary files /dev/null and b/nl-NL/images/flappy-sprite.png differ diff --git a/nl-NL/images/flappy-stage.png b/nl-NL/images/flappy-stage.png new file mode 100644 index 0000000..5efe03c Binary files /dev/null and b/nl-NL/images/flappy-stage.png differ diff --git a/nl-NL/images/flappy-starting-position.png b/nl-NL/images/flappy-starting-position.png new file mode 100644 index 0000000..9089c9e Binary files /dev/null and b/nl-NL/images/flappy-starting-position.png differ diff --git a/nl-NL/images/flappy-wings.png b/nl-NL/images/flappy-wings.png new file mode 100644 index 0000000..0beaa3c Binary files /dev/null and b/nl-NL/images/flappy-wings.png differ diff --git a/nl-NL/images/pipes-sprite.png b/nl-NL/images/pipes-sprite.png new file mode 100644 index 0000000..a9882ed Binary files /dev/null and b/nl-NL/images/pipes-sprite.png differ diff --git a/nl-NL/meta.yml b/nl-NL/meta.yml new file mode 100644 index 0000000..a2b9250 --- /dev/null +++ b/nl-NL/meta.yml @@ -0,0 +1,34 @@ +--- +title: Fladderende papegaai +hero_image: images/banner.png +description: Maak een spel waarin je een papegaai langs bewegende obstakels leidt +listed: true +copyedit: true +version: 4.1 +last_tested: 2018-10-90 +steps: + - + title: Inleiding + - + title: Voeg de pijpen toe + - + title: "Uitdaging: betere pijpen maken" + challenge: true + - + title: Laat de pijpen bewegen + - + title: Laat Flappy vallen + - + title: Laat Flappy vliegen + - + title: Neem botsingen waar + - + title: Een score toevoegen + - + title: 'Uitdaging: pas de moeilijkheidsgraad aan' + challenge: true + - + title: 'Uitdaging: voeg een topscore toe' + challenge: true + - + title: Wat kun je verder nog doen? diff --git a/nl-NL/scratch-translatable.txt b/nl-NL/scratch-translatable.txt new file mode 100644 index 0000000..6f7c6ac --- /dev/null +++ b/nl-NL/scratch-translatable.txt @@ -0,0 +1,13 @@ +Pijpen + +uiterlijk1 + +Flappy + +wings-down + +wings-up + +Game Over! + +score diff --git a/nl-NL/solutions/FlappyParrot-Solution.sb3 b/nl-NL/solutions/FlappyParrot-Solution.sb3 new file mode 100644 index 0000000..233326f Binary files /dev/null and b/nl-NL/solutions/FlappyParrot-Solution.sb3 differ diff --git a/nl-NL/step_1.md b/nl-NL/step_1.md new file mode 100644 index 0000000..33a4e8d --- /dev/null +++ b/nl-NL/step_1.md @@ -0,0 +1,69 @@ +\--- no-print \--- + +Dit is de **Scratch 3** versie van het project. Er is ook een [Scratch 2 versie van dit project](https://projects.raspberrypi.org/en/projects/flappy-parrot-scratch2). + +\--- /no-print \--- + +## Inleiding + +Maak een spel waarin je een papegaai langs schuivende pijpen moet leiden om punten te scoren. + +### Wat ga je maken + +\--- no-print \--- + +Klik op de groene vlag om het spel te starten. Druk op spatiebalk om de papegaai zijn vleugels te laten fladderen en probeer hem door de ruimtes tussen de pijpen te laten vliegen! Je scoort een punt als je de papegaai voorbij een pijp krijgt. + +
+ + +
+ +\--- /no-print \--- + +\--- print-only \--- + +Je drukt op de spatiebalk om de papegaai zijn vleugels te laten fladderen, en scoor één punt als je de papegaai voorbij de pijpen krijgt. + +![fladderende papegaaienspel dat wordt gespeeld](images/flappy-parrot-showcase.png) + +\--- /print-only \--- + +## \--- collapse \--- + +## title: Wat heb je nodig + +### Hardware + ++ Een computer die Scratch 3 kan uitvoeren + +### Software + ++ Scratch 3 (of [online](https://rpf.io/scratchon) of [offline](https://rpf.io/scratchoff)) + +\--- /collapse \--- + +## \--- collapse \--- + +## title: Wat ga je leren + ++ Sprites maken met de Vector-modus ++ Hoe geluiden te gebruiken ++ Hoe botsingen waar te nemen ++ Hoe een sprite te besturen met behulp van het toetsenbord + +\--- /collapse \--- + +## \--- collapse \--- + +## title: Aanvullende informatie voor docenten + +\--- no-print \--- + +Als je dit project wilt afdrukken, gebruik dan de [printervriendelijke versie](https://projects.raspberrypi.org/en/projects/flappy-parrot/print){:target="_ blank"}. + +\--- /no-print \--- + +Hier kun je het [voltooide project](https://rpf.io/p/en/flappy-parrot-get) downloaden. + +\--- /collapse \--- \ No newline at end of file diff --git a/nl-NL/step_10.md b/nl-NL/step_10.md new file mode 100644 index 0000000..1e92e9a --- /dev/null +++ b/nl-NL/step_10.md @@ -0,0 +1,9 @@ +## Uitdaging: voeg een topscore toe + +\--- challenge \--- + +Kun je een topscore toevoegen aan het spel zodat het, naast het bijhouden van de score voor de huidige ronde, de hoogste score bijhoudt die je ooit hebt bereikt? + +[[[generic-scratch3-high-score]]] + +\--- /challenge \--- \ No newline at end of file diff --git a/nl-NL/step_11.md b/nl-NL/step_11.md new file mode 100644 index 0000000..997844a --- /dev/null +++ b/nl-NL/step_11.md @@ -0,0 +1,19 @@ +## Wat kun je verder nog doen? + +Probeer het project [Binaire held](https://projects.raspberrypi.org/en/projects/binary-hero?utm_source=pathway&utm_medium=whatnext&utm_campaign=projects), waarin je een spel maakt waarin je de noten van een nummer speelt terwijl ze over het speelveld bewegen. + +\--- no-print \--- + +Klik op de groene vlag om het spel te starten. Gebruik de toetsen z, x, c en v om de juiste noten te spelen wanneer deze de onderkant van het speelveld bereiken. Je scoort tien punten voor elke juiste noot die je speelt. + +
+ +
+ +\--- /no-print \--- + +\--- print-only \--- + +De noten vallen van boven en je moet op toetsen drukken om de noten te "vangen" en te spelen. ![etalage](images/binary-showcase.png) + +\--- /print-only \--- \ No newline at end of file diff --git a/nl-NL/step_2.md b/nl-NL/step_2.md new file mode 100644 index 0000000..cee6fcb --- /dev/null +++ b/nl-NL/step_2.md @@ -0,0 +1,84 @@ +## Voeg de pijpen toe + +Maak eerst de pijpen. + +\--- task \--- + +Open een nieuw leeg Scratch project. + +[[[generic-scratch3-new-project]]] + +\--- /task \--- + +\--- task \--- + +Voeg een achtergrond toe met een buitenlandschap. 'Blue Sky' is een goede keuze. + +![schermafbeelding](images/flappy-stage.png) + +[[[generic-scratch3-backdrop-from-library]]] + +\--- /task \--- + +\--- task \--- + +Maak een nieuwe sprite en noem deze 'Pipes'. + +[[[generic-scratch3-draw-sprite]]] + +\--- /task \--- + +De sprite 'Pipes' moet een paar pijpen zijn met een opening in het midden. Door de sprite omhoog of omlaag te bewegen, kun je de opening op een andere plek plaatsen. + +Deze afbeelding toont een voorbeeld van hoe de pijpen kunnen worden geplaatst. De delen van de sprite buiten het speelveld zijn normaal verborgen, je ziet ze alleen als je de sprite sleept: + +![schermafbeelding](images/flappy-pipes-position.png) + +Je kunt een sprite niet net zo groot maken als de pijpen, maar je kunt de grootte vergroten waarmee de sprite in het speelveld wordt weergegeven. + +\--- task \--- + +![pijpen sprite](images/pipes-sprite.png) + +Voeg code toe om de sprite groter te maken. + +```blocks3 +wanneer op de groene vlag wordt geklikt +maak grootte (200) % +``` + +Dit maakt het gemakkelijker om te zien hoe groot de pijpen moeten zijn. + +\--- /task \--- + +\--- task \--- + +Teken een rechthoek voor de bovenste pijp zoals dit: + +![rechthoek voor de pijp](images/flappy-pipes-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Vul de pijp met een kleur die je leuk vindt. + +![vul de rechthoek](images/flappy-pipes-fill-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Maak een kopie van de pijp door deze te selecteren en vervolgens te klikken op **Kopiëren** en **Plakken**. + +![pijp kopiëren en plakken](images/flappy-pipes-duplicate1-annotated.png) + +\--- /task \--- + +\--- task \--- + +Sleep de kopie van de pijp naar de onderkant van het scherm zodat de kopie in lijn is met de andere pijp. Er moet een opening zijn tussen de twee pijpen. + +![schermafbeelding](images/flappy-pipes-duplicate2.png) + +\--- /task \--- \ No newline at end of file diff --git a/nl-NL/step_3.md b/nl-NL/step_3.md new file mode 100644 index 0000000..48e4e9c --- /dev/null +++ b/nl-NL/step_3.md @@ -0,0 +1,11 @@ +## Uitdaging: betere pijpen maken + +Kun jij je pijpen er beter uit laten zien? + ++ Verfraai je pijpen met een geleidelijke kleurovergang van links naar rechts. + +![schermafbeelding](images/flappy-pipes-filled.png) + ++ Voeg extra rechthoeken toe aan de uiteinden van de pijpen: + +![schermafbeelding](images/flappy-pipes-ends.png) \ No newline at end of file diff --git a/nl-NL/step_4.md b/nl-NL/step_4.md new file mode 100644 index 0000000..654bea3 --- /dev/null +++ b/nl-NL/step_4.md @@ -0,0 +1,65 @@ +## Laat de pijpen bewegen + +Vervolgens ga je de pijpen over het scherm laten bewegen om een hindernisbaan te maken. + +![pijpen die over het scherm bewegen](images/flappy-clones-test.png) + +\--- task \--- + +Laat de pijpen eerst verschijnen door code toe te voegen aan de sprite van Pijpen zodat, `wanneer op de groene vlag wordt geklikt`{:class="block3events"}, de sprite `continu`{:class="block3control"} om de twee seconden `een kloon van zichzelf`{:class="block3control"} maakt. + +![pijpen sprite](images/pipes-sprite.png) + +```blocks3 +wanneer op de groene vlag wordt geklikt +maak grootte (200) % +verdwijn +herhaal + maak een kloon van (mijzelf v) + wacht (2) sec. +einde +``` + +**Tip:** klonen zijn slechts kopieën van een sprite en ze zijn erg handig voor het maken van games. + +\--- /task \--- + +\--- task \--- + +Breng vervolgens de pijpen in beweging door code toe te voegen zodat, `wanneer een kloon`{:class="block3control"} start, de kloon aan de rechterkant van het werkgebied verschijnt en naar links `schuift`{:class="block3motion"}. + +![pijpen sprite](images/pipes-sprite.png) + +```blocks3 +wanneer ik als kloon start +verschijn +ga naar x: (240) y: (0) +schuif in (4) sec. naar x: (-240) y: (0) +verwijder deze kloon +``` + +**Tip:** je kunt de pijpen stoppen door op de rode knop **stop** naast de groene vlag te klikken. + +\--- /task \--- + +Nu zou je veel pijpen moeten hebben, maar hun gaten zitten altijd op dezelfde plaats. + +Je kunt wat variatie toevoegen door een `willekeurig`{:class="block3operators"} getal te gebruiken voor de `y positie`{:class="block3motion"} van de Pipes sprite. + +![pijpen op verschillende hoogtes](images/flappy-height-test.png) + +\--- task \--- + +Wijzig de code van je sprite zodat elke sprite kloon `een willekeurig nummer kiest van -80 tot 80`{:class="block3operators"} en `verschuift`{:class="block3motion"} naar die `y-positie`{:class="block3motion"}: + +![pijpen sprite](images/pipes-sprite.png) + +```blocks3 +wanneer ik als kloon start +verschijn ++ ga naar x: (240) y: (willekeurig getal tussen (-80) en (80)) ++ schuif in (4) sec. naar x: (-240) y: (y-positie) +verwijder deze kloon +``` + +\--- /task \--- \ No newline at end of file diff --git a/nl-NL/step_5.md b/nl-NL/step_5.md new file mode 100644 index 0000000..b622943 --- /dev/null +++ b/nl-NL/step_5.md @@ -0,0 +1,77 @@ +## Laat Flappy vallen + +Voeg nu een sprite toe met de naam Flappy en maak code zodat Flappy in het speelveld naar beneden valt. In de volgende stap voeg je de code toe om Flappy te laten vliegen wanneer je op een toets drukt. + +\--- no-print \--- + +![flappy valt animatie](images/flappy-falling.gif) + +\--- /no-print \--- + +\--- task \--- + +Voeg een nieuwe sprite toe met twee uiterlijken, voor 'vleugels op' en 'vleugels neer', en noem het `Flappy`. + +De papegaaiensprite is een goede keuze. + +![papegaai sprite](images/flappy-sprite.png) + +\--- /task \--- + +Flappy moet kleiner worden. + +\--- task \--- + +Voeg code toe om `maak grootte 25 %`{:class="block3looks"} uit te voeren `wanneer op de groene vlag wordt geklikt`{:class="block3events"}. + +![papegaai sprite](images/flappy-sprite.png) + +```blocks3 +wanneer op de groene vlag wordt geklikt +maak grootte (25) % +``` + +\--- /task \--- + +Wanneer het spel begint, moet Flappy zich net links van het midden van het werkgebied bevinden, op coördinaten `-50, 0`. + +![flappy getoond bij de startpositie](images/flappy-starting-position.png) + +\--- task \--- + +Voeg code toe om Flappy naar de `x en y`{:class="block3motion"} startpositie van `x: -50`{:class="block3motion"} en `y: 0`{:class="block3motion "} te laten gaan. + +![papegaai sprite](images/flappy-sprite.png) + +```blocks3 +wanneer op de groene vlag wordt geklikt +maak grootte (25) % ++ ga naar x: (-50) y: (0) +``` + +[[[generic-scratch3-set-coordinates]]] + +\--- /task \--- + +\--- task \--- + +Laat Flappy nu `voor altijd`{:class="block3control"} van het speelveld vallen door de `y positie`{:class="block3motion"} van de sprite met -3 te veranderen. + +![papegaai sprite](images/flappy-sprite.png) + +```blocks3 +wanneer op de groene vlag wordt geklikt +maak grootte (25) % +ga naar x: (-50) y: (0) ++ herhaal + verander y met (-3) +einde +``` + +\--- /task \--- + +\--- task \--- + +Test je code om ervoor te zorgen dat Flappy in het midden van het scherm begint en naar beneden valt. Wanneer je Flappy naar de bovenkant van het speelveld sleept, zou de sprite opnieuw moeten vallen. + +\--- /task \--- \ No newline at end of file diff --git a/nl-NL/step_6.md b/nl-NL/step_6.md new file mode 100644 index 0000000..ef588d2 --- /dev/null +++ b/nl-NL/step_6.md @@ -0,0 +1,106 @@ +## Laat Flappy vliegen + +Nu laat je Flappy's vleugels naar boven klappen zodra je op spatiebalk drukt. Wanneer je het spel speelt, moet je je toetsklikken timen om Flappy door de gaten in de pijpen te krijgen. + +\--- no-print \--- + +![flappy vliegt omhoog wanneer de spatiebalk wordt ingedrukt](images/flappy-flying.gif) + +\--- /no-print \--- + +Laat Flappy omhoog vliegen als je op de spatiebalk klikt. + +\--- task \--- + +Wanneer de `spatiebalk wordt ingedrukt`{:class="block3events"}, zou Flappy omhoog moeten gaan door `zijn y-coördinaat`{:class="block3motion"} een klein beetje te veranderen, bijvoorbeeld `6`. + +Flappy vliegt omhoog door deze beweging `10 keer`{:class="block3control"} `te herhalen`{:class="block3control"}. + +Voeg deze code toe aan je `Flappy` sprite: + +![papegaai sprite](images/flappy-sprite.png) + +```blocks3 +wanneer [spatiebalk v] is ingedrukt +herhaal (10) + verander y met (6) +einde +``` + +\--- /task \--- + +Nu moet je Flappy's vleugels laten fladderen! + +\--- task \--- + +Klik op het tabblad **Uiterlijken** en noem Flappy's kostuums 'wings up' en 'wings down'. + +![namen van de uiterlijken](images/flappy-wings.png) + +\--- /task \--- + +\--- task \--- + +Kun je het uiterlijk van Flappy veranderen in `wings down` als je op spatiebalk drukt, en dan terug naar `wings up` halverwege de opwaartse beweging? + +\--- hints \--- + +\--- hint \--- + +Je moet de opwaartse beweging in tweeën delen, zodat je twee `herhaal`{:class="block3control"} blokken kunt gebruiken om Flappy's uiterlijk aan het begin en in het midden van de beweging te veranderen. + +Voeg `verander uiterlijk naar`{:class="block3looks"} blokken toe om het uiterlijk van Flappy te wijzigen. + +\--- /hint \--- \--- hint \--- + +Je moet deze blokken gebruiken: + +![papegaai sprite](images/flappy-sprite.png) + +```blocks3 +herhaal (5) + verander y met (6) +einde + +herhaal (5) + verander y met (6) +einde + +verander uiterlijk naar (wings up v) + +verander uiterlijk naar (wings down v) + +wanneer [spatiebalk v] is ingedrukt +``` + +\--- /hint \--- + +\--- hint \--- + +Je code zou er als volgt uit moeten zien: + +![papegaai sprite](images/flappy-sprite.png) + +```blocks3 +wanneer [spatiebalk v] is ingedrukt +verander uiterlijk naar (wings down v) +herhaal (5) + verander y met (6) +einde +verander uiterlijk naar (wings up v) +herhaal (5) + verander y met (6) +einde +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test je code. Zoals je ziet, gebeurt er momenteel niets als je Flappy een pijp laat raken. + +\--- /task \--- \ No newline at end of file diff --git a/nl-NL/step_7.md b/nl-NL/step_7.md new file mode 100644 index 0000000..a058a40 --- /dev/null +++ b/nl-NL/step_7.md @@ -0,0 +1,77 @@ +## Neem botsingen waar + +Om van het spel een uitdaging te maken, moet je Flappy door de gaten leiden zonder dat de papegaai de pijpen of de randen van het speelveld raakt. Je moet enkele blokken toevoegen om waar te nemen wanneer Flappy iets raakt. + +Dit wordt **botsing waarneming** genoemd. + +\--- task \--- + +Importeer een geluid uit de bibliotheek dat je wilt horen wanneer Flappy ergens tegenaan botst. Het 'screech' geluid is een goede keuze. + +[[[generic-scratch3-sound-from-library]]] + +\--- /task \--- + +Een `wacht tot`{:class="block3control"} blok is noodzakelijk om te controleren of Flappy `de pijpen raakt`{:class="block3sensing"} `of`{:class="block3operators"} `de rand raakt`{:class="block3sensing"}. + +\--- task \--- + +Voeg een nieuw `wanneer op de groene vlag wordt geklikt`{:class="block3control"} blok toe aan de sprite 'Flappy' en voeg ook de volgende code toe: + +![papegaai sprite](images/flappy-sprite.png) + +```blocks3 +wanneer op de groene vlag wordt geklikt +wacht tot <<raak ik (Pipes v) ?> of > +start geluid (screech v) +``` + +\--- /task \--- + +\--- task \--- + +Test je code. Als Flappy een pijp raakt, moet je het 'screech' geluid horen. + +\--- /task \--- + +Werk vervolgens de code bij zodat het spel stopt wanneer Flappy een pijp raakt. + +\--- task \--- + +Voeg de volgende code toe om het spel te stoppen nadat een botsing is waargenomen: + +![papegaai sprite](images/flappy-sprite.png) + +```blocks3 +wanneer op de groene vlag wordt geklikt +wacht tot <<raak ik (Pipes v) ?> of > +start geluid (screech v) ++ zeg [Game Over!] ++ zend signaal (game over v) ++ stop [andere scripts in sprite v] +``` + +Het blok `zend signaal`{:class="block3events"} vertelt andere sprites dat het spel afgelopen is. + +Het blok `stop`{:class="block3control"} stopt andere Flappy scripts die worden uitgevoerd, zodat Flappy niet meer valt na een botsing. + +\--- /task \--- + +\--- task \--- + +Voeg ten slotte de volgende code toe aan de `Pijpen` sprite zodat pijpen `stoppen`{:class="block3control"} met verschijnen `wanneer de sprite Game Over`{:class="block3events"} ontvangt. + +![pijpen sprite](images/pipes-sprite.png) + +```blocks3 +wanneer ik signaal [game over v] ontvang +stop [andere scripts in sprite v] +``` + +\--- /task \--- + +\--- task \--- + +Test je game en zie hoe lang je kunt spelen voordat het 'Game over' is! + +\--- /task \--- \ No newline at end of file diff --git a/nl-NL/step_8.md b/nl-NL/step_8.md new file mode 100644 index 0000000..2a15c5c --- /dev/null +++ b/nl-NL/step_8.md @@ -0,0 +1,116 @@ +## Een score toevoegen + +De speler moet een punt scoren telkens wanneer Flappy door een opening tussen pijpen komt. + +\--- task \--- + +Maak een nieuwe variabele **voor alle sprites** en noem deze `score`{:class="block3variables"}. + +[[[generic-scratch3-add-variable]]] + +\--- /task \--- + +Elke sprite kloon van 'Piipen' moet `wachten tot`{:class="block3control"} Flappy is voorbijgevlogen en verhoogt dan de `score`{:class="block3variables"}. + +\--- task \--- + +Stel score eerst `in op 0`{:class="block3variables"} wanneer het spel begint: + +![pijpen sprite](images/pipes-sprite.png) + +```blocks3 +wanneer op de groene vlag wordt geklikt ++ maak [score v] [0] +maak grootte (200) % +verdwijn +herhaal + maak een kloon van (mijzelf v) + wacht (2) sec. +einde +``` + +\--- /task \--- + +\--- task \--- + +Voeg vervolgens de volgende code toe aan de sprite van `Pipes`: + +![pijpen sprite](images/pipes-sprite.png) + +```blocks3 +als ik als kloon start +wacht tot <> +``` + +\--- /task \--- + +\--- task \--- + +Voeg meer code toe zodat, wanneer Flappy's `x` positie groter is dan de `x` positie van de pijpenkloon, de `score`{:class="block3variables"} met `1` toeneemt en een geluid naar keuze wordt afgespeeld. + +Je kunt het 'pop'-geluid gebruiken als je wilt, of een geluid uit de bibliotheek toevoegen, bijvoorbeeld 'vogel'. + +\--- hints \--- + +\--- hint \--- + +Je moet `wachten tot`{:class="block3control"} `Flappy's x positie`{:class="block3sensing"} `groter is dan (>)`{:class="block3operators"} de `x positie`{:class="block3motion"} van `Pipes`. + +![pijpen sprite](images/pipes-sprite.png) + +```blocks3 +wanneer ik als kloon start ++ wacht tot <> +``` + +Verander dan `de score met 1`{:class="block3variables"} en speel `een geluid`{:class="block3sound"} af. + +\--- /hint \--- + +\--- hint \--- + +Gebruik deze blokken in de juiste volgorde: + +![pijpen sprite](images/pipes-sprite.png) + +```blocks3 +wanneer ik als kloon start +wacht tot <> + +start geluid (pop v) + +verander [score v] met (1) + +[x positie v] van (Flappy v) + +x positie + +() > () +``` + +\--- /hint \--- + +\--- hint \--- + +Je code zou er als volgt uit moeten zien: + +![pijpen sprite](images/pipes-sprite.png) + +```blocks3 +wanneer ik als kloon start +wacht tot <([x positie v] van (Flappy v)) > (x positie)> +verander [score v] met (1) +start geluid (pop v) +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test je code en zorg ervoor dat je een punt scoort telkens wanneer Flappy door een opening tussen pijpen komt. Controleer of `score`{:class="block3variables"} is ingesteld op `0` wanneer je een nieuw spel start. + +\--- /task \--- \ No newline at end of file diff --git a/nl-NL/step_9.md b/nl-NL/step_9.md new file mode 100644 index 0000000..fe6caa2 --- /dev/null +++ b/nl-NL/step_9.md @@ -0,0 +1,5 @@ +## Uitdaging: pas de moeilijkheidsgraad aan + +Is het spel te moeilijk of te gemakkelijk voor jou? Hoeveel manieren kun je vinden om de moeilijkheidsgraad te veranderen? + +Pas het spel aan totdat je tevreden bent met de moeilijkheid! \ No newline at end of file diff --git a/no-NO/images/banner.png b/no-NO/images/banner.png new file mode 100644 index 0000000..7a0da5b Binary files /dev/null and b/no-NO/images/banner.png differ diff --git a/no-NO/images/binary-showcase.png b/no-NO/images/binary-showcase.png new file mode 100644 index 0000000..499aa29 Binary files /dev/null and b/no-NO/images/binary-showcase.png differ diff --git a/no-NO/images/flappy-clones-test.png b/no-NO/images/flappy-clones-test.png new file mode 100644 index 0000000..f874059 Binary files /dev/null and b/no-NO/images/flappy-clones-test.png differ diff --git a/no-NO/images/flappy-falling.gif b/no-NO/images/flappy-falling.gif new file mode 100644 index 0000000..970d833 Binary files /dev/null and b/no-NO/images/flappy-falling.gif differ diff --git a/no-NO/images/flappy-flying.gif b/no-NO/images/flappy-flying.gif new file mode 100644 index 0000000..e259ff1 Binary files /dev/null and b/no-NO/images/flappy-flying.gif differ diff --git a/no-NO/images/flappy-height-test.png b/no-NO/images/flappy-height-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/no-NO/images/flappy-height-test.png differ diff --git a/no-NO/images/flappy-parrot-showcase.png b/no-NO/images/flappy-parrot-showcase.png new file mode 100644 index 0000000..493049b Binary files /dev/null and b/no-NO/images/flappy-parrot-showcase.png differ diff --git a/no-NO/images/flappy-pipes-duplicate1-annotated.png b/no-NO/images/flappy-pipes-duplicate1-annotated.png new file mode 100644 index 0000000..65e32c6 Binary files /dev/null and b/no-NO/images/flappy-pipes-duplicate1-annotated.png differ diff --git a/no-NO/images/flappy-pipes-duplicate1.png b/no-NO/images/flappy-pipes-duplicate1.png new file mode 100644 index 0000000..4239b67 Binary files /dev/null and b/no-NO/images/flappy-pipes-duplicate1.png differ diff --git a/no-NO/images/flappy-pipes-duplicate2.png b/no-NO/images/flappy-pipes-duplicate2.png new file mode 100644 index 0000000..ba1a69a Binary files /dev/null and b/no-NO/images/flappy-pipes-duplicate2.png differ diff --git a/no-NO/images/flappy-pipes-ends.png b/no-NO/images/flappy-pipes-ends.png new file mode 100644 index 0000000..ab59aaa Binary files /dev/null and b/no-NO/images/flappy-pipes-ends.png differ diff --git a/no-NO/images/flappy-pipes-fill-rectangle.png b/no-NO/images/flappy-pipes-fill-rectangle.png new file mode 100644 index 0000000..7360b87 Binary files /dev/null and b/no-NO/images/flappy-pipes-fill-rectangle.png differ diff --git a/no-NO/images/flappy-pipes-filled.png b/no-NO/images/flappy-pipes-filled.png new file mode 100644 index 0000000..7d2c0dd Binary files /dev/null and b/no-NO/images/flappy-pipes-filled.png differ diff --git a/no-NO/images/flappy-pipes-position.png b/no-NO/images/flappy-pipes-position.png new file mode 100644 index 0000000..ca2b810 Binary files /dev/null and b/no-NO/images/flappy-pipes-position.png differ diff --git a/no-NO/images/flappy-pipes-rectangle.png b/no-NO/images/flappy-pipes-rectangle.png new file mode 100644 index 0000000..6e3bf02 Binary files /dev/null and b/no-NO/images/flappy-pipes-rectangle.png differ diff --git a/no-NO/images/flappy-pipes-test.png b/no-NO/images/flappy-pipes-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/no-NO/images/flappy-pipes-test.png differ diff --git a/no-NO/images/flappy-setup.png b/no-NO/images/flappy-setup.png new file mode 100644 index 0000000..92f9eca Binary files /dev/null and b/no-NO/images/flappy-setup.png differ diff --git a/no-NO/images/flappy-sprite.png b/no-NO/images/flappy-sprite.png new file mode 100644 index 0000000..6a0c590 Binary files /dev/null and b/no-NO/images/flappy-sprite.png differ diff --git a/no-NO/images/flappy-stage.png b/no-NO/images/flappy-stage.png new file mode 100644 index 0000000..5efe03c Binary files /dev/null and b/no-NO/images/flappy-stage.png differ diff --git a/no-NO/images/flappy-starting-position.png b/no-NO/images/flappy-starting-position.png new file mode 100644 index 0000000..9089c9e Binary files /dev/null and b/no-NO/images/flappy-starting-position.png differ diff --git a/no-NO/images/flappy-wings.png b/no-NO/images/flappy-wings.png new file mode 100644 index 0000000..ef0aa8e Binary files /dev/null and b/no-NO/images/flappy-wings.png differ diff --git a/no-NO/images/pipes-sprite.png b/no-NO/images/pipes-sprite.png new file mode 100644 index 0000000..a9882ed Binary files /dev/null and b/no-NO/images/pipes-sprite.png differ diff --git a/no-NO/meta.yml b/no-NO/meta.yml new file mode 100644 index 0000000..c2fe5e6 --- /dev/null +++ b/no-NO/meta.yml @@ -0,0 +1,34 @@ +--- +title: Flappy parrot +hero_image: images/banner.png +description: Create a game in which you guide a parrot past moving obstacles +listed: true +copyedit: true +version: 4.1 +last_tested: 2018-10-90 +steps: + - + title: Introduction + - + title: Add the pipes + - + title: "Challenge: make better pipes" + challenge: true + - + title: Make the pipes move + - + title: Make Flappy fall + - + title: Make Flappy fly + - + title: Detect collisions + - + title: Add a score + - + title: 'Challenge: adjust the difficulty' + challenge: true + - + title: 'Challenge: add a high score' + challenge: true + - + title: What next? diff --git a/no-NO/scratch-translatable.txt b/no-NO/scratch-translatable.txt new file mode 100644 index 0000000..214e66c --- /dev/null +++ b/no-NO/scratch-translatable.txt @@ -0,0 +1,13 @@ +Pipes + +costume1 + +Flappy + +wings down + +wings up + +Game Over! + +score diff --git a/no-NO/solutions/FlappyParrot-Solution.sb3 b/no-NO/solutions/FlappyParrot-Solution.sb3 new file mode 100644 index 0000000..a0cd354 Binary files /dev/null and b/no-NO/solutions/FlappyParrot-Solution.sb3 differ diff --git a/no-NO/step_1.md b/no-NO/step_1.md new file mode 100644 index 0000000..f7519ae --- /dev/null +++ b/no-NO/step_1.md @@ -0,0 +1,69 @@ +\--- no-print \--- + +This is the **Scratch 3** version of the project. There is also a [Scratch 2 version of the project](https://projects.raspberrypi.org/en/projects/flappy-parrot-scratch2). + +\--- /no-print \--- + +## Introduction + +Create a game in which you have to guide a parrot past scrolling pipes to score points. + +### What you will make + +\--- no-print \--- + +Click the green flag to start the game. Press the space bar to make the parrot flap its wings, and try to get it to fly through the gaps in the pipes! You score one point for every pipe that you manage to get the parrot past. + +
+ + +
+ +\--- /no-print \--- + +\--- print-only \--- + +You will press the space bar to make the parrot flap its wings, and score one point for every pipe that you manage to get the parrot past. + +![flappy parrot game being played](images/flappy-parrot-showcase.png) + +\--- /print-only \--- + +## \--- collapse \--- + +## title: What you will need + +### Hardware + ++ A computer capable of running Scratch 3 + +### Software + ++ Scratch 3 (either [online](https://rpf.io/scratchon) or [offline](https://rpf.io/scratchoff)) + +\--- /collapse \--- + +## \--- collapse \--- + +## title: What you will learn + ++ How to create sprites using Vector mode ++ How to use sounds ++ How to detect collisions ++ How to control a sprite using the keyboard + +\--- /collapse \--- + +## \--- collapse \--- + +## title: Additional notes for educators + +\--- no-print \--- + +If you need to print this project, please use the [printer-friendly version](https://projects.raspberrypi.org/en/projects/flappy-parrot/print){:target="_blank"}. + +\--- /no-print \--- + +You can find the [completed project here](https://rpf.io/p/en/flappy-parrot-get). + +\--- /collapse \--- \ No newline at end of file diff --git a/no-NO/step_10.md b/no-NO/step_10.md new file mode 100644 index 0000000..a5808f3 --- /dev/null +++ b/no-NO/step_10.md @@ -0,0 +1,9 @@ +## Challenge: add a high score + +\--- challenge \--- + +Can you add a high score to the game so that, in addition to keeping track of score for the current round, it keeps track of the highest score you've ever reached? + +[[[generic-scratch3-high-score]]] + +\--- /challenge \--- \ No newline at end of file diff --git a/no-NO/step_11.md b/no-NO/step_11.md new file mode 100644 index 0000000..02ae229 --- /dev/null +++ b/no-NO/step_11.md @@ -0,0 +1,19 @@ +## What next? + +Try the [Binary hero](https://projects.raspberrypi.org/en/projects/binary-hero?utm_source=pathway&utm_medium=whatnext&utm_campaign=projects) project, where you will make a game in which you play the notes of a song as they scroll down the Stage. + +\--- no-print \--- + +Click the green flag to start the game. Use the z, x, c, and v keys to play the correct notes when these reach the bottom of the Stage. You'll score ten points for every correct note you play. + +
+ +
+ +\--- /no-print \--- + +\--- print-only \--- + +The notes will fall from above, and you will have to press keys to "catch" and play the notes. ![showcase](images/binary-showcase.png) + +\--- /print-only \--- \ No newline at end of file diff --git a/no-NO/step_2.md b/no-NO/step_2.md new file mode 100644 index 0000000..d8f2ce5 --- /dev/null +++ b/no-NO/step_2.md @@ -0,0 +1,84 @@ +## Add the pipes + +First, create the pipes. + +\--- task \--- + +Open a new empty Scratch project. + +[[[generic-scratch3-new-project]]] + +\--- /task \--- + +\--- task \--- + +Add a backdrop with an outdoor landscape. 'Blue Sky' is a good choice. + +![screenshot](images/flappy-stage.png) + +[[[generic-scratch3-backdrop-from-library]]] + +\--- /task \--- + +\--- task \--- + +Create a new sprite and name it 'Pipes'. + +[[[generic-scratch3-draw-sprite]]] + +\--- /task \--- + +The 'Pipes' sprite should be a pair of pipes with a gap in the middle. By moving the sprite up or down, you can put the gap in a different place. + +This picture shows an example of how the pipes could be positioned. The parts of the sprite outside the Stage are normally hidden, you only see then when you drag the sprite: + +![screenshot](images/flappy-pipes-position.png) + +You can't draw a sprite as big as the pipes need to be, but you can increase the size at which the sprite shows on the Stage. + +\--- task \--- + +![pipes sprite](images/pipes-sprite.png) + +Add code to make the sprite bigger. + +```blocks3 +when green flag clicked +set size to (200) % +``` + +This makes it's easier to see how big the pipes should be. + +\--- /task \--- + +\--- task \--- + +Draw a rectangle for the top pipe as shown here: + +![rectangle for the pipe](images/flappy-pipes-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Fill the pipe with a colour you like. + +![fill the rectangle](images/flappy-pipes-fill-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Create a duplicate of the pipe by selecting it and then clicking on **Copy** and **Paste**. + +![copy and paste pipe](images/flappy-pipes-duplicate1-annotated.png) + +\--- /task \--- + +\--- task \--- + +Drag the copy of the pipe to the bottom of the screen so that the copy is in line with the other pipe. There needs to be a gap between the two pipes. + +![screenshot](images/flappy-pipes-duplicate2.png) + +\--- /task \--- \ No newline at end of file diff --git a/no-NO/step_3.md b/no-NO/step_3.md new file mode 100644 index 0000000..17f05f7 --- /dev/null +++ b/no-NO/step_3.md @@ -0,0 +1,11 @@ +## Challenge: make better pipes + +Can you make your pipes look better? + ++ Shade your pipes with a left-to-right gradient. + +![screenshot](images/flappy-pipes-filled.png) + ++ Add extra rectangles to the ends of the pipes: + +![screenshot](images/flappy-pipes-ends.png) \ No newline at end of file diff --git a/no-NO/step_4.md b/no-NO/step_4.md new file mode 100644 index 0000000..2beedd9 --- /dev/null +++ b/no-NO/step_4.md @@ -0,0 +1,65 @@ +## Make the pipes move + +Next you're going to make the pipes move across the screen to create an obstacle course. + +![pipes moving across the screen](images/flappy-clones-test.png) + +\--- task \--- + +First make the pipes appear by adding code to the Pipes sprite so that, `when the green flag is clicked`{:class="block3events"}, the sprite `forever`{:class="block3control"} `creates a clone of itself`{:class="block3control"} every two seconds. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +**Tip:** clones are just copies of a sprite, and they are really useful for creating games. + +\--- /task \--- + +\--- task \--- + +Next make the pipes move by adding code so that, `when a clone starts`{:class="block3control"}, the clone appears on the right side of the Stage and `glides`{:class="block3motion"} across to the left. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show +go to x: (240) y: (0) +glide (4) secs to x: (-240) y: (0) +delete this clone +``` + +**Tip:** you can stop the pipes scrolling by clicking the red **stop** button next to the green flag. + +\--- /task \--- + +Now you should have lots of pipes, but their gaps are always in the same place. + +You can add some variety by using a `random`{:class="block3operators"} number for the Pipes sprite's `y position`{:class="block3motion"}. + +![pipes at different heights](images/flappy-height-test.png) + +\--- task \--- + +Modify your sprite's code so that each sprite clone `picks a random number from -80 to 80`{:class="block3operators"} and `glides`{:class="block3motion"} to that `y position`{:class="block3motion"}: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show ++ go to x: (240) y: (pick random (-80) to (80)) ++ glide (4) secs to x: (-240) y: (y position) +delete this clone +``` + +\--- /task \--- \ No newline at end of file diff --git a/no-NO/step_5.md b/no-NO/step_5.md new file mode 100644 index 0000000..f9d79ce --- /dev/null +++ b/no-NO/step_5.md @@ -0,0 +1,77 @@ +## Make Flappy fall + +Now add a sprite called Flappy and create code it so Flappy falls down the Stage. In the next step, you will add the code to make Flappy fly when you press a key. + +\--- no-print \--- + +![flappy falling animation](images/flappy-falling.gif) + +\--- /no-print \--- + +\--- task \--- + +Add a new sprite that has two costumes, for 'wings up' and 'wings down', and name it `Flappy`. + +The parrot sprite is a good choice. + +![parrot sprite](images/flappy-sprite.png) + +\--- /task \--- + +Flappy needs to be smaller. + +\--- task \--- + +Add code to `set Flappy's size to 25%`{:class="block3looks"} `when the green flag is clicked`{:class="block3events"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +``` + +\--- /task \--- + +When the game starts, Flappy needs to be just left of the centre of the Stage, at coordinates `-50, 0`. + +![flappy shown at the start position](images/flappy-starting-position.png) + +\--- task \--- + +Add code to make Flappy `go to the x and y`{:class="block3motion"} starting position of `x: -50`{:class="block3motion"} and `y: 0`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % ++ go to x: (-50) y: (0) +``` + +[[[generic-scratch3-set-coordinates]]] + +\--- /task \--- + +\--- task \--- + +Now make Flappy keep falling down the Stage by `forever`{:class="block3control"} `changing the sprite's y position by -3`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +go to x: (-50) y: (0) ++ forever + change y by (-3) +end +``` + +\--- /task \--- + +\--- task \--- + +Test your code to make sure Flappy starts in the middle of the screen and falls to the bottom. When you drag Flappy to the top of the Stage, the sprite should fall again. + +\--- /task \--- \ No newline at end of file diff --git a/no-NO/step_6.md b/no-NO/step_6.md new file mode 100644 index 0000000..1a98cb2 --- /dev/null +++ b/no-NO/step_6.md @@ -0,0 +1,106 @@ +## Make Flappy fly + +Now you will make Flappy flap upwards when you press the space bar. When you play the game, you have to time your taps to get Flappy through the gaps in the pipes. + +\--- no-print \--- + +![flappy flying upwards when space bar is pressed](images/flappy-flying.gif) + +\--- /no-print \--- + +Make Flappy fly upwards when you tap the space bar. + +\--- task \--- + +When the `space key is pressed`{:class="block3events"}, Flappy should move upwards by `changing its y coordinate`{:class="block3motion"} by a small amount, for example `6`. + +Flappy flies upwards by `repeating`{:class="block3control"} this movement `10 times`{:class="block3control"}. + +Add this code to your `Flappy` sprite: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +repeat (10) + change y by (6) +end +``` + +\--- /task \--- + +Now you need to get Flappy's wings flapping! + +\--- task \--- + +Click on the **Costumes** tab, and name Flappy's costumes 'wings up' and 'wings down'. + +![naming the costumes](images/flappy-wings.png) + +\--- /task \--- + +\--- task \--- + +Can you make Flappy's costume change to `wings down` when you press space, and then change it back to `wings up` halfway through the upward movement? + +\--- hints \--- + +\--- hint \--- + +You need to split the upward motion in half so that you can use two `repeat`{:class="block3control"} blocks to change Flappy's costume at the beginning and in the middle of the movement. + +Add `switch costume to`{:class="block3looks"} blocks to change how Flappy looks. + +\--- /hint \--- \--- hint \--- + +You need to use these blocks: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +repeat (5) + change y by (6) +end + +repeat (5) + change y by (6) +end + +switch costume to (wings up v) + +switch costume to (wings down v) + +when [space v] key pressed +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +switch costume to (wings down v) +repeat (5) + change y by (6) +end +switch costume to (wings up v) +repeat (5) + change y by (6) +end +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code. As you see, at the moment nothing happens if you let Flappy hit a pipe. + +\--- /task \--- \ No newline at end of file diff --git a/no-NO/step_7.md b/no-NO/step_7.md new file mode 100644 index 0000000..40a2720 --- /dev/null +++ b/no-NO/step_7.md @@ -0,0 +1,77 @@ +## Detect collisions + +To make the game a challenge, the player needs to guide Flappy through the gaps without letting the parrot touch the pipes or the edges of the Stage. You need to add some blocks to detect when Flappy hits something. + +This is called **collision detection**. + +\--- task \--- + +Import a sound from the library that you want to play when Flappy collides with something. The 'screech' sound is a good choice. + +[[[generic-scratch3-sound-from-library]]] + +\--- /task \--- + +A `wait until`{:class="block3control"} block is necessart to check whether Flappy is `touching the pipes`{:class="block3sensing"} `or`{:class="block3operators"} `touching the edge`{:class="block3sensing"}. + +\--- task \--- + +Add a new `when green flag clicked`{:class="block3control"} block to the 'Flappy' sprite, and also add the following code: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) +``` + +\--- /task \--- + +\--- task \--- + +Test your code. If Flappy touches a pipe, the 'screech' sound should play. + +\--- /task \--- + +Next, update the code so that the game stops when Flappy hits a pipe. + +\--- task \--- + +Add the following code to stop the game after a collision is detected: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) ++ say [Game Over!] ++ broadcast (Game Over v) ++ stop [other scripts in sprite v] +``` + +The `broadcast`{:class="block3events"} block tells other sprites that the game is over. + +The `stop`{:class="block3control"} block stops other Flappy scripts that are running so that Flappy stops falling after a collision. + +\--- /task \--- + +\--- task \--- + +Finally, add the following code to the `Pipes` sprite so that pipes `stop`{:class="block3control"} appearing `when the sprite receives Game Over`{:class="block3events"}. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I receive [Game Over v] +stop [other scripts in sprite v] +``` + +\--- /task \--- + +\--- task \--- + +Test your game and see how long you can play before it's 'Game over'! + +\--- /task \--- \ No newline at end of file diff --git a/no-NO/step_8.md b/no-NO/step_8.md new file mode 100644 index 0000000..2c5cc08 --- /dev/null +++ b/no-NO/step_8.md @@ -0,0 +1,116 @@ +## Add a score + +The player should score a point every time Flappy makes it through a gap between pipes. + +\--- task \--- + +Make a new variable **for all sprites** and call it `score`{:class="block3variables"}. + +[[[generic-scratch3-add-variable]]] + +\--- /task \--- + +Each 'Pipes' sprite clone should `wait until`{:class="block3control"} Flappy has flown past and then increase the `score`{:class="block3variables"}. + +\--- task \--- + +First, `set score to 0`{:class="block3variables"} when the game begins: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked ++ set [score v] to [0] +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +\--- /task \--- + +\--- task \--- + +Then add the following code to the `Pipes` sprite: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> +``` + +\--- /task \--- + +\--- task \--- + +Add more code so that, when Flappy's `x` position is greater than the pipe clone's `x` position, the `score`{:class="block3variables"} increases by `1` and a sound of your choice plays. + +You could use the 'pop' sound if you want, or add a sound from the library, for example 'bird'. + +\--- hints \--- + +\--- hint \--- + +You need to `wait until`{:class="block3control"} `Flappy's x position`{:class="block3sensing"} is `greater than (>)`{:class="block3operators"} the `x position`{:class="block3motion"} of `Pipes`. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone ++ wait until <> +``` + +Then `change score by 1`{:class="block3variables"} and `play a sound`{:class="block3sound"}. + +\--- /hint \--- + +\--- hint \--- + +Use these blocks in the correct order: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> + +play sound (pop v) + +change [score v] by (1) + +[x position v] of (Flappy v) + +x position + +() > () +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <([x position v] of (Flappy v)) > (x position)> +change [score v] by (1) +play sound (pop v) +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code and make sure you score a point every time Flappy gets through a gap between pipes. Check whether the `score`{:class="block3variables"} is set to `0` when you start a new game. + +\--- /task \--- \ No newline at end of file diff --git a/no-NO/step_9.md b/no-NO/step_9.md new file mode 100644 index 0000000..2f4e2e6 --- /dev/null +++ b/no-NO/step_9.md @@ -0,0 +1,5 @@ +## Challenge: adjust the difficulty + +Is the game too hard or too easy for you? How many ways can you find to change the difficulty? + +Adjust the game until you are happy with its difficulty! \ No newline at end of file diff --git a/pl-PL/images/banner.png b/pl-PL/images/banner.png new file mode 100644 index 0000000..7a0da5b Binary files /dev/null and b/pl-PL/images/banner.png differ diff --git a/pl-PL/images/binary-showcase.png b/pl-PL/images/binary-showcase.png new file mode 100644 index 0000000..499aa29 Binary files /dev/null and b/pl-PL/images/binary-showcase.png differ diff --git a/pl-PL/images/flappy-clones-test.png b/pl-PL/images/flappy-clones-test.png new file mode 100644 index 0000000..f874059 Binary files /dev/null and b/pl-PL/images/flappy-clones-test.png differ diff --git a/pl-PL/images/flappy-falling.gif b/pl-PL/images/flappy-falling.gif new file mode 100644 index 0000000..970d833 Binary files /dev/null and b/pl-PL/images/flappy-falling.gif differ diff --git a/pl-PL/images/flappy-flying.gif b/pl-PL/images/flappy-flying.gif new file mode 100644 index 0000000..e259ff1 Binary files /dev/null and b/pl-PL/images/flappy-flying.gif differ diff --git a/pl-PL/images/flappy-height-test.png b/pl-PL/images/flappy-height-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/pl-PL/images/flappy-height-test.png differ diff --git a/pl-PL/images/flappy-parrot-showcase.png b/pl-PL/images/flappy-parrot-showcase.png new file mode 100644 index 0000000..493049b Binary files /dev/null and b/pl-PL/images/flappy-parrot-showcase.png differ diff --git a/pl-PL/images/flappy-pipes-duplicate1-annotated.png b/pl-PL/images/flappy-pipes-duplicate1-annotated.png new file mode 100644 index 0000000..65e32c6 Binary files /dev/null and b/pl-PL/images/flappy-pipes-duplicate1-annotated.png differ diff --git a/pl-PL/images/flappy-pipes-duplicate1.png b/pl-PL/images/flappy-pipes-duplicate1.png new file mode 100644 index 0000000..4239b67 Binary files /dev/null and b/pl-PL/images/flappy-pipes-duplicate1.png differ diff --git a/pl-PL/images/flappy-pipes-duplicate2.png b/pl-PL/images/flappy-pipes-duplicate2.png new file mode 100644 index 0000000..ba1a69a Binary files /dev/null and b/pl-PL/images/flappy-pipes-duplicate2.png differ diff --git a/pl-PL/images/flappy-pipes-ends.png b/pl-PL/images/flappy-pipes-ends.png new file mode 100644 index 0000000..ab59aaa Binary files /dev/null and b/pl-PL/images/flappy-pipes-ends.png differ diff --git a/pl-PL/images/flappy-pipes-fill-rectangle.png b/pl-PL/images/flappy-pipes-fill-rectangle.png new file mode 100644 index 0000000..7360b87 Binary files /dev/null and b/pl-PL/images/flappy-pipes-fill-rectangle.png differ diff --git a/pl-PL/images/flappy-pipes-filled.png b/pl-PL/images/flappy-pipes-filled.png new file mode 100644 index 0000000..7d2c0dd Binary files /dev/null and b/pl-PL/images/flappy-pipes-filled.png differ diff --git a/pl-PL/images/flappy-pipes-position.png b/pl-PL/images/flappy-pipes-position.png new file mode 100644 index 0000000..ca2b810 Binary files /dev/null and b/pl-PL/images/flappy-pipes-position.png differ diff --git a/pl-PL/images/flappy-pipes-rectangle.png b/pl-PL/images/flappy-pipes-rectangle.png new file mode 100644 index 0000000..6e3bf02 Binary files /dev/null and b/pl-PL/images/flappy-pipes-rectangle.png differ diff --git a/pl-PL/images/flappy-pipes-test.png b/pl-PL/images/flappy-pipes-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/pl-PL/images/flappy-pipes-test.png differ diff --git a/pl-PL/images/flappy-setup.png b/pl-PL/images/flappy-setup.png new file mode 100644 index 0000000..92f9eca Binary files /dev/null and b/pl-PL/images/flappy-setup.png differ diff --git a/pl-PL/images/flappy-sprite.png b/pl-PL/images/flappy-sprite.png new file mode 100644 index 0000000..6a0c590 Binary files /dev/null and b/pl-PL/images/flappy-sprite.png differ diff --git a/pl-PL/images/flappy-stage.png b/pl-PL/images/flappy-stage.png new file mode 100644 index 0000000..5efe03c Binary files /dev/null and b/pl-PL/images/flappy-stage.png differ diff --git a/pl-PL/images/flappy-starting-position.png b/pl-PL/images/flappy-starting-position.png new file mode 100644 index 0000000..9089c9e Binary files /dev/null and b/pl-PL/images/flappy-starting-position.png differ diff --git a/pl-PL/images/flappy-wings.png b/pl-PL/images/flappy-wings.png new file mode 100644 index 0000000..ef0aa8e Binary files /dev/null and b/pl-PL/images/flappy-wings.png differ diff --git a/pl-PL/images/pipes-sprite.png b/pl-PL/images/pipes-sprite.png new file mode 100644 index 0000000..a9882ed Binary files /dev/null and b/pl-PL/images/pipes-sprite.png differ diff --git a/pl-PL/meta.yml b/pl-PL/meta.yml new file mode 100644 index 0000000..c2fe5e6 --- /dev/null +++ b/pl-PL/meta.yml @@ -0,0 +1,34 @@ +--- +title: Flappy parrot +hero_image: images/banner.png +description: Create a game in which you guide a parrot past moving obstacles +listed: true +copyedit: true +version: 4.1 +last_tested: 2018-10-90 +steps: + - + title: Introduction + - + title: Add the pipes + - + title: "Challenge: make better pipes" + challenge: true + - + title: Make the pipes move + - + title: Make Flappy fall + - + title: Make Flappy fly + - + title: Detect collisions + - + title: Add a score + - + title: 'Challenge: adjust the difficulty' + challenge: true + - + title: 'Challenge: add a high score' + challenge: true + - + title: What next? diff --git a/pl-PL/scratch-translatable.txt b/pl-PL/scratch-translatable.txt new file mode 100644 index 0000000..214e66c --- /dev/null +++ b/pl-PL/scratch-translatable.txt @@ -0,0 +1,13 @@ +Pipes + +costume1 + +Flappy + +wings down + +wings up + +Game Over! + +score diff --git a/pl-PL/solutions/FlappyParrot-Solution.sb3 b/pl-PL/solutions/FlappyParrot-Solution.sb3 new file mode 100644 index 0000000..a0cd354 Binary files /dev/null and b/pl-PL/solutions/FlappyParrot-Solution.sb3 differ diff --git a/pl-PL/step_1.md b/pl-PL/step_1.md new file mode 100644 index 0000000..f7519ae --- /dev/null +++ b/pl-PL/step_1.md @@ -0,0 +1,69 @@ +\--- no-print \--- + +This is the **Scratch 3** version of the project. There is also a [Scratch 2 version of the project](https://projects.raspberrypi.org/en/projects/flappy-parrot-scratch2). + +\--- /no-print \--- + +## Introduction + +Create a game in which you have to guide a parrot past scrolling pipes to score points. + +### What you will make + +\--- no-print \--- + +Click the green flag to start the game. Press the space bar to make the parrot flap its wings, and try to get it to fly through the gaps in the pipes! You score one point for every pipe that you manage to get the parrot past. + +
+ + +
+ +\--- /no-print \--- + +\--- print-only \--- + +You will press the space bar to make the parrot flap its wings, and score one point for every pipe that you manage to get the parrot past. + +![flappy parrot game being played](images/flappy-parrot-showcase.png) + +\--- /print-only \--- + +## \--- collapse \--- + +## title: What you will need + +### Hardware + ++ A computer capable of running Scratch 3 + +### Software + ++ Scratch 3 (either [online](https://rpf.io/scratchon) or [offline](https://rpf.io/scratchoff)) + +\--- /collapse \--- + +## \--- collapse \--- + +## title: What you will learn + ++ How to create sprites using Vector mode ++ How to use sounds ++ How to detect collisions ++ How to control a sprite using the keyboard + +\--- /collapse \--- + +## \--- collapse \--- + +## title: Additional notes for educators + +\--- no-print \--- + +If you need to print this project, please use the [printer-friendly version](https://projects.raspberrypi.org/en/projects/flappy-parrot/print){:target="_blank"}. + +\--- /no-print \--- + +You can find the [completed project here](https://rpf.io/p/en/flappy-parrot-get). + +\--- /collapse \--- \ No newline at end of file diff --git a/pl-PL/step_10.md b/pl-PL/step_10.md new file mode 100644 index 0000000..a5808f3 --- /dev/null +++ b/pl-PL/step_10.md @@ -0,0 +1,9 @@ +## Challenge: add a high score + +\--- challenge \--- + +Can you add a high score to the game so that, in addition to keeping track of score for the current round, it keeps track of the highest score you've ever reached? + +[[[generic-scratch3-high-score]]] + +\--- /challenge \--- \ No newline at end of file diff --git a/pl-PL/step_11.md b/pl-PL/step_11.md new file mode 100644 index 0000000..02ae229 --- /dev/null +++ b/pl-PL/step_11.md @@ -0,0 +1,19 @@ +## What next? + +Try the [Binary hero](https://projects.raspberrypi.org/en/projects/binary-hero?utm_source=pathway&utm_medium=whatnext&utm_campaign=projects) project, where you will make a game in which you play the notes of a song as they scroll down the Stage. + +\--- no-print \--- + +Click the green flag to start the game. Use the z, x, c, and v keys to play the correct notes when these reach the bottom of the Stage. You'll score ten points for every correct note you play. + +
+ +
+ +\--- /no-print \--- + +\--- print-only \--- + +The notes will fall from above, and you will have to press keys to "catch" and play the notes. ![showcase](images/binary-showcase.png) + +\--- /print-only \--- \ No newline at end of file diff --git a/pl-PL/step_2.md b/pl-PL/step_2.md new file mode 100644 index 0000000..d8f2ce5 --- /dev/null +++ b/pl-PL/step_2.md @@ -0,0 +1,84 @@ +## Add the pipes + +First, create the pipes. + +\--- task \--- + +Open a new empty Scratch project. + +[[[generic-scratch3-new-project]]] + +\--- /task \--- + +\--- task \--- + +Add a backdrop with an outdoor landscape. 'Blue Sky' is a good choice. + +![screenshot](images/flappy-stage.png) + +[[[generic-scratch3-backdrop-from-library]]] + +\--- /task \--- + +\--- task \--- + +Create a new sprite and name it 'Pipes'. + +[[[generic-scratch3-draw-sprite]]] + +\--- /task \--- + +The 'Pipes' sprite should be a pair of pipes with a gap in the middle. By moving the sprite up or down, you can put the gap in a different place. + +This picture shows an example of how the pipes could be positioned. The parts of the sprite outside the Stage are normally hidden, you only see then when you drag the sprite: + +![screenshot](images/flappy-pipes-position.png) + +You can't draw a sprite as big as the pipes need to be, but you can increase the size at which the sprite shows on the Stage. + +\--- task \--- + +![pipes sprite](images/pipes-sprite.png) + +Add code to make the sprite bigger. + +```blocks3 +when green flag clicked +set size to (200) % +``` + +This makes it's easier to see how big the pipes should be. + +\--- /task \--- + +\--- task \--- + +Draw a rectangle for the top pipe as shown here: + +![rectangle for the pipe](images/flappy-pipes-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Fill the pipe with a colour you like. + +![fill the rectangle](images/flappy-pipes-fill-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Create a duplicate of the pipe by selecting it and then clicking on **Copy** and **Paste**. + +![copy and paste pipe](images/flappy-pipes-duplicate1-annotated.png) + +\--- /task \--- + +\--- task \--- + +Drag the copy of the pipe to the bottom of the screen so that the copy is in line with the other pipe. There needs to be a gap between the two pipes. + +![screenshot](images/flappy-pipes-duplicate2.png) + +\--- /task \--- \ No newline at end of file diff --git a/pl-PL/step_3.md b/pl-PL/step_3.md new file mode 100644 index 0000000..17f05f7 --- /dev/null +++ b/pl-PL/step_3.md @@ -0,0 +1,11 @@ +## Challenge: make better pipes + +Can you make your pipes look better? + ++ Shade your pipes with a left-to-right gradient. + +![screenshot](images/flappy-pipes-filled.png) + ++ Add extra rectangles to the ends of the pipes: + +![screenshot](images/flappy-pipes-ends.png) \ No newline at end of file diff --git a/pl-PL/step_4.md b/pl-PL/step_4.md new file mode 100644 index 0000000..2beedd9 --- /dev/null +++ b/pl-PL/step_4.md @@ -0,0 +1,65 @@ +## Make the pipes move + +Next you're going to make the pipes move across the screen to create an obstacle course. + +![pipes moving across the screen](images/flappy-clones-test.png) + +\--- task \--- + +First make the pipes appear by adding code to the Pipes sprite so that, `when the green flag is clicked`{:class="block3events"}, the sprite `forever`{:class="block3control"} `creates a clone of itself`{:class="block3control"} every two seconds. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +**Tip:** clones are just copies of a sprite, and they are really useful for creating games. + +\--- /task \--- + +\--- task \--- + +Next make the pipes move by adding code so that, `when a clone starts`{:class="block3control"}, the clone appears on the right side of the Stage and `glides`{:class="block3motion"} across to the left. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show +go to x: (240) y: (0) +glide (4) secs to x: (-240) y: (0) +delete this clone +``` + +**Tip:** you can stop the pipes scrolling by clicking the red **stop** button next to the green flag. + +\--- /task \--- + +Now you should have lots of pipes, but their gaps are always in the same place. + +You can add some variety by using a `random`{:class="block3operators"} number for the Pipes sprite's `y position`{:class="block3motion"}. + +![pipes at different heights](images/flappy-height-test.png) + +\--- task \--- + +Modify your sprite's code so that each sprite clone `picks a random number from -80 to 80`{:class="block3operators"} and `glides`{:class="block3motion"} to that `y position`{:class="block3motion"}: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show ++ go to x: (240) y: (pick random (-80) to (80)) ++ glide (4) secs to x: (-240) y: (y position) +delete this clone +``` + +\--- /task \--- \ No newline at end of file diff --git a/pl-PL/step_5.md b/pl-PL/step_5.md new file mode 100644 index 0000000..f9d79ce --- /dev/null +++ b/pl-PL/step_5.md @@ -0,0 +1,77 @@ +## Make Flappy fall + +Now add a sprite called Flappy and create code it so Flappy falls down the Stage. In the next step, you will add the code to make Flappy fly when you press a key. + +\--- no-print \--- + +![flappy falling animation](images/flappy-falling.gif) + +\--- /no-print \--- + +\--- task \--- + +Add a new sprite that has two costumes, for 'wings up' and 'wings down', and name it `Flappy`. + +The parrot sprite is a good choice. + +![parrot sprite](images/flappy-sprite.png) + +\--- /task \--- + +Flappy needs to be smaller. + +\--- task \--- + +Add code to `set Flappy's size to 25%`{:class="block3looks"} `when the green flag is clicked`{:class="block3events"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +``` + +\--- /task \--- + +When the game starts, Flappy needs to be just left of the centre of the Stage, at coordinates `-50, 0`. + +![flappy shown at the start position](images/flappy-starting-position.png) + +\--- task \--- + +Add code to make Flappy `go to the x and y`{:class="block3motion"} starting position of `x: -50`{:class="block3motion"} and `y: 0`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % ++ go to x: (-50) y: (0) +``` + +[[[generic-scratch3-set-coordinates]]] + +\--- /task \--- + +\--- task \--- + +Now make Flappy keep falling down the Stage by `forever`{:class="block3control"} `changing the sprite's y position by -3`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +go to x: (-50) y: (0) ++ forever + change y by (-3) +end +``` + +\--- /task \--- + +\--- task \--- + +Test your code to make sure Flappy starts in the middle of the screen and falls to the bottom. When you drag Flappy to the top of the Stage, the sprite should fall again. + +\--- /task \--- \ No newline at end of file diff --git a/pl-PL/step_6.md b/pl-PL/step_6.md new file mode 100644 index 0000000..1a98cb2 --- /dev/null +++ b/pl-PL/step_6.md @@ -0,0 +1,106 @@ +## Make Flappy fly + +Now you will make Flappy flap upwards when you press the space bar. When you play the game, you have to time your taps to get Flappy through the gaps in the pipes. + +\--- no-print \--- + +![flappy flying upwards when space bar is pressed](images/flappy-flying.gif) + +\--- /no-print \--- + +Make Flappy fly upwards when you tap the space bar. + +\--- task \--- + +When the `space key is pressed`{:class="block3events"}, Flappy should move upwards by `changing its y coordinate`{:class="block3motion"} by a small amount, for example `6`. + +Flappy flies upwards by `repeating`{:class="block3control"} this movement `10 times`{:class="block3control"}. + +Add this code to your `Flappy` sprite: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +repeat (10) + change y by (6) +end +``` + +\--- /task \--- + +Now you need to get Flappy's wings flapping! + +\--- task \--- + +Click on the **Costumes** tab, and name Flappy's costumes 'wings up' and 'wings down'. + +![naming the costumes](images/flappy-wings.png) + +\--- /task \--- + +\--- task \--- + +Can you make Flappy's costume change to `wings down` when you press space, and then change it back to `wings up` halfway through the upward movement? + +\--- hints \--- + +\--- hint \--- + +You need to split the upward motion in half so that you can use two `repeat`{:class="block3control"} blocks to change Flappy's costume at the beginning and in the middle of the movement. + +Add `switch costume to`{:class="block3looks"} blocks to change how Flappy looks. + +\--- /hint \--- \--- hint \--- + +You need to use these blocks: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +repeat (5) + change y by (6) +end + +repeat (5) + change y by (6) +end + +switch costume to (wings up v) + +switch costume to (wings down v) + +when [space v] key pressed +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +switch costume to (wings down v) +repeat (5) + change y by (6) +end +switch costume to (wings up v) +repeat (5) + change y by (6) +end +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code. As you see, at the moment nothing happens if you let Flappy hit a pipe. + +\--- /task \--- \ No newline at end of file diff --git a/pl-PL/step_7.md b/pl-PL/step_7.md new file mode 100644 index 0000000..40a2720 --- /dev/null +++ b/pl-PL/step_7.md @@ -0,0 +1,77 @@ +## Detect collisions + +To make the game a challenge, the player needs to guide Flappy through the gaps without letting the parrot touch the pipes or the edges of the Stage. You need to add some blocks to detect when Flappy hits something. + +This is called **collision detection**. + +\--- task \--- + +Import a sound from the library that you want to play when Flappy collides with something. The 'screech' sound is a good choice. + +[[[generic-scratch3-sound-from-library]]] + +\--- /task \--- + +A `wait until`{:class="block3control"} block is necessart to check whether Flappy is `touching the pipes`{:class="block3sensing"} `or`{:class="block3operators"} `touching the edge`{:class="block3sensing"}. + +\--- task \--- + +Add a new `when green flag clicked`{:class="block3control"} block to the 'Flappy' sprite, and also add the following code: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) +``` + +\--- /task \--- + +\--- task \--- + +Test your code. If Flappy touches a pipe, the 'screech' sound should play. + +\--- /task \--- + +Next, update the code so that the game stops when Flappy hits a pipe. + +\--- task \--- + +Add the following code to stop the game after a collision is detected: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) ++ say [Game Over!] ++ broadcast (Game Over v) ++ stop [other scripts in sprite v] +``` + +The `broadcast`{:class="block3events"} block tells other sprites that the game is over. + +The `stop`{:class="block3control"} block stops other Flappy scripts that are running so that Flappy stops falling after a collision. + +\--- /task \--- + +\--- task \--- + +Finally, add the following code to the `Pipes` sprite so that pipes `stop`{:class="block3control"} appearing `when the sprite receives Game Over`{:class="block3events"}. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I receive [Game Over v] +stop [other scripts in sprite v] +``` + +\--- /task \--- + +\--- task \--- + +Test your game and see how long you can play before it's 'Game over'! + +\--- /task \--- \ No newline at end of file diff --git a/pl-PL/step_8.md b/pl-PL/step_8.md new file mode 100644 index 0000000..2c5cc08 --- /dev/null +++ b/pl-PL/step_8.md @@ -0,0 +1,116 @@ +## Add a score + +The player should score a point every time Flappy makes it through a gap between pipes. + +\--- task \--- + +Make a new variable **for all sprites** and call it `score`{:class="block3variables"}. + +[[[generic-scratch3-add-variable]]] + +\--- /task \--- + +Each 'Pipes' sprite clone should `wait until`{:class="block3control"} Flappy has flown past and then increase the `score`{:class="block3variables"}. + +\--- task \--- + +First, `set score to 0`{:class="block3variables"} when the game begins: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked ++ set [score v] to [0] +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +\--- /task \--- + +\--- task \--- + +Then add the following code to the `Pipes` sprite: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> +``` + +\--- /task \--- + +\--- task \--- + +Add more code so that, when Flappy's `x` position is greater than the pipe clone's `x` position, the `score`{:class="block3variables"} increases by `1` and a sound of your choice plays. + +You could use the 'pop' sound if you want, or add a sound from the library, for example 'bird'. + +\--- hints \--- + +\--- hint \--- + +You need to `wait until`{:class="block3control"} `Flappy's x position`{:class="block3sensing"} is `greater than (>)`{:class="block3operators"} the `x position`{:class="block3motion"} of `Pipes`. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone ++ wait until <> +``` + +Then `change score by 1`{:class="block3variables"} and `play a sound`{:class="block3sound"}. + +\--- /hint \--- + +\--- hint \--- + +Use these blocks in the correct order: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> + +play sound (pop v) + +change [score v] by (1) + +[x position v] of (Flappy v) + +x position + +() > () +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <([x position v] of (Flappy v)) > (x position)> +change [score v] by (1) +play sound (pop v) +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code and make sure you score a point every time Flappy gets through a gap between pipes. Check whether the `score`{:class="block3variables"} is set to `0` when you start a new game. + +\--- /task \--- \ No newline at end of file diff --git a/pl-PL/step_9.md b/pl-PL/step_9.md new file mode 100644 index 0000000..2f4e2e6 --- /dev/null +++ b/pl-PL/step_9.md @@ -0,0 +1,5 @@ +## Challenge: adjust the difficulty + +Is the game too hard or too easy for you? How many ways can you find to change the difficulty? + +Adjust the game until you are happy with its difficulty! \ No newline at end of file diff --git a/pt-BR/images/banner.png b/pt-BR/images/banner.png new file mode 100644 index 0000000..7a0da5b Binary files /dev/null and b/pt-BR/images/banner.png differ diff --git a/pt-BR/images/binary-showcase.png b/pt-BR/images/binary-showcase.png new file mode 100644 index 0000000..499aa29 Binary files /dev/null and b/pt-BR/images/binary-showcase.png differ diff --git a/pt-BR/images/flappy-clones-test.png b/pt-BR/images/flappy-clones-test.png new file mode 100644 index 0000000..f874059 Binary files /dev/null and b/pt-BR/images/flappy-clones-test.png differ diff --git a/pt-BR/images/flappy-falling.gif b/pt-BR/images/flappy-falling.gif new file mode 100644 index 0000000..970d833 Binary files /dev/null and b/pt-BR/images/flappy-falling.gif differ diff --git a/pt-BR/images/flappy-flying.gif b/pt-BR/images/flappy-flying.gif new file mode 100644 index 0000000..e259ff1 Binary files /dev/null and b/pt-BR/images/flappy-flying.gif differ diff --git a/pt-BR/images/flappy-height-test.png b/pt-BR/images/flappy-height-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/pt-BR/images/flappy-height-test.png differ diff --git a/pt-BR/images/flappy-parrot-showcase.png b/pt-BR/images/flappy-parrot-showcase.png new file mode 100644 index 0000000..493049b Binary files /dev/null and b/pt-BR/images/flappy-parrot-showcase.png differ diff --git a/pt-BR/images/flappy-pipes-duplicate1-annotated.png b/pt-BR/images/flappy-pipes-duplicate1-annotated.png new file mode 100644 index 0000000..65e32c6 Binary files /dev/null and b/pt-BR/images/flappy-pipes-duplicate1-annotated.png differ diff --git a/pt-BR/images/flappy-pipes-duplicate1.png b/pt-BR/images/flappy-pipes-duplicate1.png new file mode 100644 index 0000000..4239b67 Binary files /dev/null and b/pt-BR/images/flappy-pipes-duplicate1.png differ diff --git a/pt-BR/images/flappy-pipes-duplicate2.png b/pt-BR/images/flappy-pipes-duplicate2.png new file mode 100644 index 0000000..ba1a69a Binary files /dev/null and b/pt-BR/images/flappy-pipes-duplicate2.png differ diff --git a/pt-BR/images/flappy-pipes-ends.png b/pt-BR/images/flappy-pipes-ends.png new file mode 100644 index 0000000..ab59aaa Binary files /dev/null and b/pt-BR/images/flappy-pipes-ends.png differ diff --git a/pt-BR/images/flappy-pipes-fill-rectangle.png b/pt-BR/images/flappy-pipes-fill-rectangle.png new file mode 100644 index 0000000..7360b87 Binary files /dev/null and b/pt-BR/images/flappy-pipes-fill-rectangle.png differ diff --git a/pt-BR/images/flappy-pipes-filled.png b/pt-BR/images/flappy-pipes-filled.png new file mode 100644 index 0000000..7d2c0dd Binary files /dev/null and b/pt-BR/images/flappy-pipes-filled.png differ diff --git a/pt-BR/images/flappy-pipes-position.png b/pt-BR/images/flappy-pipes-position.png new file mode 100644 index 0000000..ca2b810 Binary files /dev/null and b/pt-BR/images/flappy-pipes-position.png differ diff --git a/pt-BR/images/flappy-pipes-rectangle.png b/pt-BR/images/flappy-pipes-rectangle.png new file mode 100644 index 0000000..6e3bf02 Binary files /dev/null and b/pt-BR/images/flappy-pipes-rectangle.png differ diff --git a/pt-BR/images/flappy-pipes-test.png b/pt-BR/images/flappy-pipes-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/pt-BR/images/flappy-pipes-test.png differ diff --git a/pt-BR/images/flappy-setup.png b/pt-BR/images/flappy-setup.png new file mode 100644 index 0000000..92f9eca Binary files /dev/null and b/pt-BR/images/flappy-setup.png differ diff --git a/pt-BR/images/flappy-sprite.png b/pt-BR/images/flappy-sprite.png new file mode 100644 index 0000000..6a0c590 Binary files /dev/null and b/pt-BR/images/flappy-sprite.png differ diff --git a/pt-BR/images/flappy-stage.png b/pt-BR/images/flappy-stage.png new file mode 100644 index 0000000..5efe03c Binary files /dev/null and b/pt-BR/images/flappy-stage.png differ diff --git a/pt-BR/images/flappy-starting-position.png b/pt-BR/images/flappy-starting-position.png new file mode 100644 index 0000000..9089c9e Binary files /dev/null and b/pt-BR/images/flappy-starting-position.png differ diff --git a/pt-BR/images/flappy-wings.png b/pt-BR/images/flappy-wings.png new file mode 100644 index 0000000..ef0aa8e Binary files /dev/null and b/pt-BR/images/flappy-wings.png differ diff --git a/pt-BR/images/pipes-sprite.png b/pt-BR/images/pipes-sprite.png new file mode 100644 index 0000000..a9882ed Binary files /dev/null and b/pt-BR/images/pipes-sprite.png differ diff --git a/pt-BR/meta.yml b/pt-BR/meta.yml new file mode 100644 index 0000000..c2fe5e6 --- /dev/null +++ b/pt-BR/meta.yml @@ -0,0 +1,34 @@ +--- +title: Flappy parrot +hero_image: images/banner.png +description: Create a game in which you guide a parrot past moving obstacles +listed: true +copyedit: true +version: 4.1 +last_tested: 2018-10-90 +steps: + - + title: Introduction + - + title: Add the pipes + - + title: "Challenge: make better pipes" + challenge: true + - + title: Make the pipes move + - + title: Make Flappy fall + - + title: Make Flappy fly + - + title: Detect collisions + - + title: Add a score + - + title: 'Challenge: adjust the difficulty' + challenge: true + - + title: 'Challenge: add a high score' + challenge: true + - + title: What next? diff --git a/pt-BR/scratch-translatable.txt b/pt-BR/scratch-translatable.txt new file mode 100644 index 0000000..214e66c --- /dev/null +++ b/pt-BR/scratch-translatable.txt @@ -0,0 +1,13 @@ +Pipes + +costume1 + +Flappy + +wings down + +wings up + +Game Over! + +score diff --git a/pt-BR/solutions/FlappyParrot-Solution.sb3 b/pt-BR/solutions/FlappyParrot-Solution.sb3 new file mode 100644 index 0000000..a0cd354 Binary files /dev/null and b/pt-BR/solutions/FlappyParrot-Solution.sb3 differ diff --git a/pt-BR/step_1.md b/pt-BR/step_1.md new file mode 100644 index 0000000..f7519ae --- /dev/null +++ b/pt-BR/step_1.md @@ -0,0 +1,69 @@ +\--- no-print \--- + +This is the **Scratch 3** version of the project. There is also a [Scratch 2 version of the project](https://projects.raspberrypi.org/en/projects/flappy-parrot-scratch2). + +\--- /no-print \--- + +## Introduction + +Create a game in which you have to guide a parrot past scrolling pipes to score points. + +### What you will make + +\--- no-print \--- + +Click the green flag to start the game. Press the space bar to make the parrot flap its wings, and try to get it to fly through the gaps in the pipes! You score one point for every pipe that you manage to get the parrot past. + +
+ + +
+ +\--- /no-print \--- + +\--- print-only \--- + +You will press the space bar to make the parrot flap its wings, and score one point for every pipe that you manage to get the parrot past. + +![flappy parrot game being played](images/flappy-parrot-showcase.png) + +\--- /print-only \--- + +## \--- collapse \--- + +## title: What you will need + +### Hardware + ++ A computer capable of running Scratch 3 + +### Software + ++ Scratch 3 (either [online](https://rpf.io/scratchon) or [offline](https://rpf.io/scratchoff)) + +\--- /collapse \--- + +## \--- collapse \--- + +## title: What you will learn + ++ How to create sprites using Vector mode ++ How to use sounds ++ How to detect collisions ++ How to control a sprite using the keyboard + +\--- /collapse \--- + +## \--- collapse \--- + +## title: Additional notes for educators + +\--- no-print \--- + +If you need to print this project, please use the [printer-friendly version](https://projects.raspberrypi.org/en/projects/flappy-parrot/print){:target="_blank"}. + +\--- /no-print \--- + +You can find the [completed project here](https://rpf.io/p/en/flappy-parrot-get). + +\--- /collapse \--- \ No newline at end of file diff --git a/pt-BR/step_10.md b/pt-BR/step_10.md new file mode 100644 index 0000000..a5808f3 --- /dev/null +++ b/pt-BR/step_10.md @@ -0,0 +1,9 @@ +## Challenge: add a high score + +\--- challenge \--- + +Can you add a high score to the game so that, in addition to keeping track of score for the current round, it keeps track of the highest score you've ever reached? + +[[[generic-scratch3-high-score]]] + +\--- /challenge \--- \ No newline at end of file diff --git a/pt-BR/step_11.md b/pt-BR/step_11.md new file mode 100644 index 0000000..02ae229 --- /dev/null +++ b/pt-BR/step_11.md @@ -0,0 +1,19 @@ +## What next? + +Try the [Binary hero](https://projects.raspberrypi.org/en/projects/binary-hero?utm_source=pathway&utm_medium=whatnext&utm_campaign=projects) project, where you will make a game in which you play the notes of a song as they scroll down the Stage. + +\--- no-print \--- + +Click the green flag to start the game. Use the z, x, c, and v keys to play the correct notes when these reach the bottom of the Stage. You'll score ten points for every correct note you play. + +
+ +
+ +\--- /no-print \--- + +\--- print-only \--- + +The notes will fall from above, and you will have to press keys to "catch" and play the notes. ![showcase](images/binary-showcase.png) + +\--- /print-only \--- \ No newline at end of file diff --git a/pt-BR/step_2.md b/pt-BR/step_2.md new file mode 100644 index 0000000..d8f2ce5 --- /dev/null +++ b/pt-BR/step_2.md @@ -0,0 +1,84 @@ +## Add the pipes + +First, create the pipes. + +\--- task \--- + +Open a new empty Scratch project. + +[[[generic-scratch3-new-project]]] + +\--- /task \--- + +\--- task \--- + +Add a backdrop with an outdoor landscape. 'Blue Sky' is a good choice. + +![screenshot](images/flappy-stage.png) + +[[[generic-scratch3-backdrop-from-library]]] + +\--- /task \--- + +\--- task \--- + +Create a new sprite and name it 'Pipes'. + +[[[generic-scratch3-draw-sprite]]] + +\--- /task \--- + +The 'Pipes' sprite should be a pair of pipes with a gap in the middle. By moving the sprite up or down, you can put the gap in a different place. + +This picture shows an example of how the pipes could be positioned. The parts of the sprite outside the Stage are normally hidden, you only see then when you drag the sprite: + +![screenshot](images/flappy-pipes-position.png) + +You can't draw a sprite as big as the pipes need to be, but you can increase the size at which the sprite shows on the Stage. + +\--- task \--- + +![pipes sprite](images/pipes-sprite.png) + +Add code to make the sprite bigger. + +```blocks3 +when green flag clicked +set size to (200) % +``` + +This makes it's easier to see how big the pipes should be. + +\--- /task \--- + +\--- task \--- + +Draw a rectangle for the top pipe as shown here: + +![rectangle for the pipe](images/flappy-pipes-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Fill the pipe with a colour you like. + +![fill the rectangle](images/flappy-pipes-fill-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Create a duplicate of the pipe by selecting it and then clicking on **Copy** and **Paste**. + +![copy and paste pipe](images/flappy-pipes-duplicate1-annotated.png) + +\--- /task \--- + +\--- task \--- + +Drag the copy of the pipe to the bottom of the screen so that the copy is in line with the other pipe. There needs to be a gap between the two pipes. + +![screenshot](images/flappy-pipes-duplicate2.png) + +\--- /task \--- \ No newline at end of file diff --git a/pt-BR/step_3.md b/pt-BR/step_3.md new file mode 100644 index 0000000..17f05f7 --- /dev/null +++ b/pt-BR/step_3.md @@ -0,0 +1,11 @@ +## Challenge: make better pipes + +Can you make your pipes look better? + ++ Shade your pipes with a left-to-right gradient. + +![screenshot](images/flappy-pipes-filled.png) + ++ Add extra rectangles to the ends of the pipes: + +![screenshot](images/flappy-pipes-ends.png) \ No newline at end of file diff --git a/pt-BR/step_4.md b/pt-BR/step_4.md new file mode 100644 index 0000000..2beedd9 --- /dev/null +++ b/pt-BR/step_4.md @@ -0,0 +1,65 @@ +## Make the pipes move + +Next you're going to make the pipes move across the screen to create an obstacle course. + +![pipes moving across the screen](images/flappy-clones-test.png) + +\--- task \--- + +First make the pipes appear by adding code to the Pipes sprite so that, `when the green flag is clicked`{:class="block3events"}, the sprite `forever`{:class="block3control"} `creates a clone of itself`{:class="block3control"} every two seconds. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +**Tip:** clones are just copies of a sprite, and they are really useful for creating games. + +\--- /task \--- + +\--- task \--- + +Next make the pipes move by adding code so that, `when a clone starts`{:class="block3control"}, the clone appears on the right side of the Stage and `glides`{:class="block3motion"} across to the left. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show +go to x: (240) y: (0) +glide (4) secs to x: (-240) y: (0) +delete this clone +``` + +**Tip:** you can stop the pipes scrolling by clicking the red **stop** button next to the green flag. + +\--- /task \--- + +Now you should have lots of pipes, but their gaps are always in the same place. + +You can add some variety by using a `random`{:class="block3operators"} number for the Pipes sprite's `y position`{:class="block3motion"}. + +![pipes at different heights](images/flappy-height-test.png) + +\--- task \--- + +Modify your sprite's code so that each sprite clone `picks a random number from -80 to 80`{:class="block3operators"} and `glides`{:class="block3motion"} to that `y position`{:class="block3motion"}: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show ++ go to x: (240) y: (pick random (-80) to (80)) ++ glide (4) secs to x: (-240) y: (y position) +delete this clone +``` + +\--- /task \--- \ No newline at end of file diff --git a/pt-BR/step_5.md b/pt-BR/step_5.md new file mode 100644 index 0000000..f9d79ce --- /dev/null +++ b/pt-BR/step_5.md @@ -0,0 +1,77 @@ +## Make Flappy fall + +Now add a sprite called Flappy and create code it so Flappy falls down the Stage. In the next step, you will add the code to make Flappy fly when you press a key. + +\--- no-print \--- + +![flappy falling animation](images/flappy-falling.gif) + +\--- /no-print \--- + +\--- task \--- + +Add a new sprite that has two costumes, for 'wings up' and 'wings down', and name it `Flappy`. + +The parrot sprite is a good choice. + +![parrot sprite](images/flappy-sprite.png) + +\--- /task \--- + +Flappy needs to be smaller. + +\--- task \--- + +Add code to `set Flappy's size to 25%`{:class="block3looks"} `when the green flag is clicked`{:class="block3events"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +``` + +\--- /task \--- + +When the game starts, Flappy needs to be just left of the centre of the Stage, at coordinates `-50, 0`. + +![flappy shown at the start position](images/flappy-starting-position.png) + +\--- task \--- + +Add code to make Flappy `go to the x and y`{:class="block3motion"} starting position of `x: -50`{:class="block3motion"} and `y: 0`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % ++ go to x: (-50) y: (0) +``` + +[[[generic-scratch3-set-coordinates]]] + +\--- /task \--- + +\--- task \--- + +Now make Flappy keep falling down the Stage by `forever`{:class="block3control"} `changing the sprite's y position by -3`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +go to x: (-50) y: (0) ++ forever + change y by (-3) +end +``` + +\--- /task \--- + +\--- task \--- + +Test your code to make sure Flappy starts in the middle of the screen and falls to the bottom. When you drag Flappy to the top of the Stage, the sprite should fall again. + +\--- /task \--- \ No newline at end of file diff --git a/pt-BR/step_6.md b/pt-BR/step_6.md new file mode 100644 index 0000000..1a98cb2 --- /dev/null +++ b/pt-BR/step_6.md @@ -0,0 +1,106 @@ +## Make Flappy fly + +Now you will make Flappy flap upwards when you press the space bar. When you play the game, you have to time your taps to get Flappy through the gaps in the pipes. + +\--- no-print \--- + +![flappy flying upwards when space bar is pressed](images/flappy-flying.gif) + +\--- /no-print \--- + +Make Flappy fly upwards when you tap the space bar. + +\--- task \--- + +When the `space key is pressed`{:class="block3events"}, Flappy should move upwards by `changing its y coordinate`{:class="block3motion"} by a small amount, for example `6`. + +Flappy flies upwards by `repeating`{:class="block3control"} this movement `10 times`{:class="block3control"}. + +Add this code to your `Flappy` sprite: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +repeat (10) + change y by (6) +end +``` + +\--- /task \--- + +Now you need to get Flappy's wings flapping! + +\--- task \--- + +Click on the **Costumes** tab, and name Flappy's costumes 'wings up' and 'wings down'. + +![naming the costumes](images/flappy-wings.png) + +\--- /task \--- + +\--- task \--- + +Can you make Flappy's costume change to `wings down` when you press space, and then change it back to `wings up` halfway through the upward movement? + +\--- hints \--- + +\--- hint \--- + +You need to split the upward motion in half so that you can use two `repeat`{:class="block3control"} blocks to change Flappy's costume at the beginning and in the middle of the movement. + +Add `switch costume to`{:class="block3looks"} blocks to change how Flappy looks. + +\--- /hint \--- \--- hint \--- + +You need to use these blocks: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +repeat (5) + change y by (6) +end + +repeat (5) + change y by (6) +end + +switch costume to (wings up v) + +switch costume to (wings down v) + +when [space v] key pressed +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +switch costume to (wings down v) +repeat (5) + change y by (6) +end +switch costume to (wings up v) +repeat (5) + change y by (6) +end +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code. As you see, at the moment nothing happens if you let Flappy hit a pipe. + +\--- /task \--- \ No newline at end of file diff --git a/pt-BR/step_7.md b/pt-BR/step_7.md new file mode 100644 index 0000000..40a2720 --- /dev/null +++ b/pt-BR/step_7.md @@ -0,0 +1,77 @@ +## Detect collisions + +To make the game a challenge, the player needs to guide Flappy through the gaps without letting the parrot touch the pipes or the edges of the Stage. You need to add some blocks to detect when Flappy hits something. + +This is called **collision detection**. + +\--- task \--- + +Import a sound from the library that you want to play when Flappy collides with something. The 'screech' sound is a good choice. + +[[[generic-scratch3-sound-from-library]]] + +\--- /task \--- + +A `wait until`{:class="block3control"} block is necessart to check whether Flappy is `touching the pipes`{:class="block3sensing"} `or`{:class="block3operators"} `touching the edge`{:class="block3sensing"}. + +\--- task \--- + +Add a new `when green flag clicked`{:class="block3control"} block to the 'Flappy' sprite, and also add the following code: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) +``` + +\--- /task \--- + +\--- task \--- + +Test your code. If Flappy touches a pipe, the 'screech' sound should play. + +\--- /task \--- + +Next, update the code so that the game stops when Flappy hits a pipe. + +\--- task \--- + +Add the following code to stop the game after a collision is detected: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) ++ say [Game Over!] ++ broadcast (Game Over v) ++ stop [other scripts in sprite v] +``` + +The `broadcast`{:class="block3events"} block tells other sprites that the game is over. + +The `stop`{:class="block3control"} block stops other Flappy scripts that are running so that Flappy stops falling after a collision. + +\--- /task \--- + +\--- task \--- + +Finally, add the following code to the `Pipes` sprite so that pipes `stop`{:class="block3control"} appearing `when the sprite receives Game Over`{:class="block3events"}. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I receive [Game Over v] +stop [other scripts in sprite v] +``` + +\--- /task \--- + +\--- task \--- + +Test your game and see how long you can play before it's 'Game over'! + +\--- /task \--- \ No newline at end of file diff --git a/pt-BR/step_8.md b/pt-BR/step_8.md new file mode 100644 index 0000000..2c5cc08 --- /dev/null +++ b/pt-BR/step_8.md @@ -0,0 +1,116 @@ +## Add a score + +The player should score a point every time Flappy makes it through a gap between pipes. + +\--- task \--- + +Make a new variable **for all sprites** and call it `score`{:class="block3variables"}. + +[[[generic-scratch3-add-variable]]] + +\--- /task \--- + +Each 'Pipes' sprite clone should `wait until`{:class="block3control"} Flappy has flown past and then increase the `score`{:class="block3variables"}. + +\--- task \--- + +First, `set score to 0`{:class="block3variables"} when the game begins: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked ++ set [score v] to [0] +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +\--- /task \--- + +\--- task \--- + +Then add the following code to the `Pipes` sprite: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> +``` + +\--- /task \--- + +\--- task \--- + +Add more code so that, when Flappy's `x` position is greater than the pipe clone's `x` position, the `score`{:class="block3variables"} increases by `1` and a sound of your choice plays. + +You could use the 'pop' sound if you want, or add a sound from the library, for example 'bird'. + +\--- hints \--- + +\--- hint \--- + +You need to `wait until`{:class="block3control"} `Flappy's x position`{:class="block3sensing"} is `greater than (>)`{:class="block3operators"} the `x position`{:class="block3motion"} of `Pipes`. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone ++ wait until <> +``` + +Then `change score by 1`{:class="block3variables"} and `play a sound`{:class="block3sound"}. + +\--- /hint \--- + +\--- hint \--- + +Use these blocks in the correct order: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> + +play sound (pop v) + +change [score v] by (1) + +[x position v] of (Flappy v) + +x position + +() > () +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <([x position v] of (Flappy v)) > (x position)> +change [score v] by (1) +play sound (pop v) +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code and make sure you score a point every time Flappy gets through a gap between pipes. Check whether the `score`{:class="block3variables"} is set to `0` when you start a new game. + +\--- /task \--- \ No newline at end of file diff --git a/pt-BR/step_9.md b/pt-BR/step_9.md new file mode 100644 index 0000000..2f4e2e6 --- /dev/null +++ b/pt-BR/step_9.md @@ -0,0 +1,5 @@ +## Challenge: adjust the difficulty + +Is the game too hard or too easy for you? How many ways can you find to change the difficulty? + +Adjust the game until you are happy with its difficulty! \ No newline at end of file diff --git a/pt-PT/images/banner.png b/pt-PT/images/banner.png new file mode 100644 index 0000000..7a0da5b Binary files /dev/null and b/pt-PT/images/banner.png differ diff --git a/pt-PT/images/binary-showcase.png b/pt-PT/images/binary-showcase.png new file mode 100644 index 0000000..499aa29 Binary files /dev/null and b/pt-PT/images/binary-showcase.png differ diff --git a/pt-PT/images/flappy-clones-test.png b/pt-PT/images/flappy-clones-test.png new file mode 100644 index 0000000..f874059 Binary files /dev/null and b/pt-PT/images/flappy-clones-test.png differ diff --git a/pt-PT/images/flappy-falling.gif b/pt-PT/images/flappy-falling.gif new file mode 100644 index 0000000..970d833 Binary files /dev/null and b/pt-PT/images/flappy-falling.gif differ diff --git a/pt-PT/images/flappy-flying.gif b/pt-PT/images/flappy-flying.gif new file mode 100644 index 0000000..e259ff1 Binary files /dev/null and b/pt-PT/images/flappy-flying.gif differ diff --git a/pt-PT/images/flappy-height-test.png b/pt-PT/images/flappy-height-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/pt-PT/images/flappy-height-test.png differ diff --git a/pt-PT/images/flappy-parrot-showcase.png b/pt-PT/images/flappy-parrot-showcase.png new file mode 100644 index 0000000..493049b Binary files /dev/null and b/pt-PT/images/flappy-parrot-showcase.png differ diff --git a/pt-PT/images/flappy-pipes-duplicate1-annotated.png b/pt-PT/images/flappy-pipes-duplicate1-annotated.png new file mode 100644 index 0000000..65e32c6 Binary files /dev/null and b/pt-PT/images/flappy-pipes-duplicate1-annotated.png differ diff --git a/pt-PT/images/flappy-pipes-duplicate1.png b/pt-PT/images/flappy-pipes-duplicate1.png new file mode 100644 index 0000000..4239b67 Binary files /dev/null and b/pt-PT/images/flappy-pipes-duplicate1.png differ diff --git a/pt-PT/images/flappy-pipes-duplicate2.png b/pt-PT/images/flappy-pipes-duplicate2.png new file mode 100644 index 0000000..ba1a69a Binary files /dev/null and b/pt-PT/images/flappy-pipes-duplicate2.png differ diff --git a/pt-PT/images/flappy-pipes-ends.png b/pt-PT/images/flappy-pipes-ends.png new file mode 100644 index 0000000..ab59aaa Binary files /dev/null and b/pt-PT/images/flappy-pipes-ends.png differ diff --git a/pt-PT/images/flappy-pipes-fill-rectangle.png b/pt-PT/images/flappy-pipes-fill-rectangle.png new file mode 100644 index 0000000..7360b87 Binary files /dev/null and b/pt-PT/images/flappy-pipes-fill-rectangle.png differ diff --git a/pt-PT/images/flappy-pipes-filled.png b/pt-PT/images/flappy-pipes-filled.png new file mode 100644 index 0000000..7d2c0dd Binary files /dev/null and b/pt-PT/images/flappy-pipes-filled.png differ diff --git a/pt-PT/images/flappy-pipes-position.png b/pt-PT/images/flappy-pipes-position.png new file mode 100644 index 0000000..ca2b810 Binary files /dev/null and b/pt-PT/images/flappy-pipes-position.png differ diff --git a/pt-PT/images/flappy-pipes-rectangle.png b/pt-PT/images/flappy-pipes-rectangle.png new file mode 100644 index 0000000..6e3bf02 Binary files /dev/null and b/pt-PT/images/flappy-pipes-rectangle.png differ diff --git a/pt-PT/images/flappy-pipes-test.png b/pt-PT/images/flappy-pipes-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/pt-PT/images/flappy-pipes-test.png differ diff --git a/pt-PT/images/flappy-setup.png b/pt-PT/images/flappy-setup.png new file mode 100644 index 0000000..92f9eca Binary files /dev/null and b/pt-PT/images/flappy-setup.png differ diff --git a/pt-PT/images/flappy-sprite.png b/pt-PT/images/flappy-sprite.png new file mode 100644 index 0000000..6a0c590 Binary files /dev/null and b/pt-PT/images/flappy-sprite.png differ diff --git a/pt-PT/images/flappy-stage.png b/pt-PT/images/flappy-stage.png new file mode 100644 index 0000000..5efe03c Binary files /dev/null and b/pt-PT/images/flappy-stage.png differ diff --git a/pt-PT/images/flappy-starting-position.png b/pt-PT/images/flappy-starting-position.png new file mode 100644 index 0000000..9089c9e Binary files /dev/null and b/pt-PT/images/flappy-starting-position.png differ diff --git a/pt-PT/images/flappy-wings.png b/pt-PT/images/flappy-wings.png new file mode 100644 index 0000000..ef0aa8e Binary files /dev/null and b/pt-PT/images/flappy-wings.png differ diff --git a/pt-PT/images/pipes-sprite.png b/pt-PT/images/pipes-sprite.png new file mode 100644 index 0000000..a9882ed Binary files /dev/null and b/pt-PT/images/pipes-sprite.png differ diff --git a/pt-PT/meta.yml b/pt-PT/meta.yml new file mode 100644 index 0000000..c2fe5e6 --- /dev/null +++ b/pt-PT/meta.yml @@ -0,0 +1,34 @@ +--- +title: Flappy parrot +hero_image: images/banner.png +description: Create a game in which you guide a parrot past moving obstacles +listed: true +copyedit: true +version: 4.1 +last_tested: 2018-10-90 +steps: + - + title: Introduction + - + title: Add the pipes + - + title: "Challenge: make better pipes" + challenge: true + - + title: Make the pipes move + - + title: Make Flappy fall + - + title: Make Flappy fly + - + title: Detect collisions + - + title: Add a score + - + title: 'Challenge: adjust the difficulty' + challenge: true + - + title: 'Challenge: add a high score' + challenge: true + - + title: What next? diff --git a/pt-PT/scratch-translatable.txt b/pt-PT/scratch-translatable.txt new file mode 100644 index 0000000..214e66c --- /dev/null +++ b/pt-PT/scratch-translatable.txt @@ -0,0 +1,13 @@ +Pipes + +costume1 + +Flappy + +wings down + +wings up + +Game Over! + +score diff --git a/pt-PT/solutions/FlappyParrot-Solution.sb3 b/pt-PT/solutions/FlappyParrot-Solution.sb3 new file mode 100644 index 0000000..a0cd354 Binary files /dev/null and b/pt-PT/solutions/FlappyParrot-Solution.sb3 differ diff --git a/pt-PT/step_1.md b/pt-PT/step_1.md new file mode 100644 index 0000000..f7519ae --- /dev/null +++ b/pt-PT/step_1.md @@ -0,0 +1,69 @@ +\--- no-print \--- + +This is the **Scratch 3** version of the project. There is also a [Scratch 2 version of the project](https://projects.raspberrypi.org/en/projects/flappy-parrot-scratch2). + +\--- /no-print \--- + +## Introduction + +Create a game in which you have to guide a parrot past scrolling pipes to score points. + +### What you will make + +\--- no-print \--- + +Click the green flag to start the game. Press the space bar to make the parrot flap its wings, and try to get it to fly through the gaps in the pipes! You score one point for every pipe that you manage to get the parrot past. + +
+ + +
+ +\--- /no-print \--- + +\--- print-only \--- + +You will press the space bar to make the parrot flap its wings, and score one point for every pipe that you manage to get the parrot past. + +![flappy parrot game being played](images/flappy-parrot-showcase.png) + +\--- /print-only \--- + +## \--- collapse \--- + +## title: What you will need + +### Hardware + ++ A computer capable of running Scratch 3 + +### Software + ++ Scratch 3 (either [online](https://rpf.io/scratchon) or [offline](https://rpf.io/scratchoff)) + +\--- /collapse \--- + +## \--- collapse \--- + +## title: What you will learn + ++ How to create sprites using Vector mode ++ How to use sounds ++ How to detect collisions ++ How to control a sprite using the keyboard + +\--- /collapse \--- + +## \--- collapse \--- + +## title: Additional notes for educators + +\--- no-print \--- + +If you need to print this project, please use the [printer-friendly version](https://projects.raspberrypi.org/en/projects/flappy-parrot/print){:target="_blank"}. + +\--- /no-print \--- + +You can find the [completed project here](https://rpf.io/p/en/flappy-parrot-get). + +\--- /collapse \--- \ No newline at end of file diff --git a/pt-PT/step_10.md b/pt-PT/step_10.md new file mode 100644 index 0000000..a5808f3 --- /dev/null +++ b/pt-PT/step_10.md @@ -0,0 +1,9 @@ +## Challenge: add a high score + +\--- challenge \--- + +Can you add a high score to the game so that, in addition to keeping track of score for the current round, it keeps track of the highest score you've ever reached? + +[[[generic-scratch3-high-score]]] + +\--- /challenge \--- \ No newline at end of file diff --git a/pt-PT/step_11.md b/pt-PT/step_11.md new file mode 100644 index 0000000..02ae229 --- /dev/null +++ b/pt-PT/step_11.md @@ -0,0 +1,19 @@ +## What next? + +Try the [Binary hero](https://projects.raspberrypi.org/en/projects/binary-hero?utm_source=pathway&utm_medium=whatnext&utm_campaign=projects) project, where you will make a game in which you play the notes of a song as they scroll down the Stage. + +\--- no-print \--- + +Click the green flag to start the game. Use the z, x, c, and v keys to play the correct notes when these reach the bottom of the Stage. You'll score ten points for every correct note you play. + +
+ +
+ +\--- /no-print \--- + +\--- print-only \--- + +The notes will fall from above, and you will have to press keys to "catch" and play the notes. ![showcase](images/binary-showcase.png) + +\--- /print-only \--- \ No newline at end of file diff --git a/pt-PT/step_2.md b/pt-PT/step_2.md new file mode 100644 index 0000000..d8f2ce5 --- /dev/null +++ b/pt-PT/step_2.md @@ -0,0 +1,84 @@ +## Add the pipes + +First, create the pipes. + +\--- task \--- + +Open a new empty Scratch project. + +[[[generic-scratch3-new-project]]] + +\--- /task \--- + +\--- task \--- + +Add a backdrop with an outdoor landscape. 'Blue Sky' is a good choice. + +![screenshot](images/flappy-stage.png) + +[[[generic-scratch3-backdrop-from-library]]] + +\--- /task \--- + +\--- task \--- + +Create a new sprite and name it 'Pipes'. + +[[[generic-scratch3-draw-sprite]]] + +\--- /task \--- + +The 'Pipes' sprite should be a pair of pipes with a gap in the middle. By moving the sprite up or down, you can put the gap in a different place. + +This picture shows an example of how the pipes could be positioned. The parts of the sprite outside the Stage are normally hidden, you only see then when you drag the sprite: + +![screenshot](images/flappy-pipes-position.png) + +You can't draw a sprite as big as the pipes need to be, but you can increase the size at which the sprite shows on the Stage. + +\--- task \--- + +![pipes sprite](images/pipes-sprite.png) + +Add code to make the sprite bigger. + +```blocks3 +when green flag clicked +set size to (200) % +``` + +This makes it's easier to see how big the pipes should be. + +\--- /task \--- + +\--- task \--- + +Draw a rectangle for the top pipe as shown here: + +![rectangle for the pipe](images/flappy-pipes-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Fill the pipe with a colour you like. + +![fill the rectangle](images/flappy-pipes-fill-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Create a duplicate of the pipe by selecting it and then clicking on **Copy** and **Paste**. + +![copy and paste pipe](images/flappy-pipes-duplicate1-annotated.png) + +\--- /task \--- + +\--- task \--- + +Drag the copy of the pipe to the bottom of the screen so that the copy is in line with the other pipe. There needs to be a gap between the two pipes. + +![screenshot](images/flappy-pipes-duplicate2.png) + +\--- /task \--- \ No newline at end of file diff --git a/pt-PT/step_3.md b/pt-PT/step_3.md new file mode 100644 index 0000000..17f05f7 --- /dev/null +++ b/pt-PT/step_3.md @@ -0,0 +1,11 @@ +## Challenge: make better pipes + +Can you make your pipes look better? + ++ Shade your pipes with a left-to-right gradient. + +![screenshot](images/flappy-pipes-filled.png) + ++ Add extra rectangles to the ends of the pipes: + +![screenshot](images/flappy-pipes-ends.png) \ No newline at end of file diff --git a/pt-PT/step_4.md b/pt-PT/step_4.md new file mode 100644 index 0000000..2beedd9 --- /dev/null +++ b/pt-PT/step_4.md @@ -0,0 +1,65 @@ +## Make the pipes move + +Next you're going to make the pipes move across the screen to create an obstacle course. + +![pipes moving across the screen](images/flappy-clones-test.png) + +\--- task \--- + +First make the pipes appear by adding code to the Pipes sprite so that, `when the green flag is clicked`{:class="block3events"}, the sprite `forever`{:class="block3control"} `creates a clone of itself`{:class="block3control"} every two seconds. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +**Tip:** clones are just copies of a sprite, and they are really useful for creating games. + +\--- /task \--- + +\--- task \--- + +Next make the pipes move by adding code so that, `when a clone starts`{:class="block3control"}, the clone appears on the right side of the Stage and `glides`{:class="block3motion"} across to the left. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show +go to x: (240) y: (0) +glide (4) secs to x: (-240) y: (0) +delete this clone +``` + +**Tip:** you can stop the pipes scrolling by clicking the red **stop** button next to the green flag. + +\--- /task \--- + +Now you should have lots of pipes, but their gaps are always in the same place. + +You can add some variety by using a `random`{:class="block3operators"} number for the Pipes sprite's `y position`{:class="block3motion"}. + +![pipes at different heights](images/flappy-height-test.png) + +\--- task \--- + +Modify your sprite's code so that each sprite clone `picks a random number from -80 to 80`{:class="block3operators"} and `glides`{:class="block3motion"} to that `y position`{:class="block3motion"}: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show ++ go to x: (240) y: (pick random (-80) to (80)) ++ glide (4) secs to x: (-240) y: (y position) +delete this clone +``` + +\--- /task \--- \ No newline at end of file diff --git a/pt-PT/step_5.md b/pt-PT/step_5.md new file mode 100644 index 0000000..f9d79ce --- /dev/null +++ b/pt-PT/step_5.md @@ -0,0 +1,77 @@ +## Make Flappy fall + +Now add a sprite called Flappy and create code it so Flappy falls down the Stage. In the next step, you will add the code to make Flappy fly when you press a key. + +\--- no-print \--- + +![flappy falling animation](images/flappy-falling.gif) + +\--- /no-print \--- + +\--- task \--- + +Add a new sprite that has two costumes, for 'wings up' and 'wings down', and name it `Flappy`. + +The parrot sprite is a good choice. + +![parrot sprite](images/flappy-sprite.png) + +\--- /task \--- + +Flappy needs to be smaller. + +\--- task \--- + +Add code to `set Flappy's size to 25%`{:class="block3looks"} `when the green flag is clicked`{:class="block3events"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +``` + +\--- /task \--- + +When the game starts, Flappy needs to be just left of the centre of the Stage, at coordinates `-50, 0`. + +![flappy shown at the start position](images/flappy-starting-position.png) + +\--- task \--- + +Add code to make Flappy `go to the x and y`{:class="block3motion"} starting position of `x: -50`{:class="block3motion"} and `y: 0`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % ++ go to x: (-50) y: (0) +``` + +[[[generic-scratch3-set-coordinates]]] + +\--- /task \--- + +\--- task \--- + +Now make Flappy keep falling down the Stage by `forever`{:class="block3control"} `changing the sprite's y position by -3`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +go to x: (-50) y: (0) ++ forever + change y by (-3) +end +``` + +\--- /task \--- + +\--- task \--- + +Test your code to make sure Flappy starts in the middle of the screen and falls to the bottom. When you drag Flappy to the top of the Stage, the sprite should fall again. + +\--- /task \--- \ No newline at end of file diff --git a/pt-PT/step_6.md b/pt-PT/step_6.md new file mode 100644 index 0000000..1a98cb2 --- /dev/null +++ b/pt-PT/step_6.md @@ -0,0 +1,106 @@ +## Make Flappy fly + +Now you will make Flappy flap upwards when you press the space bar. When you play the game, you have to time your taps to get Flappy through the gaps in the pipes. + +\--- no-print \--- + +![flappy flying upwards when space bar is pressed](images/flappy-flying.gif) + +\--- /no-print \--- + +Make Flappy fly upwards when you tap the space bar. + +\--- task \--- + +When the `space key is pressed`{:class="block3events"}, Flappy should move upwards by `changing its y coordinate`{:class="block3motion"} by a small amount, for example `6`. + +Flappy flies upwards by `repeating`{:class="block3control"} this movement `10 times`{:class="block3control"}. + +Add this code to your `Flappy` sprite: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +repeat (10) + change y by (6) +end +``` + +\--- /task \--- + +Now you need to get Flappy's wings flapping! + +\--- task \--- + +Click on the **Costumes** tab, and name Flappy's costumes 'wings up' and 'wings down'. + +![naming the costumes](images/flappy-wings.png) + +\--- /task \--- + +\--- task \--- + +Can you make Flappy's costume change to `wings down` when you press space, and then change it back to `wings up` halfway through the upward movement? + +\--- hints \--- + +\--- hint \--- + +You need to split the upward motion in half so that you can use two `repeat`{:class="block3control"} blocks to change Flappy's costume at the beginning and in the middle of the movement. + +Add `switch costume to`{:class="block3looks"} blocks to change how Flappy looks. + +\--- /hint \--- \--- hint \--- + +You need to use these blocks: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +repeat (5) + change y by (6) +end + +repeat (5) + change y by (6) +end + +switch costume to (wings up v) + +switch costume to (wings down v) + +when [space v] key pressed +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +switch costume to (wings down v) +repeat (5) + change y by (6) +end +switch costume to (wings up v) +repeat (5) + change y by (6) +end +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code. As you see, at the moment nothing happens if you let Flappy hit a pipe. + +\--- /task \--- \ No newline at end of file diff --git a/pt-PT/step_7.md b/pt-PT/step_7.md new file mode 100644 index 0000000..40a2720 --- /dev/null +++ b/pt-PT/step_7.md @@ -0,0 +1,77 @@ +## Detect collisions + +To make the game a challenge, the player needs to guide Flappy through the gaps without letting the parrot touch the pipes or the edges of the Stage. You need to add some blocks to detect when Flappy hits something. + +This is called **collision detection**. + +\--- task \--- + +Import a sound from the library that you want to play when Flappy collides with something. The 'screech' sound is a good choice. + +[[[generic-scratch3-sound-from-library]]] + +\--- /task \--- + +A `wait until`{:class="block3control"} block is necessart to check whether Flappy is `touching the pipes`{:class="block3sensing"} `or`{:class="block3operators"} `touching the edge`{:class="block3sensing"}. + +\--- task \--- + +Add a new `when green flag clicked`{:class="block3control"} block to the 'Flappy' sprite, and also add the following code: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) +``` + +\--- /task \--- + +\--- task \--- + +Test your code. If Flappy touches a pipe, the 'screech' sound should play. + +\--- /task \--- + +Next, update the code so that the game stops when Flappy hits a pipe. + +\--- task \--- + +Add the following code to stop the game after a collision is detected: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) ++ say [Game Over!] ++ broadcast (Game Over v) ++ stop [other scripts in sprite v] +``` + +The `broadcast`{:class="block3events"} block tells other sprites that the game is over. + +The `stop`{:class="block3control"} block stops other Flappy scripts that are running so that Flappy stops falling after a collision. + +\--- /task \--- + +\--- task \--- + +Finally, add the following code to the `Pipes` sprite so that pipes `stop`{:class="block3control"} appearing `when the sprite receives Game Over`{:class="block3events"}. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I receive [Game Over v] +stop [other scripts in sprite v] +``` + +\--- /task \--- + +\--- task \--- + +Test your game and see how long you can play before it's 'Game over'! + +\--- /task \--- \ No newline at end of file diff --git a/pt-PT/step_8.md b/pt-PT/step_8.md new file mode 100644 index 0000000..2c5cc08 --- /dev/null +++ b/pt-PT/step_8.md @@ -0,0 +1,116 @@ +## Add a score + +The player should score a point every time Flappy makes it through a gap between pipes. + +\--- task \--- + +Make a new variable **for all sprites** and call it `score`{:class="block3variables"}. + +[[[generic-scratch3-add-variable]]] + +\--- /task \--- + +Each 'Pipes' sprite clone should `wait until`{:class="block3control"} Flappy has flown past and then increase the `score`{:class="block3variables"}. + +\--- task \--- + +First, `set score to 0`{:class="block3variables"} when the game begins: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked ++ set [score v] to [0] +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +\--- /task \--- + +\--- task \--- + +Then add the following code to the `Pipes` sprite: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> +``` + +\--- /task \--- + +\--- task \--- + +Add more code so that, when Flappy's `x` position is greater than the pipe clone's `x` position, the `score`{:class="block3variables"} increases by `1` and a sound of your choice plays. + +You could use the 'pop' sound if you want, or add a sound from the library, for example 'bird'. + +\--- hints \--- + +\--- hint \--- + +You need to `wait until`{:class="block3control"} `Flappy's x position`{:class="block3sensing"} is `greater than (>)`{:class="block3operators"} the `x position`{:class="block3motion"} of `Pipes`. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone ++ wait until <> +``` + +Then `change score by 1`{:class="block3variables"} and `play a sound`{:class="block3sound"}. + +\--- /hint \--- + +\--- hint \--- + +Use these blocks in the correct order: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> + +play sound (pop v) + +change [score v] by (1) + +[x position v] of (Flappy v) + +x position + +() > () +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <([x position v] of (Flappy v)) > (x position)> +change [score v] by (1) +play sound (pop v) +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code and make sure you score a point every time Flappy gets through a gap between pipes. Check whether the `score`{:class="block3variables"} is set to `0` when you start a new game. + +\--- /task \--- \ No newline at end of file diff --git a/pt-PT/step_9.md b/pt-PT/step_9.md new file mode 100644 index 0000000..2f4e2e6 --- /dev/null +++ b/pt-PT/step_9.md @@ -0,0 +1,5 @@ +## Challenge: adjust the difficulty + +Is the game too hard or too easy for you? How many ways can you find to change the difficulty? + +Adjust the game until you are happy with its difficulty! \ No newline at end of file diff --git a/ro-RO/images/banner.png b/ro-RO/images/banner.png new file mode 100644 index 0000000..7a0da5b Binary files /dev/null and b/ro-RO/images/banner.png differ diff --git a/ro-RO/images/binary-showcase.png b/ro-RO/images/binary-showcase.png new file mode 100644 index 0000000..499aa29 Binary files /dev/null and b/ro-RO/images/binary-showcase.png differ diff --git a/ro-RO/images/flappy-clones-test.png b/ro-RO/images/flappy-clones-test.png new file mode 100644 index 0000000..f874059 Binary files /dev/null and b/ro-RO/images/flappy-clones-test.png differ diff --git a/ro-RO/images/flappy-falling.gif b/ro-RO/images/flappy-falling.gif new file mode 100644 index 0000000..970d833 Binary files /dev/null and b/ro-RO/images/flappy-falling.gif differ diff --git a/ro-RO/images/flappy-flying.gif b/ro-RO/images/flappy-flying.gif new file mode 100644 index 0000000..e259ff1 Binary files /dev/null and b/ro-RO/images/flappy-flying.gif differ diff --git a/ro-RO/images/flappy-height-test.png b/ro-RO/images/flappy-height-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/ro-RO/images/flappy-height-test.png differ diff --git a/ro-RO/images/flappy-parrot-showcase.png b/ro-RO/images/flappy-parrot-showcase.png new file mode 100644 index 0000000..493049b Binary files /dev/null and b/ro-RO/images/flappy-parrot-showcase.png differ diff --git a/ro-RO/images/flappy-pipes-duplicate1-annotated.png b/ro-RO/images/flappy-pipes-duplicate1-annotated.png new file mode 100644 index 0000000..65e32c6 Binary files /dev/null and b/ro-RO/images/flappy-pipes-duplicate1-annotated.png differ diff --git a/ro-RO/images/flappy-pipes-duplicate1.png b/ro-RO/images/flappy-pipes-duplicate1.png new file mode 100644 index 0000000..4239b67 Binary files /dev/null and b/ro-RO/images/flappy-pipes-duplicate1.png differ diff --git a/ro-RO/images/flappy-pipes-duplicate2.png b/ro-RO/images/flappy-pipes-duplicate2.png new file mode 100644 index 0000000..ba1a69a Binary files /dev/null and b/ro-RO/images/flappy-pipes-duplicate2.png differ diff --git a/ro-RO/images/flappy-pipes-ends.png b/ro-RO/images/flappy-pipes-ends.png new file mode 100644 index 0000000..ab59aaa Binary files /dev/null and b/ro-RO/images/flappy-pipes-ends.png differ diff --git a/ro-RO/images/flappy-pipes-fill-rectangle.png b/ro-RO/images/flappy-pipes-fill-rectangle.png new file mode 100644 index 0000000..7360b87 Binary files /dev/null and b/ro-RO/images/flappy-pipes-fill-rectangle.png differ diff --git a/ro-RO/images/flappy-pipes-filled.png b/ro-RO/images/flappy-pipes-filled.png new file mode 100644 index 0000000..7d2c0dd Binary files /dev/null and b/ro-RO/images/flappy-pipes-filled.png differ diff --git a/ro-RO/images/flappy-pipes-position.png b/ro-RO/images/flappy-pipes-position.png new file mode 100644 index 0000000..ca2b810 Binary files /dev/null and b/ro-RO/images/flappy-pipes-position.png differ diff --git a/ro-RO/images/flappy-pipes-rectangle.png b/ro-RO/images/flappy-pipes-rectangle.png new file mode 100644 index 0000000..6e3bf02 Binary files /dev/null and b/ro-RO/images/flappy-pipes-rectangle.png differ diff --git a/ro-RO/images/flappy-pipes-test.png b/ro-RO/images/flappy-pipes-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/ro-RO/images/flappy-pipes-test.png differ diff --git a/ro-RO/images/flappy-setup.png b/ro-RO/images/flappy-setup.png new file mode 100644 index 0000000..92f9eca Binary files /dev/null and b/ro-RO/images/flappy-setup.png differ diff --git a/ro-RO/images/flappy-sprite.png b/ro-RO/images/flappy-sprite.png new file mode 100644 index 0000000..6a0c590 Binary files /dev/null and b/ro-RO/images/flappy-sprite.png differ diff --git a/ro-RO/images/flappy-stage.png b/ro-RO/images/flappy-stage.png new file mode 100644 index 0000000..5efe03c Binary files /dev/null and b/ro-RO/images/flappy-stage.png differ diff --git a/ro-RO/images/flappy-starting-position.png b/ro-RO/images/flappy-starting-position.png new file mode 100644 index 0000000..9089c9e Binary files /dev/null and b/ro-RO/images/flappy-starting-position.png differ diff --git a/ro-RO/images/flappy-wings.png b/ro-RO/images/flappy-wings.png new file mode 100644 index 0000000..ef0aa8e Binary files /dev/null and b/ro-RO/images/flappy-wings.png differ diff --git a/ro-RO/images/pipes-sprite.png b/ro-RO/images/pipes-sprite.png new file mode 100644 index 0000000..a9882ed Binary files /dev/null and b/ro-RO/images/pipes-sprite.png differ diff --git a/ro-RO/meta.yml b/ro-RO/meta.yml new file mode 100644 index 0000000..c2fe5e6 --- /dev/null +++ b/ro-RO/meta.yml @@ -0,0 +1,34 @@ +--- +title: Flappy parrot +hero_image: images/banner.png +description: Create a game in which you guide a parrot past moving obstacles +listed: true +copyedit: true +version: 4.1 +last_tested: 2018-10-90 +steps: + - + title: Introduction + - + title: Add the pipes + - + title: "Challenge: make better pipes" + challenge: true + - + title: Make the pipes move + - + title: Make Flappy fall + - + title: Make Flappy fly + - + title: Detect collisions + - + title: Add a score + - + title: 'Challenge: adjust the difficulty' + challenge: true + - + title: 'Challenge: add a high score' + challenge: true + - + title: What next? diff --git a/ro-RO/scratch-translatable.txt b/ro-RO/scratch-translatable.txt new file mode 100644 index 0000000..214e66c --- /dev/null +++ b/ro-RO/scratch-translatable.txt @@ -0,0 +1,13 @@ +Pipes + +costume1 + +Flappy + +wings down + +wings up + +Game Over! + +score diff --git a/ro-RO/solutions/FlappyParrot-Solution.sb3 b/ro-RO/solutions/FlappyParrot-Solution.sb3 new file mode 100644 index 0000000..a0cd354 Binary files /dev/null and b/ro-RO/solutions/FlappyParrot-Solution.sb3 differ diff --git a/ro-RO/step_1.md b/ro-RO/step_1.md new file mode 100644 index 0000000..f7519ae --- /dev/null +++ b/ro-RO/step_1.md @@ -0,0 +1,69 @@ +\--- no-print \--- + +This is the **Scratch 3** version of the project. There is also a [Scratch 2 version of the project](https://projects.raspberrypi.org/en/projects/flappy-parrot-scratch2). + +\--- /no-print \--- + +## Introduction + +Create a game in which you have to guide a parrot past scrolling pipes to score points. + +### What you will make + +\--- no-print \--- + +Click the green flag to start the game. Press the space bar to make the parrot flap its wings, and try to get it to fly through the gaps in the pipes! You score one point for every pipe that you manage to get the parrot past. + +
+ + +
+ +\--- /no-print \--- + +\--- print-only \--- + +You will press the space bar to make the parrot flap its wings, and score one point for every pipe that you manage to get the parrot past. + +![flappy parrot game being played](images/flappy-parrot-showcase.png) + +\--- /print-only \--- + +## \--- collapse \--- + +## title: What you will need + +### Hardware + ++ A computer capable of running Scratch 3 + +### Software + ++ Scratch 3 (either [online](https://rpf.io/scratchon) or [offline](https://rpf.io/scratchoff)) + +\--- /collapse \--- + +## \--- collapse \--- + +## title: What you will learn + ++ How to create sprites using Vector mode ++ How to use sounds ++ How to detect collisions ++ How to control a sprite using the keyboard + +\--- /collapse \--- + +## \--- collapse \--- + +## title: Additional notes for educators + +\--- no-print \--- + +If you need to print this project, please use the [printer-friendly version](https://projects.raspberrypi.org/en/projects/flappy-parrot/print){:target="_blank"}. + +\--- /no-print \--- + +You can find the [completed project here](https://rpf.io/p/en/flappy-parrot-get). + +\--- /collapse \--- \ No newline at end of file diff --git a/ro-RO/step_10.md b/ro-RO/step_10.md new file mode 100644 index 0000000..a5808f3 --- /dev/null +++ b/ro-RO/step_10.md @@ -0,0 +1,9 @@ +## Challenge: add a high score + +\--- challenge \--- + +Can you add a high score to the game so that, in addition to keeping track of score for the current round, it keeps track of the highest score you've ever reached? + +[[[generic-scratch3-high-score]]] + +\--- /challenge \--- \ No newline at end of file diff --git a/ro-RO/step_11.md b/ro-RO/step_11.md new file mode 100644 index 0000000..02ae229 --- /dev/null +++ b/ro-RO/step_11.md @@ -0,0 +1,19 @@ +## What next? + +Try the [Binary hero](https://projects.raspberrypi.org/en/projects/binary-hero?utm_source=pathway&utm_medium=whatnext&utm_campaign=projects) project, where you will make a game in which you play the notes of a song as they scroll down the Stage. + +\--- no-print \--- + +Click the green flag to start the game. Use the z, x, c, and v keys to play the correct notes when these reach the bottom of the Stage. You'll score ten points for every correct note you play. + +
+ +
+ +\--- /no-print \--- + +\--- print-only \--- + +The notes will fall from above, and you will have to press keys to "catch" and play the notes. ![showcase](images/binary-showcase.png) + +\--- /print-only \--- \ No newline at end of file diff --git a/ro-RO/step_2.md b/ro-RO/step_2.md new file mode 100644 index 0000000..d8f2ce5 --- /dev/null +++ b/ro-RO/step_2.md @@ -0,0 +1,84 @@ +## Add the pipes + +First, create the pipes. + +\--- task \--- + +Open a new empty Scratch project. + +[[[generic-scratch3-new-project]]] + +\--- /task \--- + +\--- task \--- + +Add a backdrop with an outdoor landscape. 'Blue Sky' is a good choice. + +![screenshot](images/flappy-stage.png) + +[[[generic-scratch3-backdrop-from-library]]] + +\--- /task \--- + +\--- task \--- + +Create a new sprite and name it 'Pipes'. + +[[[generic-scratch3-draw-sprite]]] + +\--- /task \--- + +The 'Pipes' sprite should be a pair of pipes with a gap in the middle. By moving the sprite up or down, you can put the gap in a different place. + +This picture shows an example of how the pipes could be positioned. The parts of the sprite outside the Stage are normally hidden, you only see then when you drag the sprite: + +![screenshot](images/flappy-pipes-position.png) + +You can't draw a sprite as big as the pipes need to be, but you can increase the size at which the sprite shows on the Stage. + +\--- task \--- + +![pipes sprite](images/pipes-sprite.png) + +Add code to make the sprite bigger. + +```blocks3 +when green flag clicked +set size to (200) % +``` + +This makes it's easier to see how big the pipes should be. + +\--- /task \--- + +\--- task \--- + +Draw a rectangle for the top pipe as shown here: + +![rectangle for the pipe](images/flappy-pipes-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Fill the pipe with a colour you like. + +![fill the rectangle](images/flappy-pipes-fill-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Create a duplicate of the pipe by selecting it and then clicking on **Copy** and **Paste**. + +![copy and paste pipe](images/flappy-pipes-duplicate1-annotated.png) + +\--- /task \--- + +\--- task \--- + +Drag the copy of the pipe to the bottom of the screen so that the copy is in line with the other pipe. There needs to be a gap between the two pipes. + +![screenshot](images/flappy-pipes-duplicate2.png) + +\--- /task \--- \ No newline at end of file diff --git a/ro-RO/step_3.md b/ro-RO/step_3.md new file mode 100644 index 0000000..17f05f7 --- /dev/null +++ b/ro-RO/step_3.md @@ -0,0 +1,11 @@ +## Challenge: make better pipes + +Can you make your pipes look better? + ++ Shade your pipes with a left-to-right gradient. + +![screenshot](images/flappy-pipes-filled.png) + ++ Add extra rectangles to the ends of the pipes: + +![screenshot](images/flappy-pipes-ends.png) \ No newline at end of file diff --git a/ro-RO/step_4.md b/ro-RO/step_4.md new file mode 100644 index 0000000..2beedd9 --- /dev/null +++ b/ro-RO/step_4.md @@ -0,0 +1,65 @@ +## Make the pipes move + +Next you're going to make the pipes move across the screen to create an obstacle course. + +![pipes moving across the screen](images/flappy-clones-test.png) + +\--- task \--- + +First make the pipes appear by adding code to the Pipes sprite so that, `when the green flag is clicked`{:class="block3events"}, the sprite `forever`{:class="block3control"} `creates a clone of itself`{:class="block3control"} every two seconds. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +**Tip:** clones are just copies of a sprite, and they are really useful for creating games. + +\--- /task \--- + +\--- task \--- + +Next make the pipes move by adding code so that, `when a clone starts`{:class="block3control"}, the clone appears on the right side of the Stage and `glides`{:class="block3motion"} across to the left. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show +go to x: (240) y: (0) +glide (4) secs to x: (-240) y: (0) +delete this clone +``` + +**Tip:** you can stop the pipes scrolling by clicking the red **stop** button next to the green flag. + +\--- /task \--- + +Now you should have lots of pipes, but their gaps are always in the same place. + +You can add some variety by using a `random`{:class="block3operators"} number for the Pipes sprite's `y position`{:class="block3motion"}. + +![pipes at different heights](images/flappy-height-test.png) + +\--- task \--- + +Modify your sprite's code so that each sprite clone `picks a random number from -80 to 80`{:class="block3operators"} and `glides`{:class="block3motion"} to that `y position`{:class="block3motion"}: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show ++ go to x: (240) y: (pick random (-80) to (80)) ++ glide (4) secs to x: (-240) y: (y position) +delete this clone +``` + +\--- /task \--- \ No newline at end of file diff --git a/ro-RO/step_5.md b/ro-RO/step_5.md new file mode 100644 index 0000000..f9d79ce --- /dev/null +++ b/ro-RO/step_5.md @@ -0,0 +1,77 @@ +## Make Flappy fall + +Now add a sprite called Flappy and create code it so Flappy falls down the Stage. In the next step, you will add the code to make Flappy fly when you press a key. + +\--- no-print \--- + +![flappy falling animation](images/flappy-falling.gif) + +\--- /no-print \--- + +\--- task \--- + +Add a new sprite that has two costumes, for 'wings up' and 'wings down', and name it `Flappy`. + +The parrot sprite is a good choice. + +![parrot sprite](images/flappy-sprite.png) + +\--- /task \--- + +Flappy needs to be smaller. + +\--- task \--- + +Add code to `set Flappy's size to 25%`{:class="block3looks"} `when the green flag is clicked`{:class="block3events"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +``` + +\--- /task \--- + +When the game starts, Flappy needs to be just left of the centre of the Stage, at coordinates `-50, 0`. + +![flappy shown at the start position](images/flappy-starting-position.png) + +\--- task \--- + +Add code to make Flappy `go to the x and y`{:class="block3motion"} starting position of `x: -50`{:class="block3motion"} and `y: 0`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % ++ go to x: (-50) y: (0) +``` + +[[[generic-scratch3-set-coordinates]]] + +\--- /task \--- + +\--- task \--- + +Now make Flappy keep falling down the Stage by `forever`{:class="block3control"} `changing the sprite's y position by -3`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +go to x: (-50) y: (0) ++ forever + change y by (-3) +end +``` + +\--- /task \--- + +\--- task \--- + +Test your code to make sure Flappy starts in the middle of the screen and falls to the bottom. When you drag Flappy to the top of the Stage, the sprite should fall again. + +\--- /task \--- \ No newline at end of file diff --git a/ro-RO/step_6.md b/ro-RO/step_6.md new file mode 100644 index 0000000..1a98cb2 --- /dev/null +++ b/ro-RO/step_6.md @@ -0,0 +1,106 @@ +## Make Flappy fly + +Now you will make Flappy flap upwards when you press the space bar. When you play the game, you have to time your taps to get Flappy through the gaps in the pipes. + +\--- no-print \--- + +![flappy flying upwards when space bar is pressed](images/flappy-flying.gif) + +\--- /no-print \--- + +Make Flappy fly upwards when you tap the space bar. + +\--- task \--- + +When the `space key is pressed`{:class="block3events"}, Flappy should move upwards by `changing its y coordinate`{:class="block3motion"} by a small amount, for example `6`. + +Flappy flies upwards by `repeating`{:class="block3control"} this movement `10 times`{:class="block3control"}. + +Add this code to your `Flappy` sprite: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +repeat (10) + change y by (6) +end +``` + +\--- /task \--- + +Now you need to get Flappy's wings flapping! + +\--- task \--- + +Click on the **Costumes** tab, and name Flappy's costumes 'wings up' and 'wings down'. + +![naming the costumes](images/flappy-wings.png) + +\--- /task \--- + +\--- task \--- + +Can you make Flappy's costume change to `wings down` when you press space, and then change it back to `wings up` halfway through the upward movement? + +\--- hints \--- + +\--- hint \--- + +You need to split the upward motion in half so that you can use two `repeat`{:class="block3control"} blocks to change Flappy's costume at the beginning and in the middle of the movement. + +Add `switch costume to`{:class="block3looks"} blocks to change how Flappy looks. + +\--- /hint \--- \--- hint \--- + +You need to use these blocks: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +repeat (5) + change y by (6) +end + +repeat (5) + change y by (6) +end + +switch costume to (wings up v) + +switch costume to (wings down v) + +when [space v] key pressed +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +switch costume to (wings down v) +repeat (5) + change y by (6) +end +switch costume to (wings up v) +repeat (5) + change y by (6) +end +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code. As you see, at the moment nothing happens if you let Flappy hit a pipe. + +\--- /task \--- \ No newline at end of file diff --git a/ro-RO/step_7.md b/ro-RO/step_7.md new file mode 100644 index 0000000..40a2720 --- /dev/null +++ b/ro-RO/step_7.md @@ -0,0 +1,77 @@ +## Detect collisions + +To make the game a challenge, the player needs to guide Flappy through the gaps without letting the parrot touch the pipes or the edges of the Stage. You need to add some blocks to detect when Flappy hits something. + +This is called **collision detection**. + +\--- task \--- + +Import a sound from the library that you want to play when Flappy collides with something. The 'screech' sound is a good choice. + +[[[generic-scratch3-sound-from-library]]] + +\--- /task \--- + +A `wait until`{:class="block3control"} block is necessart to check whether Flappy is `touching the pipes`{:class="block3sensing"} `or`{:class="block3operators"} `touching the edge`{:class="block3sensing"}. + +\--- task \--- + +Add a new `when green flag clicked`{:class="block3control"} block to the 'Flappy' sprite, and also add the following code: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) +``` + +\--- /task \--- + +\--- task \--- + +Test your code. If Flappy touches a pipe, the 'screech' sound should play. + +\--- /task \--- + +Next, update the code so that the game stops when Flappy hits a pipe. + +\--- task \--- + +Add the following code to stop the game after a collision is detected: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) ++ say [Game Over!] ++ broadcast (Game Over v) ++ stop [other scripts in sprite v] +``` + +The `broadcast`{:class="block3events"} block tells other sprites that the game is over. + +The `stop`{:class="block3control"} block stops other Flappy scripts that are running so that Flappy stops falling after a collision. + +\--- /task \--- + +\--- task \--- + +Finally, add the following code to the `Pipes` sprite so that pipes `stop`{:class="block3control"} appearing `when the sprite receives Game Over`{:class="block3events"}. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I receive [Game Over v] +stop [other scripts in sprite v] +``` + +\--- /task \--- + +\--- task \--- + +Test your game and see how long you can play before it's 'Game over'! + +\--- /task \--- \ No newline at end of file diff --git a/ro-RO/step_8.md b/ro-RO/step_8.md new file mode 100644 index 0000000..2c5cc08 --- /dev/null +++ b/ro-RO/step_8.md @@ -0,0 +1,116 @@ +## Add a score + +The player should score a point every time Flappy makes it through a gap between pipes. + +\--- task \--- + +Make a new variable **for all sprites** and call it `score`{:class="block3variables"}. + +[[[generic-scratch3-add-variable]]] + +\--- /task \--- + +Each 'Pipes' sprite clone should `wait until`{:class="block3control"} Flappy has flown past and then increase the `score`{:class="block3variables"}. + +\--- task \--- + +First, `set score to 0`{:class="block3variables"} when the game begins: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked ++ set [score v] to [0] +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +\--- /task \--- + +\--- task \--- + +Then add the following code to the `Pipes` sprite: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> +``` + +\--- /task \--- + +\--- task \--- + +Add more code so that, when Flappy's `x` position is greater than the pipe clone's `x` position, the `score`{:class="block3variables"} increases by `1` and a sound of your choice plays. + +You could use the 'pop' sound if you want, or add a sound from the library, for example 'bird'. + +\--- hints \--- + +\--- hint \--- + +You need to `wait until`{:class="block3control"} `Flappy's x position`{:class="block3sensing"} is `greater than (>)`{:class="block3operators"} the `x position`{:class="block3motion"} of `Pipes`. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone ++ wait until <> +``` + +Then `change score by 1`{:class="block3variables"} and `play a sound`{:class="block3sound"}. + +\--- /hint \--- + +\--- hint \--- + +Use these blocks in the correct order: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> + +play sound (pop v) + +change [score v] by (1) + +[x position v] of (Flappy v) + +x position + +() > () +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <([x position v] of (Flappy v)) > (x position)> +change [score v] by (1) +play sound (pop v) +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code and make sure you score a point every time Flappy gets through a gap between pipes. Check whether the `score`{:class="block3variables"} is set to `0` when you start a new game. + +\--- /task \--- \ No newline at end of file diff --git a/ro-RO/step_9.md b/ro-RO/step_9.md new file mode 100644 index 0000000..2f4e2e6 --- /dev/null +++ b/ro-RO/step_9.md @@ -0,0 +1,5 @@ +## Challenge: adjust the difficulty + +Is the game too hard or too easy for you? How many ways can you find to change the difficulty? + +Adjust the game until you are happy with its difficulty! \ No newline at end of file diff --git a/ru-RU/images/banner.png b/ru-RU/images/banner.png new file mode 100644 index 0000000..7a0da5b Binary files /dev/null and b/ru-RU/images/banner.png differ diff --git a/ru-RU/images/binary-showcase.png b/ru-RU/images/binary-showcase.png new file mode 100644 index 0000000..499aa29 Binary files /dev/null and b/ru-RU/images/binary-showcase.png differ diff --git a/ru-RU/images/flappy-clones-test.png b/ru-RU/images/flappy-clones-test.png new file mode 100644 index 0000000..f874059 Binary files /dev/null and b/ru-RU/images/flappy-clones-test.png differ diff --git a/ru-RU/images/flappy-falling.gif b/ru-RU/images/flappy-falling.gif new file mode 100644 index 0000000..970d833 Binary files /dev/null and b/ru-RU/images/flappy-falling.gif differ diff --git a/ru-RU/images/flappy-flying.gif b/ru-RU/images/flappy-flying.gif new file mode 100644 index 0000000..e259ff1 Binary files /dev/null and b/ru-RU/images/flappy-flying.gif differ diff --git a/ru-RU/images/flappy-height-test.png b/ru-RU/images/flappy-height-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/ru-RU/images/flappy-height-test.png differ diff --git a/ru-RU/images/flappy-parrot-showcase.png b/ru-RU/images/flappy-parrot-showcase.png new file mode 100644 index 0000000..830dcad Binary files /dev/null and b/ru-RU/images/flappy-parrot-showcase.png differ diff --git a/ru-RU/images/flappy-pipes-duplicate1-annotated.png b/ru-RU/images/flappy-pipes-duplicate1-annotated.png new file mode 100644 index 0000000..c04f12c Binary files /dev/null and b/ru-RU/images/flappy-pipes-duplicate1-annotated.png differ diff --git a/ru-RU/images/flappy-pipes-duplicate1.png b/ru-RU/images/flappy-pipes-duplicate1.png new file mode 100644 index 0000000..69bf6c4 Binary files /dev/null and b/ru-RU/images/flappy-pipes-duplicate1.png differ diff --git a/ru-RU/images/flappy-pipes-duplicate2.png b/ru-RU/images/flappy-pipes-duplicate2.png new file mode 100644 index 0000000..70ca5b1 Binary files /dev/null and b/ru-RU/images/flappy-pipes-duplicate2.png differ diff --git a/ru-RU/images/flappy-pipes-ends.png b/ru-RU/images/flappy-pipes-ends.png new file mode 100644 index 0000000..ab59aaa Binary files /dev/null and b/ru-RU/images/flappy-pipes-ends.png differ diff --git a/ru-RU/images/flappy-pipes-fill-rectangle.png b/ru-RU/images/flappy-pipes-fill-rectangle.png new file mode 100644 index 0000000..0343c68 Binary files /dev/null and b/ru-RU/images/flappy-pipes-fill-rectangle.png differ diff --git a/ru-RU/images/flappy-pipes-filled.png b/ru-RU/images/flappy-pipes-filled.png new file mode 100644 index 0000000..877e452 Binary files /dev/null and b/ru-RU/images/flappy-pipes-filled.png differ diff --git a/ru-RU/images/flappy-pipes-position.png b/ru-RU/images/flappy-pipes-position.png new file mode 100644 index 0000000..ca2b810 Binary files /dev/null and b/ru-RU/images/flappy-pipes-position.png differ diff --git a/ru-RU/images/flappy-pipes-rectangle.png b/ru-RU/images/flappy-pipes-rectangle.png new file mode 100644 index 0000000..f7e5def Binary files /dev/null and b/ru-RU/images/flappy-pipes-rectangle.png differ diff --git a/ru-RU/images/flappy-pipes-test.png b/ru-RU/images/flappy-pipes-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/ru-RU/images/flappy-pipes-test.png differ diff --git a/ru-RU/images/flappy-setup.png b/ru-RU/images/flappy-setup.png new file mode 100644 index 0000000..92f9eca Binary files /dev/null and b/ru-RU/images/flappy-setup.png differ diff --git a/ru-RU/images/flappy-sprite.png b/ru-RU/images/flappy-sprite.png new file mode 100644 index 0000000..6a0c590 Binary files /dev/null and b/ru-RU/images/flappy-sprite.png differ diff --git a/ru-RU/images/flappy-stage.png b/ru-RU/images/flappy-stage.png new file mode 100644 index 0000000..5efe03c Binary files /dev/null and b/ru-RU/images/flappy-stage.png differ diff --git a/ru-RU/images/flappy-starting-position.png b/ru-RU/images/flappy-starting-position.png new file mode 100644 index 0000000..9089c9e Binary files /dev/null and b/ru-RU/images/flappy-starting-position.png differ diff --git a/ru-RU/images/flappy-wings.png b/ru-RU/images/flappy-wings.png new file mode 100644 index 0000000..4dad9ba Binary files /dev/null and b/ru-RU/images/flappy-wings.png differ diff --git a/ru-RU/images/pipes-sprite.png b/ru-RU/images/pipes-sprite.png new file mode 100644 index 0000000..a9882ed Binary files /dev/null and b/ru-RU/images/pipes-sprite.png differ diff --git a/ru-RU/meta.yml b/ru-RU/meta.yml new file mode 100644 index 0000000..5b876b9 --- /dev/null +++ b/ru-RU/meta.yml @@ -0,0 +1,34 @@ +--- +title: Попугай Flappy +hero_image: images/banner.png +description: Создай игру, в которой ты управляешь попугаем, пролетающем мимо движущихся препятствий +listed: true +copyedit: true +version: 4.1 +last_tested: 2018-10-90 +steps: + - + title: Введение + - + title: Добавь трубы + - + title: "Задача: сделать трубы лучше" + challenge: true + - + title: Заставь трубы двигаться + - + title: Сделай Flappy падающим + - + title: Сделай Flappy летающим + - + title: Обнаружение столкновений + - + title: Добавь счёт + - + title: 'Задача: отрегулировать сложность' + challenge: true + - + title: 'Задача: добавить лучший результат' + challenge: true + - + title: Что дальше? diff --git a/ru-RU/scratch-translatable.txt b/ru-RU/scratch-translatable.txt new file mode 100644 index 0000000..ea994f7 --- /dev/null +++ b/ru-RU/scratch-translatable.txt @@ -0,0 +1,13 @@ +Трубы + +costume1 + +Flappy + +крылья вниз + +крылья вверх + +Игра окончена! + +счёт diff --git a/ru-RU/solutions/FlappyParrot-Solution.sb3 b/ru-RU/solutions/FlappyParrot-Solution.sb3 new file mode 100644 index 0000000..4068118 Binary files /dev/null and b/ru-RU/solutions/FlappyParrot-Solution.sb3 differ diff --git a/ru-RU/step_1.md b/ru-RU/step_1.md new file mode 100644 index 0000000..f3432dd --- /dev/null +++ b/ru-RU/step_1.md @@ -0,0 +1,69 @@ +\--- no-print \--- + +Это версия проекта для **Scratch 3**. Есть также [версия для Scratch 2](https://projects.raspberrypi.org/en/projects/flappy-parrot-scratch2). + +\--- /no-print \--- + +## Введение + +Создай игру, в которой ты должен управлять попугаем, пролетающим мимо двигающихся труб, чтобы заработать очки. + +### Что ты сделаешь + +\--- no-print \--- + +Нажми на зеленый флаг, чтобы начать игру. Нажми клавишу пробел, чтобы попугай махал крыльями, и постарайся пролететь им через щели между труб! Ты получишь одно очко за каждую трубу, через которую тебе удастся провести попугая. + +
+ + +
+ +\--- /no-print \--- + +\--- print-only \--- + +Ты будешь нажимать на клавишу пробел, чтобы попугай взмахивал крыльями, и наберёшь одно очко за каждую трубу, через которую тебе удастся провести попугая. + +![игра попугай Flappy, в которую можно поиграть](images/flappy-parrot-showcase.png) + +\--- /print-only \--- + +## \--- collapse \--- + +## title: Что тебе понадобится + +### Оборудование + ++ Компьютер, способный запускать Scratch 3 + +### Программное обеспечение + ++ Scratch 3 ([онлайн](https://rpf.io/scratchon) или [автономный (offline)](https://rpf.io/scratchoff)) + +\--- /collapse \--- + +## \--- collapse \--- + +## title: Чему ты научишься + ++ Как создать спрайты в векторном режиме ++ Как использовать звуки ++ Как определить столкновения ++ Как управлять спрайтом с помощью клавиатуры + +\--- /collapse \--- + +## \--- collapse \--- + +## title: Дополнительные заметки для преподавателей + +\--- no-print \--- + +Если вам нужно распечатать этот проект, пожалуйста, используйте [ версию для печати](https://projects.raspberrypi.org/en/projects/flappy-parrot/print) {:target="_blank"}. + +\--- /no-print \--- + +Вы можете найти [завершенный проект здесь](https://rpf.io/p/en/flappy-parrot-get). + +\--- /collapse \--- \ No newline at end of file diff --git a/ru-RU/step_10.md b/ru-RU/step_10.md new file mode 100644 index 0000000..fb56bff --- /dev/null +++ b/ru-RU/step_10.md @@ -0,0 +1,9 @@ +## Задача: добавить лучший результат + +\--- challenge \--- + +Можешь ли ты добавить лучший результат в игру, чтобы, помимо отслеживания счёта за текущий раунд, он отслеживал самый высокий результат, который ты когда-либо достигал? + +[[[generic-scratch3-high-score]]] + +\--- /challenge \--- \ No newline at end of file diff --git a/ru-RU/step_11.md b/ru-RU/step_11.md new file mode 100644 index 0000000..1aa00a9 --- /dev/null +++ b/ru-RU/step_11.md @@ -0,0 +1,19 @@ +## Что дальше? + +Попробуй проект [Двоичный герой](https://projects.raspberrypi.org/en/projects/binary-hero?utm_source=pathway&utm_medium=whatnext&utm_campaign=projects), где ты сделаешь игру, в которой будешь играть ноты песни, когда они прокручиваются вниз по Сцене. + +\--- no-print \--- + +Нажми на зеленый флаг, чтобы начать. Используй клавиши z, x, c, и v чтобы проиграть правильные ноты когда они достигнут нижней части Сцены. Ты получишь десять очков за каждую правильную ноту, которую сыграешь. + +
+ +
+ +\--- /no-print \--- + +\--- print-only \--- + +Ноты будут падать сверху и тебе нужно нажимать клавиши, чтобы «поймать» и сыграть их. ![пример](images/binary-showcase.png) + +\--- /print-only \--- \ No newline at end of file diff --git a/ru-RU/step_2.md b/ru-RU/step_2.md new file mode 100644 index 0000000..7eb9711 --- /dev/null +++ b/ru-RU/step_2.md @@ -0,0 +1,84 @@ +## Добавь трубы + +Для начала создай трубы. + +\--- task \--- + +Открой новый пустой проект Scratch. + +[[[generic-scratch3-new-project]]] + +\--- /task \--- + +\--- task \--- + +Добавь фон с пейзажем на открытом воздухе. «Голубое небо (Blue Sky)» - хороший выбор. + +![скриншот](images/flappy-stage.png) + +[[[generic-scratch3-backdrop-from-library]]] + +\--- /task \--- + +\--- task \--- + +Создай новый спрайт и назови его "Трубы". + +[[[generic-scratch3-draw-sprite]]] + +\--- /task \--- + +Спрайт "Трубы" должен представлять собой пару труб с щелью посередине. Перемещая спрайт вверх или вниз, ты можешь поместить щель в другое место. + +На этом рисунке показан пример того, как трубы могут быть расположены. Части спрайта за пределами Сцены обычно скрыты, ты видишь их только тогда, когда перемещаешь спрайт: + +![скриншот](images/flappy-pipes-position.png) + +Ты не можешь нарисовать спрайт таким же большим, какими должны быть трубы, но ты можешь увеличить размер спрайта на Сцене. + +\--- task \--- + +![спрайт труб](images/pipes-sprite.png) + +Добавь код, чтобы увеличить спрайт. + +```blocks3 +когда щёлкнут по зелёному флагу +установить размер (200) % +``` + +Это облегчит понимание того, какими большими должны быть трубы. + +\--- /task \--- + +\--- task \--- + +Нарисуй прямоугольник для верхней трубы, как показано здесь: + +![прямоугольник для трубы](images/flappy-pipes-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Закрась трубу цветом, который тебе нравится. + +![закрасить прямоугольник](images/flappy-pipes-fill-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Создай дубликат трубы, выделив её и нажав **Копировать** и **Вставить**. + +![скопировать и вставить трубу](images/flappy-pipes-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Перетащи копию трубы в нижнюю часть экрана, так чтобы она находилась на одной линии с другой трубой. Между двумя трубами должна быть щель. + +![скриншот](images/flappy-pipes-rectangle.png) + +\--- /task \--- \ No newline at end of file diff --git a/ru-RU/step_3.md b/ru-RU/step_3.md new file mode 100644 index 0000000..57e80a0 --- /dev/null +++ b/ru-RU/step_3.md @@ -0,0 +1,11 @@ +## Задача: сделать трубы лучше + +Можешь ли ты сделать так, чтобы трубы выглядели лучше? + ++ Закрась свои трубы с помощью градиента слева направо. + +![скриншот](images/flappy-pipes-filled.png) + ++ Добавь дополнительные прямоугольники к концам труб: + +![скриншот](images/flappy-pipes-ends.png) \ No newline at end of file diff --git a/ru-RU/step_4.md b/ru-RU/step_4.md new file mode 100644 index 0000000..c46e3b9 --- /dev/null +++ b/ru-RU/step_4.md @@ -0,0 +1,65 @@ +## Заставь трубы двигаться + +Далее ты сделаешь так, чтобы трубы двигались по экрану, это создаст полосу препятствий. + +![трубы движутся по экрану](images/flappy-clones-test.png) + +\--- task \--- + +Первым делом сделай так, чтобы трубы появились, добавь код к спрайту Трубы таким образом, что `когда зелёный флаг нажат`{:class="block3events"}, спрайт `повторять всегда`{:class="block3control"} `создает клон самого себя`{:class="block3control"} каждые две секунды. + +![спрайт трубы](images/pipes-sprite.png) + +```blocks3 +когда щёлкнут по зелёному флагу +установить размер (200) % +спрятаться +повторять всегда + создать клон (самого себя v) + ждать (2) секунд +end +``` + +**Совет:** клоны - это просто копии спрайта, и они очень полезны при создании игр. + +\--- /task \--- + +\--- task \--- + +Далее заставь трубы двигаться, добавь код так, что `когда клон начинает` {: class = "block3control"}, клон появился в правой части Сцены и `скользит` {: class = "block3motion"} влево. + +![спрайт трубы](images/pipes-sprite.png) + +```blocks3 +когда я начинаю как клон +показаться +перейти в x: (240) y: (0) +плыть (4) секунд в точку x: (-240) y: (0) +удалить клон +``` + +**Совет:** Ты можешь остановить движение труб, нажав на красную кнопку **остановить** рядом с зеленым флагом. + +\--- /task \--- + +Теперь у тебя должно быть много труб, но их щели всегда находятся на одном и том же месте. + +Ты можешь добавить немного разнообразия, используя `случайное`{: class = "block3operators"} значение для `позиции y`{: Класс = "block3motion"} спрайта Трубы. + +![трубы на разных высотах](images/flappy-height-test.png) + +\--- task \--- + +Измени код спрайта, чтобы каждый его клон `выбирал случайное число от -80 до 80`{:class="block3operators"} и `скользил`{:class="block3motion"} к его`положению по y`{:class="block3motion"}: + +![спрайт трубы](images/pipes-sprite.png) + +```blocks3 +когда я начинаю как клон +показаться +перейти в x: (240) y: (выдать случайное от (-80) до (80)) +плыть (4) секунд в точку x: (-240) y: (положение y) +удалить клон +``` + +\--- /task \--- \ No newline at end of file diff --git a/ru-RU/step_5.md b/ru-RU/step_5.md new file mode 100644 index 0000000..990d68c --- /dev/null +++ b/ru-RU/step_5.md @@ -0,0 +1,77 @@ +## Сделай Flappy падающим + +Теперь добавь спрайт под названием Flappy и создайте код так, чтобы Flappy падал на Сцене. На следующем шаге ты добавишь код, чтобы Flappy взлетал при нажатии клавиши. + +\--- no-print \--- + +![анимация падающего Flappy](images/flappy-falling.gif) + +\--- /no-print \--- + +\--- task \--- + +Добавь новый спрайт, который имеет два костюма, 'крылья вверх' и 'крылья вниз', и назови его `Flappy`. + +Спрайт попугай - это хороший выбор. + +![спрайт попугая](images/flappy-sprite.png) + +\--- /task \--- + +Flappy должен быть поменьше. + +\--- task \--- + +Добавь код в `установить размер Flappy 25%`{:class="block3looks"} `когда зеленый флаг нажат`{:class="block3events"}. + +![спрайт попугая](images/flappy-sprite.png) + +```blocks3 +когда щёлкнут по зелёному флагу +установить размер (25) % +``` + +\--- /task \--- + +Когда игра начинается, Flappy нужно быть просто чуть левее от центра Сцены, с координатами `-50, 0`. + +![flappy, показан в стартовой позиции](images/flappy-starting-position.png) + +\--- task \--- + +Добавь код, чтобы Flappy `перешёл к x и y`{:class="block3motion"} с начальной позицией `x: -50`{:class="block3motion"} и `y: 0`{:Класс="block3motion"}. + +![спрайт попугая](images/flappy-sprite.png) + +```blocks3 +когда щёлкнут по зелёному флагу +установить размер (25) % +перейти в x: (-50) y: (0) +``` + +[[[generic-scratch3-set-coordinates]]] + +\--- /task \--- + +\--- task \--- + +Теперь сделай так, чтобы Flappy всегда падал вниз Сцены с помощью `повторять всегда`{:class="block3control"}`, изменяя позицию спрайта по y на -3`{:Класс="block3motion"}. + +![спрайт попугая](images/flappy-sprite.png) + +```blocks3 +когда щёлкнут по зелёному флагу +установить размер (25) % +перейти в x: (-50) y: (0) +повторять всегда + изменить y на (-3) +end +``` + +\--- /task \--- + +\--- task \--- + +Проверь свой код, чтобы убедиться, что Flappy стартует в середине экрана и падает вниз. Когда ты перетащишь Flappy на верхнюю часть Сцены, спрайт должен снова упасть. + +\--- /task \--- \ No newline at end of file diff --git a/ru-RU/step_6.md b/ru-RU/step_6.md new file mode 100644 index 0000000..7ae49df --- /dev/null +++ b/ru-RU/step_6.md @@ -0,0 +1,106 @@ +## Сделай Flappy летающим + +Теперь ты сделаешь, так что Flappy будет махать крыльями и лететь вверх, при нажатии клавиши Пробел. Когда ты играешь в игру, тебе нужно рассчитывать время нажатий так, чтобы у Flappy получалось пролетать между трубами. + +\--- no-print \--- + +![flappy летит вверх, когда клавиша пробел нажата](images/flappy-flying.gif) + +\--- /no-print \--- + +Заставь Flappy лететь вверх, когда ты нажимаешь на клавишу пробел. + +\--- task \--- + +Когда `клавиша пробел нажата`{: class = "block3events"}, Flappy должен двигаться вверх, `изменяя свою координату y`{: class = "block3motion"} на небольшое значение, например `6`. + +Flappy летит вверх, `повторяя`{: class = "block3control"} это движение `10 раз`{: Класс = "block3control"}. + +Добавь этот код в свой спрайт `Flappy`: + +![спрайт попугая](images/flappy-sprite.png) + +```blocks3 +когда клавиша [space v] нажата +повторить (10) раз + изменить y на (6) +end +``` + +\--- /task \--- + +Теперь тебе нужно сделать так, чтобы Flappy махал крыльями! + +\--- task \--- + +Нажми на вкладку **Костюмы** и назови костюмы Flappy 'крылья вверх' и 'крылья вниз'. + +![переименование костюмов](images/flappy-wings.png) + +\--- /task \--- + +\--- task \--- + +Можешь ли ты сделать смену костюма Flappy на `крылья вниз` при нажатии пробела, и затем снова изменить его на `крылья вверх` на полпути движения вверх? + +\--- hints \--- + +\--- hint \--- + +Тебе нужно разделить движение вверх пополам, чтобы можно было использовать два блока `повторить`{:class="block3control"}, чтобы изменять костюм Flappy в начале и в середине движения. + +Добавь блоки`переключить костюм на`{:class="block3looks"}, чтобы изменить внешний вид Flappy. + +\--- /hint \--- \--- hint \--- + +Тебе нужно использовать эти блоки: + +![спрайт попугая](images/flappy-sprite.png) + +```blocks3 +повторить (5) раз + изменить y на (6) +end + +повторить (5) раз + изменить y на (6) +end + +изменить костюм на (крылья вверх v) + +изменить костюм на (крылья вниз v) + +когда клавиша [пробел v] нажата +``` + +\--- /hint \--- + +\--- hint \--- + +Твой код должен выглядеть так: + +![спрайт попугая](images/flappy-sprite.png) + +```blocks3 +когда клавиша [пробел v] нажата +изменить костюм на (крылья вниз v) +повторить (5) раз + изменить y на (6) +end +изменить костюм на (крылья вверх v) +повторить (5) раз + изменить y на (6) +end +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Проверь свою программу. Как ты видишь, пока что ничего не происходит, когда Flappy ударяется об трубу. + +\--- /task \--- \ No newline at end of file diff --git a/ru-RU/step_7.md b/ru-RU/step_7.md new file mode 100644 index 0000000..cb0de3f --- /dev/null +++ b/ru-RU/step_7.md @@ -0,0 +1,77 @@ +## Обнаружение столкновений + +Чтобы сделать игру сложной, игрок должен провести Flappy через щели, не позволяя попугаю касаться труб или краев Сцены. Тебе нужно добавить несколько блоков, чтобы определить, когда Flappy обо что-то ударится. + +Это называется **обнаружением столкновений**. + +\--- task \--- + +Загрузи звук из библиотеки, который ты хочешь воспроизвести, когда Flappy сталкивается с чем-либо. Звук «screech (визг)» - хороший выбор. + +[[[generic-scratch3-sound-from-library]]] + +\--- /task \--- + +Блок `ждать до`{: class = "block3control"} необходим для проверки того, что Flappy `касается труб`{: class = "block3sensing"} `или`{: class = "block3operators"} `касается края`{: Класс = "block3sensing"}. + +\--- task \--- + +Добавь новый блок `когда зелёный флаг нажат`{:class="block3control"} в спрайт 'Flappy', а также добавь следующий код: + +![спрайт попугая](images/flappy-sprite.png) + +```blocks3 +когда щёлкнут по зелёному флагу +ждать до <<касается (Pipes v)?> или <касается (edge v)?>> +включить звук (screech v) +``` + +\--- /task \--- + +\--- task \--- + +Проверь свою программу. Если Flappy касается трубы, должен прозвучать звук «визг». + +\--- /task \--- + +Далее, обнови код, чтобы игра остановилась, когда Flappy ударится о трубу. + +\--- task \--- + +Добавь следующий код, чтобы остановить игру после того, как столкновение произошло: + +![спрайт попугая](images/flappy-sprite.png) + +```blocks3 +когда щёлкнут по зелёному флагу +ждать до < или > +включить звук (screech v) +сказать [Game Over!] +передать (Game Over v) +стоп [другие скрипты спрайта v] +``` + +Блок `передать`{:class="block3events"} говорит другим спрайтам, что игра закончена. + +Блок `стоп`{: class = "block3control"} останавливает другие запущенные скрипты Flappy, поэтому Flappy перестает падать после столкновения. + +\--- /task \--- + +\--- task \--- + +Наконец, добавь следующий код в спрайт `Трубы`, чтобы трубы `перестали`{: class = "block3control"} появляться `когда спрайт получит Game Over`{: Класс = "block3events"}. + +![спрайт труб](images/pipes-sprite.png) + +```blocks3 +когда я получу [Game Over v] +стоп [другие скрипты спрайта v] +``` + +\--- /task \--- + +\--- task \--- + +Протестируй свою игру и посмотри, как долго ты сможешь продержаться! + +\--- /task \--- \ No newline at end of file diff --git a/ru-RU/step_8.md b/ru-RU/step_8.md new file mode 100644 index 0000000..109e7a7 --- /dev/null +++ b/ru-RU/step_8.md @@ -0,0 +1,116 @@ +## Добавь счёт + +Игрок должен набирать очки каждый раз, когда Flappy пролетает сквозь щели между трубами. + +\--- task \--- + +Создай новую переменную **для всех спрайтов** и назови её `счёт`:class="block3variables"}. + +[[[generic-scratch3-add-variable]]] + +\--- /task \--- + +Каждый клон спрайта 'Трубы' должен `ждать пока`{:class="block3control"} Flappy не пролетит мимо и затем увеличить `счёт`{:class="block3variables"}. + +\--- task \--- + +Сначала, `установи счёт на 0`{:class="block3variables"}, когда игра начинается: + +![спрайт трубы](images/pipes-sprite.png) + +```blocks3 +когда щёлкнут по зелёному флагу +задать [счёт v] значение [0] +установить размер (200) % +спрятаться +повторять всегда + создать клон (самого себя v) + ждать (2) секунд +end +``` + +\--- /task \--- + +\--- task \--- + +Затем добавь следующий код в спрайт `Трубы`: + +![спрайт трубы](images/pipes-sprite.png) + +```blocks3 +когда я начинаю как клон +ждать до <> +``` + +\--- /task \--- + +\--- task \--- + +Добавь еще кода так, чтобы когда у Flappy положение `x` станет больше, чем положение `x` у клона трубы, то `счёт`{:class="block3variables"} увеличится на `1` и прозвучит сигнал, который ты выбрал. + +Если хочешь, ты можешь использовать звук «pop» или добавить звук из библиотеки, например, «bird». + +\--- hints \--- + +\--- hint \--- + +Тебе нужно `ждать, пока`{:class="block3control"} `положение х у Flappy`:class="block3sensing"} станет `больше чем (>)`{:class="block3operators"} `положение x`:class="block3motion"} у `Труб`. + +![спрайт трубы](images/pipes-sprite.png) + +```blocks3 +когда я начинаю как клон +ждать до <> +``` + +Затем `изменить счёт на 1`{:class="block3variables"} и `воспроизвести звук`:class="block3sound"}. + +\--- /hint \--- + +\--- hint \--- + +Используй эти блоки в правильном порядке: + +![спрайт трубы](images/pipes-sprite.png) + +```blocks3 +когда я начинаю как клон +ждать до <> + +включить звук (pop v) + +изменить [счёт v] на (1) + +([x положение v] от (Flappy v)) + +(положение x) + +<() > ()> +``` + +\--- /hint \--- + +\--- hint \--- + +Твой код должен выглядеть вот так: + +![спрайт трубы](images/pipes-sprite.png) + +```blocks3 +когда я начинаю как клон +ждать до <([x положение v] от (Flappy v)) > (положение x)> +изменить [счёт v] на (1) +включить звук (pop v) +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Протестируй свой код и убедись, что ты набираешь очки каждый раз, когда Flappy пролетает через щели между трубами. Проверь, устанавливается ли `счёт`{:class="block3variables"} на `0` при запуске новой игры. + +\--- /task \--- \ No newline at end of file diff --git a/ru-RU/step_9.md b/ru-RU/step_9.md new file mode 100644 index 0000000..73c2aa2 --- /dev/null +++ b/ru-RU/step_9.md @@ -0,0 +1,5 @@ +## Задача: отрегулировать сложность + +Игра слишком сложна или легка для тебя? Сколько способов изменить сложность ты можешь найти? + +Настраивай игру, пока ты не будешь доволен её сложностью! \ No newline at end of file diff --git a/sl-SI/images/banner.png b/sl-SI/images/banner.png new file mode 100644 index 0000000..7a0da5b Binary files /dev/null and b/sl-SI/images/banner.png differ diff --git a/sl-SI/images/binary-showcase.png b/sl-SI/images/binary-showcase.png new file mode 100644 index 0000000..499aa29 Binary files /dev/null and b/sl-SI/images/binary-showcase.png differ diff --git a/sl-SI/images/flappy-clones-test.png b/sl-SI/images/flappy-clones-test.png new file mode 100644 index 0000000..f874059 Binary files /dev/null and b/sl-SI/images/flappy-clones-test.png differ diff --git a/sl-SI/images/flappy-falling.gif b/sl-SI/images/flappy-falling.gif new file mode 100644 index 0000000..970d833 Binary files /dev/null and b/sl-SI/images/flappy-falling.gif differ diff --git a/sl-SI/images/flappy-flying.gif b/sl-SI/images/flappy-flying.gif new file mode 100644 index 0000000..e259ff1 Binary files /dev/null and b/sl-SI/images/flappy-flying.gif differ diff --git a/sl-SI/images/flappy-height-test.png b/sl-SI/images/flappy-height-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/sl-SI/images/flappy-height-test.png differ diff --git a/sl-SI/images/flappy-parrot-showcase.png b/sl-SI/images/flappy-parrot-showcase.png new file mode 100644 index 0000000..493049b Binary files /dev/null and b/sl-SI/images/flappy-parrot-showcase.png differ diff --git a/sl-SI/images/flappy-pipes-duplicate1-annotated.png b/sl-SI/images/flappy-pipes-duplicate1-annotated.png new file mode 100644 index 0000000..65e32c6 Binary files /dev/null and b/sl-SI/images/flappy-pipes-duplicate1-annotated.png differ diff --git a/sl-SI/images/flappy-pipes-duplicate1.png b/sl-SI/images/flappy-pipes-duplicate1.png new file mode 100644 index 0000000..4239b67 Binary files /dev/null and b/sl-SI/images/flappy-pipes-duplicate1.png differ diff --git a/sl-SI/images/flappy-pipes-duplicate2.png b/sl-SI/images/flappy-pipes-duplicate2.png new file mode 100644 index 0000000..ba1a69a Binary files /dev/null and b/sl-SI/images/flappy-pipes-duplicate2.png differ diff --git a/sl-SI/images/flappy-pipes-ends.png b/sl-SI/images/flappy-pipes-ends.png new file mode 100644 index 0000000..ab59aaa Binary files /dev/null and b/sl-SI/images/flappy-pipes-ends.png differ diff --git a/sl-SI/images/flappy-pipes-fill-rectangle.png b/sl-SI/images/flappy-pipes-fill-rectangle.png new file mode 100644 index 0000000..7360b87 Binary files /dev/null and b/sl-SI/images/flappy-pipes-fill-rectangle.png differ diff --git a/sl-SI/images/flappy-pipes-filled.png b/sl-SI/images/flappy-pipes-filled.png new file mode 100644 index 0000000..7d2c0dd Binary files /dev/null and b/sl-SI/images/flappy-pipes-filled.png differ diff --git a/sl-SI/images/flappy-pipes-position.png b/sl-SI/images/flappy-pipes-position.png new file mode 100644 index 0000000..ca2b810 Binary files /dev/null and b/sl-SI/images/flappy-pipes-position.png differ diff --git a/sl-SI/images/flappy-pipes-rectangle.png b/sl-SI/images/flappy-pipes-rectangle.png new file mode 100644 index 0000000..6e3bf02 Binary files /dev/null and b/sl-SI/images/flappy-pipes-rectangle.png differ diff --git a/sl-SI/images/flappy-pipes-test.png b/sl-SI/images/flappy-pipes-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/sl-SI/images/flappy-pipes-test.png differ diff --git a/sl-SI/images/flappy-setup.png b/sl-SI/images/flappy-setup.png new file mode 100644 index 0000000..92f9eca Binary files /dev/null and b/sl-SI/images/flappy-setup.png differ diff --git a/sl-SI/images/flappy-sprite.png b/sl-SI/images/flappy-sprite.png new file mode 100644 index 0000000..6a0c590 Binary files /dev/null and b/sl-SI/images/flappy-sprite.png differ diff --git a/sl-SI/images/flappy-stage.png b/sl-SI/images/flappy-stage.png new file mode 100644 index 0000000..5efe03c Binary files /dev/null and b/sl-SI/images/flappy-stage.png differ diff --git a/sl-SI/images/flappy-starting-position.png b/sl-SI/images/flappy-starting-position.png new file mode 100644 index 0000000..9089c9e Binary files /dev/null and b/sl-SI/images/flappy-starting-position.png differ diff --git a/sl-SI/images/flappy-wings.png b/sl-SI/images/flappy-wings.png new file mode 100644 index 0000000..ef0aa8e Binary files /dev/null and b/sl-SI/images/flappy-wings.png differ diff --git a/sl-SI/images/pipes-sprite.png b/sl-SI/images/pipes-sprite.png new file mode 100644 index 0000000..a9882ed Binary files /dev/null and b/sl-SI/images/pipes-sprite.png differ diff --git a/sl-SI/meta.yml b/sl-SI/meta.yml new file mode 100644 index 0000000..c2fe5e6 --- /dev/null +++ b/sl-SI/meta.yml @@ -0,0 +1,34 @@ +--- +title: Flappy parrot +hero_image: images/banner.png +description: Create a game in which you guide a parrot past moving obstacles +listed: true +copyedit: true +version: 4.1 +last_tested: 2018-10-90 +steps: + - + title: Introduction + - + title: Add the pipes + - + title: "Challenge: make better pipes" + challenge: true + - + title: Make the pipes move + - + title: Make Flappy fall + - + title: Make Flappy fly + - + title: Detect collisions + - + title: Add a score + - + title: 'Challenge: adjust the difficulty' + challenge: true + - + title: 'Challenge: add a high score' + challenge: true + - + title: What next? diff --git a/sl-SI/scratch-translatable.txt b/sl-SI/scratch-translatable.txt new file mode 100644 index 0000000..214e66c --- /dev/null +++ b/sl-SI/scratch-translatable.txt @@ -0,0 +1,13 @@ +Pipes + +costume1 + +Flappy + +wings down + +wings up + +Game Over! + +score diff --git a/sl-SI/solutions/FlappyParrot-Solution.sb3 b/sl-SI/solutions/FlappyParrot-Solution.sb3 new file mode 100644 index 0000000..a0cd354 Binary files /dev/null and b/sl-SI/solutions/FlappyParrot-Solution.sb3 differ diff --git a/sl-SI/step_1.md b/sl-SI/step_1.md new file mode 100644 index 0000000..f7519ae --- /dev/null +++ b/sl-SI/step_1.md @@ -0,0 +1,69 @@ +\--- no-print \--- + +This is the **Scratch 3** version of the project. There is also a [Scratch 2 version of the project](https://projects.raspberrypi.org/en/projects/flappy-parrot-scratch2). + +\--- /no-print \--- + +## Introduction + +Create a game in which you have to guide a parrot past scrolling pipes to score points. + +### What you will make + +\--- no-print \--- + +Click the green flag to start the game. Press the space bar to make the parrot flap its wings, and try to get it to fly through the gaps in the pipes! You score one point for every pipe that you manage to get the parrot past. + +
+ + +
+ +\--- /no-print \--- + +\--- print-only \--- + +You will press the space bar to make the parrot flap its wings, and score one point for every pipe that you manage to get the parrot past. + +![flappy parrot game being played](images/flappy-parrot-showcase.png) + +\--- /print-only \--- + +## \--- collapse \--- + +## title: What you will need + +### Hardware + ++ A computer capable of running Scratch 3 + +### Software + ++ Scratch 3 (either [online](https://rpf.io/scratchon) or [offline](https://rpf.io/scratchoff)) + +\--- /collapse \--- + +## \--- collapse \--- + +## title: What you will learn + ++ How to create sprites using Vector mode ++ How to use sounds ++ How to detect collisions ++ How to control a sprite using the keyboard + +\--- /collapse \--- + +## \--- collapse \--- + +## title: Additional notes for educators + +\--- no-print \--- + +If you need to print this project, please use the [printer-friendly version](https://projects.raspberrypi.org/en/projects/flappy-parrot/print){:target="_blank"}. + +\--- /no-print \--- + +You can find the [completed project here](https://rpf.io/p/en/flappy-parrot-get). + +\--- /collapse \--- \ No newline at end of file diff --git a/sl-SI/step_10.md b/sl-SI/step_10.md new file mode 100644 index 0000000..a5808f3 --- /dev/null +++ b/sl-SI/step_10.md @@ -0,0 +1,9 @@ +## Challenge: add a high score + +\--- challenge \--- + +Can you add a high score to the game so that, in addition to keeping track of score for the current round, it keeps track of the highest score you've ever reached? + +[[[generic-scratch3-high-score]]] + +\--- /challenge \--- \ No newline at end of file diff --git a/sl-SI/step_11.md b/sl-SI/step_11.md new file mode 100644 index 0000000..02ae229 --- /dev/null +++ b/sl-SI/step_11.md @@ -0,0 +1,19 @@ +## What next? + +Try the [Binary hero](https://projects.raspberrypi.org/en/projects/binary-hero?utm_source=pathway&utm_medium=whatnext&utm_campaign=projects) project, where you will make a game in which you play the notes of a song as they scroll down the Stage. + +\--- no-print \--- + +Click the green flag to start the game. Use the z, x, c, and v keys to play the correct notes when these reach the bottom of the Stage. You'll score ten points for every correct note you play. + +
+ +
+ +\--- /no-print \--- + +\--- print-only \--- + +The notes will fall from above, and you will have to press keys to "catch" and play the notes. ![showcase](images/binary-showcase.png) + +\--- /print-only \--- \ No newline at end of file diff --git a/sl-SI/step_2.md b/sl-SI/step_2.md new file mode 100644 index 0000000..d8f2ce5 --- /dev/null +++ b/sl-SI/step_2.md @@ -0,0 +1,84 @@ +## Add the pipes + +First, create the pipes. + +\--- task \--- + +Open a new empty Scratch project. + +[[[generic-scratch3-new-project]]] + +\--- /task \--- + +\--- task \--- + +Add a backdrop with an outdoor landscape. 'Blue Sky' is a good choice. + +![screenshot](images/flappy-stage.png) + +[[[generic-scratch3-backdrop-from-library]]] + +\--- /task \--- + +\--- task \--- + +Create a new sprite and name it 'Pipes'. + +[[[generic-scratch3-draw-sprite]]] + +\--- /task \--- + +The 'Pipes' sprite should be a pair of pipes with a gap in the middle. By moving the sprite up or down, you can put the gap in a different place. + +This picture shows an example of how the pipes could be positioned. The parts of the sprite outside the Stage are normally hidden, you only see then when you drag the sprite: + +![screenshot](images/flappy-pipes-position.png) + +You can't draw a sprite as big as the pipes need to be, but you can increase the size at which the sprite shows on the Stage. + +\--- task \--- + +![pipes sprite](images/pipes-sprite.png) + +Add code to make the sprite bigger. + +```blocks3 +when green flag clicked +set size to (200) % +``` + +This makes it's easier to see how big the pipes should be. + +\--- /task \--- + +\--- task \--- + +Draw a rectangle for the top pipe as shown here: + +![rectangle for the pipe](images/flappy-pipes-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Fill the pipe with a colour you like. + +![fill the rectangle](images/flappy-pipes-fill-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Create a duplicate of the pipe by selecting it and then clicking on **Copy** and **Paste**. + +![copy and paste pipe](images/flappy-pipes-duplicate1-annotated.png) + +\--- /task \--- + +\--- task \--- + +Drag the copy of the pipe to the bottom of the screen so that the copy is in line with the other pipe. There needs to be a gap between the two pipes. + +![screenshot](images/flappy-pipes-duplicate2.png) + +\--- /task \--- \ No newline at end of file diff --git a/sl-SI/step_3.md b/sl-SI/step_3.md new file mode 100644 index 0000000..17f05f7 --- /dev/null +++ b/sl-SI/step_3.md @@ -0,0 +1,11 @@ +## Challenge: make better pipes + +Can you make your pipes look better? + ++ Shade your pipes with a left-to-right gradient. + +![screenshot](images/flappy-pipes-filled.png) + ++ Add extra rectangles to the ends of the pipes: + +![screenshot](images/flappy-pipes-ends.png) \ No newline at end of file diff --git a/sl-SI/step_4.md b/sl-SI/step_4.md new file mode 100644 index 0000000..2beedd9 --- /dev/null +++ b/sl-SI/step_4.md @@ -0,0 +1,65 @@ +## Make the pipes move + +Next you're going to make the pipes move across the screen to create an obstacle course. + +![pipes moving across the screen](images/flappy-clones-test.png) + +\--- task \--- + +First make the pipes appear by adding code to the Pipes sprite so that, `when the green flag is clicked`{:class="block3events"}, the sprite `forever`{:class="block3control"} `creates a clone of itself`{:class="block3control"} every two seconds. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +**Tip:** clones are just copies of a sprite, and they are really useful for creating games. + +\--- /task \--- + +\--- task \--- + +Next make the pipes move by adding code so that, `when a clone starts`{:class="block3control"}, the clone appears on the right side of the Stage and `glides`{:class="block3motion"} across to the left. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show +go to x: (240) y: (0) +glide (4) secs to x: (-240) y: (0) +delete this clone +``` + +**Tip:** you can stop the pipes scrolling by clicking the red **stop** button next to the green flag. + +\--- /task \--- + +Now you should have lots of pipes, but their gaps are always in the same place. + +You can add some variety by using a `random`{:class="block3operators"} number for the Pipes sprite's `y position`{:class="block3motion"}. + +![pipes at different heights](images/flappy-height-test.png) + +\--- task \--- + +Modify your sprite's code so that each sprite clone `picks a random number from -80 to 80`{:class="block3operators"} and `glides`{:class="block3motion"} to that `y position`{:class="block3motion"}: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show ++ go to x: (240) y: (pick random (-80) to (80)) ++ glide (4) secs to x: (-240) y: (y position) +delete this clone +``` + +\--- /task \--- \ No newline at end of file diff --git a/sl-SI/step_5.md b/sl-SI/step_5.md new file mode 100644 index 0000000..f9d79ce --- /dev/null +++ b/sl-SI/step_5.md @@ -0,0 +1,77 @@ +## Make Flappy fall + +Now add a sprite called Flappy and create code it so Flappy falls down the Stage. In the next step, you will add the code to make Flappy fly when you press a key. + +\--- no-print \--- + +![flappy falling animation](images/flappy-falling.gif) + +\--- /no-print \--- + +\--- task \--- + +Add a new sprite that has two costumes, for 'wings up' and 'wings down', and name it `Flappy`. + +The parrot sprite is a good choice. + +![parrot sprite](images/flappy-sprite.png) + +\--- /task \--- + +Flappy needs to be smaller. + +\--- task \--- + +Add code to `set Flappy's size to 25%`{:class="block3looks"} `when the green flag is clicked`{:class="block3events"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +``` + +\--- /task \--- + +When the game starts, Flappy needs to be just left of the centre of the Stage, at coordinates `-50, 0`. + +![flappy shown at the start position](images/flappy-starting-position.png) + +\--- task \--- + +Add code to make Flappy `go to the x and y`{:class="block3motion"} starting position of `x: -50`{:class="block3motion"} and `y: 0`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % ++ go to x: (-50) y: (0) +``` + +[[[generic-scratch3-set-coordinates]]] + +\--- /task \--- + +\--- task \--- + +Now make Flappy keep falling down the Stage by `forever`{:class="block3control"} `changing the sprite's y position by -3`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +go to x: (-50) y: (0) ++ forever + change y by (-3) +end +``` + +\--- /task \--- + +\--- task \--- + +Test your code to make sure Flappy starts in the middle of the screen and falls to the bottom. When you drag Flappy to the top of the Stage, the sprite should fall again. + +\--- /task \--- \ No newline at end of file diff --git a/sl-SI/step_6.md b/sl-SI/step_6.md new file mode 100644 index 0000000..1a98cb2 --- /dev/null +++ b/sl-SI/step_6.md @@ -0,0 +1,106 @@ +## Make Flappy fly + +Now you will make Flappy flap upwards when you press the space bar. When you play the game, you have to time your taps to get Flappy through the gaps in the pipes. + +\--- no-print \--- + +![flappy flying upwards when space bar is pressed](images/flappy-flying.gif) + +\--- /no-print \--- + +Make Flappy fly upwards when you tap the space bar. + +\--- task \--- + +When the `space key is pressed`{:class="block3events"}, Flappy should move upwards by `changing its y coordinate`{:class="block3motion"} by a small amount, for example `6`. + +Flappy flies upwards by `repeating`{:class="block3control"} this movement `10 times`{:class="block3control"}. + +Add this code to your `Flappy` sprite: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +repeat (10) + change y by (6) +end +``` + +\--- /task \--- + +Now you need to get Flappy's wings flapping! + +\--- task \--- + +Click on the **Costumes** tab, and name Flappy's costumes 'wings up' and 'wings down'. + +![naming the costumes](images/flappy-wings.png) + +\--- /task \--- + +\--- task \--- + +Can you make Flappy's costume change to `wings down` when you press space, and then change it back to `wings up` halfway through the upward movement? + +\--- hints \--- + +\--- hint \--- + +You need to split the upward motion in half so that you can use two `repeat`{:class="block3control"} blocks to change Flappy's costume at the beginning and in the middle of the movement. + +Add `switch costume to`{:class="block3looks"} blocks to change how Flappy looks. + +\--- /hint \--- \--- hint \--- + +You need to use these blocks: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +repeat (5) + change y by (6) +end + +repeat (5) + change y by (6) +end + +switch costume to (wings up v) + +switch costume to (wings down v) + +when [space v] key pressed +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +switch costume to (wings down v) +repeat (5) + change y by (6) +end +switch costume to (wings up v) +repeat (5) + change y by (6) +end +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code. As you see, at the moment nothing happens if you let Flappy hit a pipe. + +\--- /task \--- \ No newline at end of file diff --git a/sl-SI/step_7.md b/sl-SI/step_7.md new file mode 100644 index 0000000..40a2720 --- /dev/null +++ b/sl-SI/step_7.md @@ -0,0 +1,77 @@ +## Detect collisions + +To make the game a challenge, the player needs to guide Flappy through the gaps without letting the parrot touch the pipes or the edges of the Stage. You need to add some blocks to detect when Flappy hits something. + +This is called **collision detection**. + +\--- task \--- + +Import a sound from the library that you want to play when Flappy collides with something. The 'screech' sound is a good choice. + +[[[generic-scratch3-sound-from-library]]] + +\--- /task \--- + +A `wait until`{:class="block3control"} block is necessart to check whether Flappy is `touching the pipes`{:class="block3sensing"} `or`{:class="block3operators"} `touching the edge`{:class="block3sensing"}. + +\--- task \--- + +Add a new `when green flag clicked`{:class="block3control"} block to the 'Flappy' sprite, and also add the following code: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) +``` + +\--- /task \--- + +\--- task \--- + +Test your code. If Flappy touches a pipe, the 'screech' sound should play. + +\--- /task \--- + +Next, update the code so that the game stops when Flappy hits a pipe. + +\--- task \--- + +Add the following code to stop the game after a collision is detected: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) ++ say [Game Over!] ++ broadcast (Game Over v) ++ stop [other scripts in sprite v] +``` + +The `broadcast`{:class="block3events"} block tells other sprites that the game is over. + +The `stop`{:class="block3control"} block stops other Flappy scripts that are running so that Flappy stops falling after a collision. + +\--- /task \--- + +\--- task \--- + +Finally, add the following code to the `Pipes` sprite so that pipes `stop`{:class="block3control"} appearing `when the sprite receives Game Over`{:class="block3events"}. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I receive [Game Over v] +stop [other scripts in sprite v] +``` + +\--- /task \--- + +\--- task \--- + +Test your game and see how long you can play before it's 'Game over'! + +\--- /task \--- \ No newline at end of file diff --git a/sl-SI/step_8.md b/sl-SI/step_8.md new file mode 100644 index 0000000..2c5cc08 --- /dev/null +++ b/sl-SI/step_8.md @@ -0,0 +1,116 @@ +## Add a score + +The player should score a point every time Flappy makes it through a gap between pipes. + +\--- task \--- + +Make a new variable **for all sprites** and call it `score`{:class="block3variables"}. + +[[[generic-scratch3-add-variable]]] + +\--- /task \--- + +Each 'Pipes' sprite clone should `wait until`{:class="block3control"} Flappy has flown past and then increase the `score`{:class="block3variables"}. + +\--- task \--- + +First, `set score to 0`{:class="block3variables"} when the game begins: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked ++ set [score v] to [0] +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +\--- /task \--- + +\--- task \--- + +Then add the following code to the `Pipes` sprite: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> +``` + +\--- /task \--- + +\--- task \--- + +Add more code so that, when Flappy's `x` position is greater than the pipe clone's `x` position, the `score`{:class="block3variables"} increases by `1` and a sound of your choice plays. + +You could use the 'pop' sound if you want, or add a sound from the library, for example 'bird'. + +\--- hints \--- + +\--- hint \--- + +You need to `wait until`{:class="block3control"} `Flappy's x position`{:class="block3sensing"} is `greater than (>)`{:class="block3operators"} the `x position`{:class="block3motion"} of `Pipes`. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone ++ wait until <> +``` + +Then `change score by 1`{:class="block3variables"} and `play a sound`{:class="block3sound"}. + +\--- /hint \--- + +\--- hint \--- + +Use these blocks in the correct order: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> + +play sound (pop v) + +change [score v] by (1) + +[x position v] of (Flappy v) + +x position + +() > () +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <([x position v] of (Flappy v)) > (x position)> +change [score v] by (1) +play sound (pop v) +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code and make sure you score a point every time Flappy gets through a gap between pipes. Check whether the `score`{:class="block3variables"} is set to `0` when you start a new game. + +\--- /task \--- \ No newline at end of file diff --git a/sl-SI/step_9.md b/sl-SI/step_9.md new file mode 100644 index 0000000..2f4e2e6 --- /dev/null +++ b/sl-SI/step_9.md @@ -0,0 +1,5 @@ +## Challenge: adjust the difficulty + +Is the game too hard or too easy for you? How many ways can you find to change the difficulty? + +Adjust the game until you are happy with its difficulty! \ No newline at end of file diff --git a/sr-SP/images/banner.png b/sr-SP/images/banner.png new file mode 100644 index 0000000..7a0da5b Binary files /dev/null and b/sr-SP/images/banner.png differ diff --git a/sr-SP/images/binary-showcase.png b/sr-SP/images/binary-showcase.png new file mode 100644 index 0000000..499aa29 Binary files /dev/null and b/sr-SP/images/binary-showcase.png differ diff --git a/sr-SP/images/flappy-clones-test.png b/sr-SP/images/flappy-clones-test.png new file mode 100644 index 0000000..f874059 Binary files /dev/null and b/sr-SP/images/flappy-clones-test.png differ diff --git a/sr-SP/images/flappy-falling.gif b/sr-SP/images/flappy-falling.gif new file mode 100644 index 0000000..970d833 Binary files /dev/null and b/sr-SP/images/flappy-falling.gif differ diff --git a/sr-SP/images/flappy-flying.gif b/sr-SP/images/flappy-flying.gif new file mode 100644 index 0000000..e259ff1 Binary files /dev/null and b/sr-SP/images/flappy-flying.gif differ diff --git a/sr-SP/images/flappy-height-test.png b/sr-SP/images/flappy-height-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/sr-SP/images/flappy-height-test.png differ diff --git a/sr-SP/images/flappy-parrot-showcase.png b/sr-SP/images/flappy-parrot-showcase.png new file mode 100644 index 0000000..493049b Binary files /dev/null and b/sr-SP/images/flappy-parrot-showcase.png differ diff --git a/sr-SP/images/flappy-pipes-duplicate1-annotated.png b/sr-SP/images/flappy-pipes-duplicate1-annotated.png new file mode 100644 index 0000000..65e32c6 Binary files /dev/null and b/sr-SP/images/flappy-pipes-duplicate1-annotated.png differ diff --git a/sr-SP/images/flappy-pipes-duplicate1.png b/sr-SP/images/flappy-pipes-duplicate1.png new file mode 100644 index 0000000..4239b67 Binary files /dev/null and b/sr-SP/images/flappy-pipes-duplicate1.png differ diff --git a/sr-SP/images/flappy-pipes-duplicate2.png b/sr-SP/images/flappy-pipes-duplicate2.png new file mode 100644 index 0000000..ba1a69a Binary files /dev/null and b/sr-SP/images/flappy-pipes-duplicate2.png differ diff --git a/sr-SP/images/flappy-pipes-ends.png b/sr-SP/images/flappy-pipes-ends.png new file mode 100644 index 0000000..ab59aaa Binary files /dev/null and b/sr-SP/images/flappy-pipes-ends.png differ diff --git a/sr-SP/images/flappy-pipes-fill-rectangle.png b/sr-SP/images/flappy-pipes-fill-rectangle.png new file mode 100644 index 0000000..7360b87 Binary files /dev/null and b/sr-SP/images/flappy-pipes-fill-rectangle.png differ diff --git a/sr-SP/images/flappy-pipes-filled.png b/sr-SP/images/flappy-pipes-filled.png new file mode 100644 index 0000000..7d2c0dd Binary files /dev/null and b/sr-SP/images/flappy-pipes-filled.png differ diff --git a/sr-SP/images/flappy-pipes-position.png b/sr-SP/images/flappy-pipes-position.png new file mode 100644 index 0000000..ca2b810 Binary files /dev/null and b/sr-SP/images/flappy-pipes-position.png differ diff --git a/sr-SP/images/flappy-pipes-rectangle.png b/sr-SP/images/flappy-pipes-rectangle.png new file mode 100644 index 0000000..6e3bf02 Binary files /dev/null and b/sr-SP/images/flappy-pipes-rectangle.png differ diff --git a/sr-SP/images/flappy-pipes-test.png b/sr-SP/images/flappy-pipes-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/sr-SP/images/flappy-pipes-test.png differ diff --git a/sr-SP/images/flappy-setup.png b/sr-SP/images/flappy-setup.png new file mode 100644 index 0000000..92f9eca Binary files /dev/null and b/sr-SP/images/flappy-setup.png differ diff --git a/sr-SP/images/flappy-sprite.png b/sr-SP/images/flappy-sprite.png new file mode 100644 index 0000000..6a0c590 Binary files /dev/null and b/sr-SP/images/flappy-sprite.png differ diff --git a/sr-SP/images/flappy-stage.png b/sr-SP/images/flappy-stage.png new file mode 100644 index 0000000..5efe03c Binary files /dev/null and b/sr-SP/images/flappy-stage.png differ diff --git a/sr-SP/images/flappy-starting-position.png b/sr-SP/images/flappy-starting-position.png new file mode 100644 index 0000000..9089c9e Binary files /dev/null and b/sr-SP/images/flappy-starting-position.png differ diff --git a/sr-SP/images/flappy-wings.png b/sr-SP/images/flappy-wings.png new file mode 100644 index 0000000..ef0aa8e Binary files /dev/null and b/sr-SP/images/flappy-wings.png differ diff --git a/sr-SP/images/pipes-sprite.png b/sr-SP/images/pipes-sprite.png new file mode 100644 index 0000000..a9882ed Binary files /dev/null and b/sr-SP/images/pipes-sprite.png differ diff --git a/sr-SP/meta.yml b/sr-SP/meta.yml new file mode 100644 index 0000000..c2fe5e6 --- /dev/null +++ b/sr-SP/meta.yml @@ -0,0 +1,34 @@ +--- +title: Flappy parrot +hero_image: images/banner.png +description: Create a game in which you guide a parrot past moving obstacles +listed: true +copyedit: true +version: 4.1 +last_tested: 2018-10-90 +steps: + - + title: Introduction + - + title: Add the pipes + - + title: "Challenge: make better pipes" + challenge: true + - + title: Make the pipes move + - + title: Make Flappy fall + - + title: Make Flappy fly + - + title: Detect collisions + - + title: Add a score + - + title: 'Challenge: adjust the difficulty' + challenge: true + - + title: 'Challenge: add a high score' + challenge: true + - + title: What next? diff --git a/sr-SP/scratch-translatable.txt b/sr-SP/scratch-translatable.txt new file mode 100644 index 0000000..214e66c --- /dev/null +++ b/sr-SP/scratch-translatable.txt @@ -0,0 +1,13 @@ +Pipes + +costume1 + +Flappy + +wings down + +wings up + +Game Over! + +score diff --git a/sr-SP/solutions/FlappyParrot-Solution.sb3 b/sr-SP/solutions/FlappyParrot-Solution.sb3 new file mode 100644 index 0000000..a0cd354 Binary files /dev/null and b/sr-SP/solutions/FlappyParrot-Solution.sb3 differ diff --git a/sr-SP/step_1.md b/sr-SP/step_1.md new file mode 100644 index 0000000..f7519ae --- /dev/null +++ b/sr-SP/step_1.md @@ -0,0 +1,69 @@ +\--- no-print \--- + +This is the **Scratch 3** version of the project. There is also a [Scratch 2 version of the project](https://projects.raspberrypi.org/en/projects/flappy-parrot-scratch2). + +\--- /no-print \--- + +## Introduction + +Create a game in which you have to guide a parrot past scrolling pipes to score points. + +### What you will make + +\--- no-print \--- + +Click the green flag to start the game. Press the space bar to make the parrot flap its wings, and try to get it to fly through the gaps in the pipes! You score one point for every pipe that you manage to get the parrot past. + +
+ + +
+ +\--- /no-print \--- + +\--- print-only \--- + +You will press the space bar to make the parrot flap its wings, and score one point for every pipe that you manage to get the parrot past. + +![flappy parrot game being played](images/flappy-parrot-showcase.png) + +\--- /print-only \--- + +## \--- collapse \--- + +## title: What you will need + +### Hardware + ++ A computer capable of running Scratch 3 + +### Software + ++ Scratch 3 (either [online](https://rpf.io/scratchon) or [offline](https://rpf.io/scratchoff)) + +\--- /collapse \--- + +## \--- collapse \--- + +## title: What you will learn + ++ How to create sprites using Vector mode ++ How to use sounds ++ How to detect collisions ++ How to control a sprite using the keyboard + +\--- /collapse \--- + +## \--- collapse \--- + +## title: Additional notes for educators + +\--- no-print \--- + +If you need to print this project, please use the [printer-friendly version](https://projects.raspberrypi.org/en/projects/flappy-parrot/print){:target="_blank"}. + +\--- /no-print \--- + +You can find the [completed project here](https://rpf.io/p/en/flappy-parrot-get). + +\--- /collapse \--- \ No newline at end of file diff --git a/sr-SP/step_10.md b/sr-SP/step_10.md new file mode 100644 index 0000000..a5808f3 --- /dev/null +++ b/sr-SP/step_10.md @@ -0,0 +1,9 @@ +## Challenge: add a high score + +\--- challenge \--- + +Can you add a high score to the game so that, in addition to keeping track of score for the current round, it keeps track of the highest score you've ever reached? + +[[[generic-scratch3-high-score]]] + +\--- /challenge \--- \ No newline at end of file diff --git a/sr-SP/step_11.md b/sr-SP/step_11.md new file mode 100644 index 0000000..02ae229 --- /dev/null +++ b/sr-SP/step_11.md @@ -0,0 +1,19 @@ +## What next? + +Try the [Binary hero](https://projects.raspberrypi.org/en/projects/binary-hero?utm_source=pathway&utm_medium=whatnext&utm_campaign=projects) project, where you will make a game in which you play the notes of a song as they scroll down the Stage. + +\--- no-print \--- + +Click the green flag to start the game. Use the z, x, c, and v keys to play the correct notes when these reach the bottom of the Stage. You'll score ten points for every correct note you play. + +
+ +
+ +\--- /no-print \--- + +\--- print-only \--- + +The notes will fall from above, and you will have to press keys to "catch" and play the notes. ![showcase](images/binary-showcase.png) + +\--- /print-only \--- \ No newline at end of file diff --git a/sr-SP/step_2.md b/sr-SP/step_2.md new file mode 100644 index 0000000..d8f2ce5 --- /dev/null +++ b/sr-SP/step_2.md @@ -0,0 +1,84 @@ +## Add the pipes + +First, create the pipes. + +\--- task \--- + +Open a new empty Scratch project. + +[[[generic-scratch3-new-project]]] + +\--- /task \--- + +\--- task \--- + +Add a backdrop with an outdoor landscape. 'Blue Sky' is a good choice. + +![screenshot](images/flappy-stage.png) + +[[[generic-scratch3-backdrop-from-library]]] + +\--- /task \--- + +\--- task \--- + +Create a new sprite and name it 'Pipes'. + +[[[generic-scratch3-draw-sprite]]] + +\--- /task \--- + +The 'Pipes' sprite should be a pair of pipes with a gap in the middle. By moving the sprite up or down, you can put the gap in a different place. + +This picture shows an example of how the pipes could be positioned. The parts of the sprite outside the Stage are normally hidden, you only see then when you drag the sprite: + +![screenshot](images/flappy-pipes-position.png) + +You can't draw a sprite as big as the pipes need to be, but you can increase the size at which the sprite shows on the Stage. + +\--- task \--- + +![pipes sprite](images/pipes-sprite.png) + +Add code to make the sprite bigger. + +```blocks3 +when green flag clicked +set size to (200) % +``` + +This makes it's easier to see how big the pipes should be. + +\--- /task \--- + +\--- task \--- + +Draw a rectangle for the top pipe as shown here: + +![rectangle for the pipe](images/flappy-pipes-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Fill the pipe with a colour you like. + +![fill the rectangle](images/flappy-pipes-fill-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Create a duplicate of the pipe by selecting it and then clicking on **Copy** and **Paste**. + +![copy and paste pipe](images/flappy-pipes-duplicate1-annotated.png) + +\--- /task \--- + +\--- task \--- + +Drag the copy of the pipe to the bottom of the screen so that the copy is in line with the other pipe. There needs to be a gap between the two pipes. + +![screenshot](images/flappy-pipes-duplicate2.png) + +\--- /task \--- \ No newline at end of file diff --git a/sr-SP/step_3.md b/sr-SP/step_3.md new file mode 100644 index 0000000..17f05f7 --- /dev/null +++ b/sr-SP/step_3.md @@ -0,0 +1,11 @@ +## Challenge: make better pipes + +Can you make your pipes look better? + ++ Shade your pipes with a left-to-right gradient. + +![screenshot](images/flappy-pipes-filled.png) + ++ Add extra rectangles to the ends of the pipes: + +![screenshot](images/flappy-pipes-ends.png) \ No newline at end of file diff --git a/sr-SP/step_4.md b/sr-SP/step_4.md new file mode 100644 index 0000000..2beedd9 --- /dev/null +++ b/sr-SP/step_4.md @@ -0,0 +1,65 @@ +## Make the pipes move + +Next you're going to make the pipes move across the screen to create an obstacle course. + +![pipes moving across the screen](images/flappy-clones-test.png) + +\--- task \--- + +First make the pipes appear by adding code to the Pipes sprite so that, `when the green flag is clicked`{:class="block3events"}, the sprite `forever`{:class="block3control"} `creates a clone of itself`{:class="block3control"} every two seconds. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +**Tip:** clones are just copies of a sprite, and they are really useful for creating games. + +\--- /task \--- + +\--- task \--- + +Next make the pipes move by adding code so that, `when a clone starts`{:class="block3control"}, the clone appears on the right side of the Stage and `glides`{:class="block3motion"} across to the left. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show +go to x: (240) y: (0) +glide (4) secs to x: (-240) y: (0) +delete this clone +``` + +**Tip:** you can stop the pipes scrolling by clicking the red **stop** button next to the green flag. + +\--- /task \--- + +Now you should have lots of pipes, but their gaps are always in the same place. + +You can add some variety by using a `random`{:class="block3operators"} number for the Pipes sprite's `y position`{:class="block3motion"}. + +![pipes at different heights](images/flappy-height-test.png) + +\--- task \--- + +Modify your sprite's code so that each sprite clone `picks a random number from -80 to 80`{:class="block3operators"} and `glides`{:class="block3motion"} to that `y position`{:class="block3motion"}: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show ++ go to x: (240) y: (pick random (-80) to (80)) ++ glide (4) secs to x: (-240) y: (y position) +delete this clone +``` + +\--- /task \--- \ No newline at end of file diff --git a/sr-SP/step_5.md b/sr-SP/step_5.md new file mode 100644 index 0000000..f9d79ce --- /dev/null +++ b/sr-SP/step_5.md @@ -0,0 +1,77 @@ +## Make Flappy fall + +Now add a sprite called Flappy and create code it so Flappy falls down the Stage. In the next step, you will add the code to make Flappy fly when you press a key. + +\--- no-print \--- + +![flappy falling animation](images/flappy-falling.gif) + +\--- /no-print \--- + +\--- task \--- + +Add a new sprite that has two costumes, for 'wings up' and 'wings down', and name it `Flappy`. + +The parrot sprite is a good choice. + +![parrot sprite](images/flappy-sprite.png) + +\--- /task \--- + +Flappy needs to be smaller. + +\--- task \--- + +Add code to `set Flappy's size to 25%`{:class="block3looks"} `when the green flag is clicked`{:class="block3events"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +``` + +\--- /task \--- + +When the game starts, Flappy needs to be just left of the centre of the Stage, at coordinates `-50, 0`. + +![flappy shown at the start position](images/flappy-starting-position.png) + +\--- task \--- + +Add code to make Flappy `go to the x and y`{:class="block3motion"} starting position of `x: -50`{:class="block3motion"} and `y: 0`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % ++ go to x: (-50) y: (0) +``` + +[[[generic-scratch3-set-coordinates]]] + +\--- /task \--- + +\--- task \--- + +Now make Flappy keep falling down the Stage by `forever`{:class="block3control"} `changing the sprite's y position by -3`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +go to x: (-50) y: (0) ++ forever + change y by (-3) +end +``` + +\--- /task \--- + +\--- task \--- + +Test your code to make sure Flappy starts in the middle of the screen and falls to the bottom. When you drag Flappy to the top of the Stage, the sprite should fall again. + +\--- /task \--- \ No newline at end of file diff --git a/sr-SP/step_6.md b/sr-SP/step_6.md new file mode 100644 index 0000000..1a98cb2 --- /dev/null +++ b/sr-SP/step_6.md @@ -0,0 +1,106 @@ +## Make Flappy fly + +Now you will make Flappy flap upwards when you press the space bar. When you play the game, you have to time your taps to get Flappy through the gaps in the pipes. + +\--- no-print \--- + +![flappy flying upwards when space bar is pressed](images/flappy-flying.gif) + +\--- /no-print \--- + +Make Flappy fly upwards when you tap the space bar. + +\--- task \--- + +When the `space key is pressed`{:class="block3events"}, Flappy should move upwards by `changing its y coordinate`{:class="block3motion"} by a small amount, for example `6`. + +Flappy flies upwards by `repeating`{:class="block3control"} this movement `10 times`{:class="block3control"}. + +Add this code to your `Flappy` sprite: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +repeat (10) + change y by (6) +end +``` + +\--- /task \--- + +Now you need to get Flappy's wings flapping! + +\--- task \--- + +Click on the **Costumes** tab, and name Flappy's costumes 'wings up' and 'wings down'. + +![naming the costumes](images/flappy-wings.png) + +\--- /task \--- + +\--- task \--- + +Can you make Flappy's costume change to `wings down` when you press space, and then change it back to `wings up` halfway through the upward movement? + +\--- hints \--- + +\--- hint \--- + +You need to split the upward motion in half so that you can use two `repeat`{:class="block3control"} blocks to change Flappy's costume at the beginning and in the middle of the movement. + +Add `switch costume to`{:class="block3looks"} blocks to change how Flappy looks. + +\--- /hint \--- \--- hint \--- + +You need to use these blocks: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +repeat (5) + change y by (6) +end + +repeat (5) + change y by (6) +end + +switch costume to (wings up v) + +switch costume to (wings down v) + +when [space v] key pressed +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +switch costume to (wings down v) +repeat (5) + change y by (6) +end +switch costume to (wings up v) +repeat (5) + change y by (6) +end +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code. As you see, at the moment nothing happens if you let Flappy hit a pipe. + +\--- /task \--- \ No newline at end of file diff --git a/sr-SP/step_7.md b/sr-SP/step_7.md new file mode 100644 index 0000000..40a2720 --- /dev/null +++ b/sr-SP/step_7.md @@ -0,0 +1,77 @@ +## Detect collisions + +To make the game a challenge, the player needs to guide Flappy through the gaps without letting the parrot touch the pipes or the edges of the Stage. You need to add some blocks to detect when Flappy hits something. + +This is called **collision detection**. + +\--- task \--- + +Import a sound from the library that you want to play when Flappy collides with something. The 'screech' sound is a good choice. + +[[[generic-scratch3-sound-from-library]]] + +\--- /task \--- + +A `wait until`{:class="block3control"} block is necessart to check whether Flappy is `touching the pipes`{:class="block3sensing"} `or`{:class="block3operators"} `touching the edge`{:class="block3sensing"}. + +\--- task \--- + +Add a new `when green flag clicked`{:class="block3control"} block to the 'Flappy' sprite, and also add the following code: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) +``` + +\--- /task \--- + +\--- task \--- + +Test your code. If Flappy touches a pipe, the 'screech' sound should play. + +\--- /task \--- + +Next, update the code so that the game stops when Flappy hits a pipe. + +\--- task \--- + +Add the following code to stop the game after a collision is detected: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) ++ say [Game Over!] ++ broadcast (Game Over v) ++ stop [other scripts in sprite v] +``` + +The `broadcast`{:class="block3events"} block tells other sprites that the game is over. + +The `stop`{:class="block3control"} block stops other Flappy scripts that are running so that Flappy stops falling after a collision. + +\--- /task \--- + +\--- task \--- + +Finally, add the following code to the `Pipes` sprite so that pipes `stop`{:class="block3control"} appearing `when the sprite receives Game Over`{:class="block3events"}. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I receive [Game Over v] +stop [other scripts in sprite v] +``` + +\--- /task \--- + +\--- task \--- + +Test your game and see how long you can play before it's 'Game over'! + +\--- /task \--- \ No newline at end of file diff --git a/sr-SP/step_8.md b/sr-SP/step_8.md new file mode 100644 index 0000000..2c5cc08 --- /dev/null +++ b/sr-SP/step_8.md @@ -0,0 +1,116 @@ +## Add a score + +The player should score a point every time Flappy makes it through a gap between pipes. + +\--- task \--- + +Make a new variable **for all sprites** and call it `score`{:class="block3variables"}. + +[[[generic-scratch3-add-variable]]] + +\--- /task \--- + +Each 'Pipes' sprite clone should `wait until`{:class="block3control"} Flappy has flown past and then increase the `score`{:class="block3variables"}. + +\--- task \--- + +First, `set score to 0`{:class="block3variables"} when the game begins: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked ++ set [score v] to [0] +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +\--- /task \--- + +\--- task \--- + +Then add the following code to the `Pipes` sprite: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> +``` + +\--- /task \--- + +\--- task \--- + +Add more code so that, when Flappy's `x` position is greater than the pipe clone's `x` position, the `score`{:class="block3variables"} increases by `1` and a sound of your choice plays. + +You could use the 'pop' sound if you want, or add a sound from the library, for example 'bird'. + +\--- hints \--- + +\--- hint \--- + +You need to `wait until`{:class="block3control"} `Flappy's x position`{:class="block3sensing"} is `greater than (>)`{:class="block3operators"} the `x position`{:class="block3motion"} of `Pipes`. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone ++ wait until <> +``` + +Then `change score by 1`{:class="block3variables"} and `play a sound`{:class="block3sound"}. + +\--- /hint \--- + +\--- hint \--- + +Use these blocks in the correct order: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> + +play sound (pop v) + +change [score v] by (1) + +[x position v] of (Flappy v) + +x position + +() > () +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <([x position v] of (Flappy v)) > (x position)> +change [score v] by (1) +play sound (pop v) +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code and make sure you score a point every time Flappy gets through a gap between pipes. Check whether the `score`{:class="block3variables"} is set to `0` when you start a new game. + +\--- /task \--- \ No newline at end of file diff --git a/sr-SP/step_9.md b/sr-SP/step_9.md new file mode 100644 index 0000000..2f4e2e6 --- /dev/null +++ b/sr-SP/step_9.md @@ -0,0 +1,5 @@ +## Challenge: adjust the difficulty + +Is the game too hard or too easy for you? How many ways can you find to change the difficulty? + +Adjust the game until you are happy with its difficulty! \ No newline at end of file diff --git a/sv-SE/images/banner.png b/sv-SE/images/banner.png new file mode 100644 index 0000000..7a0da5b Binary files /dev/null and b/sv-SE/images/banner.png differ diff --git a/sv-SE/images/binary-showcase.png b/sv-SE/images/binary-showcase.png new file mode 100644 index 0000000..499aa29 Binary files /dev/null and b/sv-SE/images/binary-showcase.png differ diff --git a/sv-SE/images/flappy-clones-test.png b/sv-SE/images/flappy-clones-test.png new file mode 100644 index 0000000..f874059 Binary files /dev/null and b/sv-SE/images/flappy-clones-test.png differ diff --git a/sv-SE/images/flappy-falling.gif b/sv-SE/images/flappy-falling.gif new file mode 100644 index 0000000..970d833 Binary files /dev/null and b/sv-SE/images/flappy-falling.gif differ diff --git a/sv-SE/images/flappy-flying.gif b/sv-SE/images/flappy-flying.gif new file mode 100644 index 0000000..e259ff1 Binary files /dev/null and b/sv-SE/images/flappy-flying.gif differ diff --git a/sv-SE/images/flappy-height-test.png b/sv-SE/images/flappy-height-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/sv-SE/images/flappy-height-test.png differ diff --git a/sv-SE/images/flappy-parrot-showcase.png b/sv-SE/images/flappy-parrot-showcase.png new file mode 100644 index 0000000..493049b Binary files /dev/null and b/sv-SE/images/flappy-parrot-showcase.png differ diff --git a/sv-SE/images/flappy-pipes-duplicate1-annotated.png b/sv-SE/images/flappy-pipes-duplicate1-annotated.png new file mode 100644 index 0000000..65e32c6 Binary files /dev/null and b/sv-SE/images/flappy-pipes-duplicate1-annotated.png differ diff --git a/sv-SE/images/flappy-pipes-duplicate1.png b/sv-SE/images/flappy-pipes-duplicate1.png new file mode 100644 index 0000000..4239b67 Binary files /dev/null and b/sv-SE/images/flappy-pipes-duplicate1.png differ diff --git a/sv-SE/images/flappy-pipes-duplicate2.png b/sv-SE/images/flappy-pipes-duplicate2.png new file mode 100644 index 0000000..ba1a69a Binary files /dev/null and b/sv-SE/images/flappy-pipes-duplicate2.png differ diff --git a/sv-SE/images/flappy-pipes-ends.png b/sv-SE/images/flappy-pipes-ends.png new file mode 100644 index 0000000..ab59aaa Binary files /dev/null and b/sv-SE/images/flappy-pipes-ends.png differ diff --git a/sv-SE/images/flappy-pipes-fill-rectangle.png b/sv-SE/images/flappy-pipes-fill-rectangle.png new file mode 100644 index 0000000..7360b87 Binary files /dev/null and b/sv-SE/images/flappy-pipes-fill-rectangle.png differ diff --git a/sv-SE/images/flappy-pipes-filled.png b/sv-SE/images/flappy-pipes-filled.png new file mode 100644 index 0000000..7d2c0dd Binary files /dev/null and b/sv-SE/images/flappy-pipes-filled.png differ diff --git a/sv-SE/images/flappy-pipes-position.png b/sv-SE/images/flappy-pipes-position.png new file mode 100644 index 0000000..ca2b810 Binary files /dev/null and b/sv-SE/images/flappy-pipes-position.png differ diff --git a/sv-SE/images/flappy-pipes-rectangle.png b/sv-SE/images/flappy-pipes-rectangle.png new file mode 100644 index 0000000..6e3bf02 Binary files /dev/null and b/sv-SE/images/flappy-pipes-rectangle.png differ diff --git a/sv-SE/images/flappy-pipes-test.png b/sv-SE/images/flappy-pipes-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/sv-SE/images/flappy-pipes-test.png differ diff --git a/sv-SE/images/flappy-setup.png b/sv-SE/images/flappy-setup.png new file mode 100644 index 0000000..92f9eca Binary files /dev/null and b/sv-SE/images/flappy-setup.png differ diff --git a/sv-SE/images/flappy-sprite.png b/sv-SE/images/flappy-sprite.png new file mode 100644 index 0000000..6a0c590 Binary files /dev/null and b/sv-SE/images/flappy-sprite.png differ diff --git a/sv-SE/images/flappy-stage.png b/sv-SE/images/flappy-stage.png new file mode 100644 index 0000000..5efe03c Binary files /dev/null and b/sv-SE/images/flappy-stage.png differ diff --git a/sv-SE/images/flappy-starting-position.png b/sv-SE/images/flappy-starting-position.png new file mode 100644 index 0000000..9089c9e Binary files /dev/null and b/sv-SE/images/flappy-starting-position.png differ diff --git a/sv-SE/images/flappy-wings.png b/sv-SE/images/flappy-wings.png new file mode 100644 index 0000000..ef0aa8e Binary files /dev/null and b/sv-SE/images/flappy-wings.png differ diff --git a/sv-SE/images/pipes-sprite.png b/sv-SE/images/pipes-sprite.png new file mode 100644 index 0000000..a9882ed Binary files /dev/null and b/sv-SE/images/pipes-sprite.png differ diff --git a/sv-SE/meta.yml b/sv-SE/meta.yml new file mode 100644 index 0000000..c2fe5e6 --- /dev/null +++ b/sv-SE/meta.yml @@ -0,0 +1,34 @@ +--- +title: Flappy parrot +hero_image: images/banner.png +description: Create a game in which you guide a parrot past moving obstacles +listed: true +copyedit: true +version: 4.1 +last_tested: 2018-10-90 +steps: + - + title: Introduction + - + title: Add the pipes + - + title: "Challenge: make better pipes" + challenge: true + - + title: Make the pipes move + - + title: Make Flappy fall + - + title: Make Flappy fly + - + title: Detect collisions + - + title: Add a score + - + title: 'Challenge: adjust the difficulty' + challenge: true + - + title: 'Challenge: add a high score' + challenge: true + - + title: What next? diff --git a/sv-SE/scratch-translatable.txt b/sv-SE/scratch-translatable.txt new file mode 100644 index 0000000..214e66c --- /dev/null +++ b/sv-SE/scratch-translatable.txt @@ -0,0 +1,13 @@ +Pipes + +costume1 + +Flappy + +wings down + +wings up + +Game Over! + +score diff --git a/sv-SE/solutions/FlappyParrot-Solution.sb3 b/sv-SE/solutions/FlappyParrot-Solution.sb3 new file mode 100644 index 0000000..a0cd354 Binary files /dev/null and b/sv-SE/solutions/FlappyParrot-Solution.sb3 differ diff --git a/sv-SE/step_1.md b/sv-SE/step_1.md new file mode 100644 index 0000000..f7519ae --- /dev/null +++ b/sv-SE/step_1.md @@ -0,0 +1,69 @@ +\--- no-print \--- + +This is the **Scratch 3** version of the project. There is also a [Scratch 2 version of the project](https://projects.raspberrypi.org/en/projects/flappy-parrot-scratch2). + +\--- /no-print \--- + +## Introduction + +Create a game in which you have to guide a parrot past scrolling pipes to score points. + +### What you will make + +\--- no-print \--- + +Click the green flag to start the game. Press the space bar to make the parrot flap its wings, and try to get it to fly through the gaps in the pipes! You score one point for every pipe that you manage to get the parrot past. + +
+ + +
+ +\--- /no-print \--- + +\--- print-only \--- + +You will press the space bar to make the parrot flap its wings, and score one point for every pipe that you manage to get the parrot past. + +![flappy parrot game being played](images/flappy-parrot-showcase.png) + +\--- /print-only \--- + +## \--- collapse \--- + +## title: What you will need + +### Hardware + ++ A computer capable of running Scratch 3 + +### Software + ++ Scratch 3 (either [online](https://rpf.io/scratchon) or [offline](https://rpf.io/scratchoff)) + +\--- /collapse \--- + +## \--- collapse \--- + +## title: What you will learn + ++ How to create sprites using Vector mode ++ How to use sounds ++ How to detect collisions ++ How to control a sprite using the keyboard + +\--- /collapse \--- + +## \--- collapse \--- + +## title: Additional notes for educators + +\--- no-print \--- + +If you need to print this project, please use the [printer-friendly version](https://projects.raspberrypi.org/en/projects/flappy-parrot/print){:target="_blank"}. + +\--- /no-print \--- + +You can find the [completed project here](https://rpf.io/p/en/flappy-parrot-get). + +\--- /collapse \--- \ No newline at end of file diff --git a/sv-SE/step_10.md b/sv-SE/step_10.md new file mode 100644 index 0000000..a5808f3 --- /dev/null +++ b/sv-SE/step_10.md @@ -0,0 +1,9 @@ +## Challenge: add a high score + +\--- challenge \--- + +Can you add a high score to the game so that, in addition to keeping track of score for the current round, it keeps track of the highest score you've ever reached? + +[[[generic-scratch3-high-score]]] + +\--- /challenge \--- \ No newline at end of file diff --git a/sv-SE/step_11.md b/sv-SE/step_11.md new file mode 100644 index 0000000..02ae229 --- /dev/null +++ b/sv-SE/step_11.md @@ -0,0 +1,19 @@ +## What next? + +Try the [Binary hero](https://projects.raspberrypi.org/en/projects/binary-hero?utm_source=pathway&utm_medium=whatnext&utm_campaign=projects) project, where you will make a game in which you play the notes of a song as they scroll down the Stage. + +\--- no-print \--- + +Click the green flag to start the game. Use the z, x, c, and v keys to play the correct notes when these reach the bottom of the Stage. You'll score ten points for every correct note you play. + +
+ +
+ +\--- /no-print \--- + +\--- print-only \--- + +The notes will fall from above, and you will have to press keys to "catch" and play the notes. ![showcase](images/binary-showcase.png) + +\--- /print-only \--- \ No newline at end of file diff --git a/sv-SE/step_2.md b/sv-SE/step_2.md new file mode 100644 index 0000000..d8f2ce5 --- /dev/null +++ b/sv-SE/step_2.md @@ -0,0 +1,84 @@ +## Add the pipes + +First, create the pipes. + +\--- task \--- + +Open a new empty Scratch project. + +[[[generic-scratch3-new-project]]] + +\--- /task \--- + +\--- task \--- + +Add a backdrop with an outdoor landscape. 'Blue Sky' is a good choice. + +![screenshot](images/flappy-stage.png) + +[[[generic-scratch3-backdrop-from-library]]] + +\--- /task \--- + +\--- task \--- + +Create a new sprite and name it 'Pipes'. + +[[[generic-scratch3-draw-sprite]]] + +\--- /task \--- + +The 'Pipes' sprite should be a pair of pipes with a gap in the middle. By moving the sprite up or down, you can put the gap in a different place. + +This picture shows an example of how the pipes could be positioned. The parts of the sprite outside the Stage are normally hidden, you only see then when you drag the sprite: + +![screenshot](images/flappy-pipes-position.png) + +You can't draw a sprite as big as the pipes need to be, but you can increase the size at which the sprite shows on the Stage. + +\--- task \--- + +![pipes sprite](images/pipes-sprite.png) + +Add code to make the sprite bigger. + +```blocks3 +when green flag clicked +set size to (200) % +``` + +This makes it's easier to see how big the pipes should be. + +\--- /task \--- + +\--- task \--- + +Draw a rectangle for the top pipe as shown here: + +![rectangle for the pipe](images/flappy-pipes-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Fill the pipe with a colour you like. + +![fill the rectangle](images/flappy-pipes-fill-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Create a duplicate of the pipe by selecting it and then clicking on **Copy** and **Paste**. + +![copy and paste pipe](images/flappy-pipes-duplicate1-annotated.png) + +\--- /task \--- + +\--- task \--- + +Drag the copy of the pipe to the bottom of the screen so that the copy is in line with the other pipe. There needs to be a gap between the two pipes. + +![screenshot](images/flappy-pipes-duplicate2.png) + +\--- /task \--- \ No newline at end of file diff --git a/sv-SE/step_3.md b/sv-SE/step_3.md new file mode 100644 index 0000000..17f05f7 --- /dev/null +++ b/sv-SE/step_3.md @@ -0,0 +1,11 @@ +## Challenge: make better pipes + +Can you make your pipes look better? + ++ Shade your pipes with a left-to-right gradient. + +![screenshot](images/flappy-pipes-filled.png) + ++ Add extra rectangles to the ends of the pipes: + +![screenshot](images/flappy-pipes-ends.png) \ No newline at end of file diff --git a/sv-SE/step_4.md b/sv-SE/step_4.md new file mode 100644 index 0000000..2beedd9 --- /dev/null +++ b/sv-SE/step_4.md @@ -0,0 +1,65 @@ +## Make the pipes move + +Next you're going to make the pipes move across the screen to create an obstacle course. + +![pipes moving across the screen](images/flappy-clones-test.png) + +\--- task \--- + +First make the pipes appear by adding code to the Pipes sprite so that, `when the green flag is clicked`{:class="block3events"}, the sprite `forever`{:class="block3control"} `creates a clone of itself`{:class="block3control"} every two seconds. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +**Tip:** clones are just copies of a sprite, and they are really useful for creating games. + +\--- /task \--- + +\--- task \--- + +Next make the pipes move by adding code so that, `when a clone starts`{:class="block3control"}, the clone appears on the right side of the Stage and `glides`{:class="block3motion"} across to the left. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show +go to x: (240) y: (0) +glide (4) secs to x: (-240) y: (0) +delete this clone +``` + +**Tip:** you can stop the pipes scrolling by clicking the red **stop** button next to the green flag. + +\--- /task \--- + +Now you should have lots of pipes, but their gaps are always in the same place. + +You can add some variety by using a `random`{:class="block3operators"} number for the Pipes sprite's `y position`{:class="block3motion"}. + +![pipes at different heights](images/flappy-height-test.png) + +\--- task \--- + +Modify your sprite's code so that each sprite clone `picks a random number from -80 to 80`{:class="block3operators"} and `glides`{:class="block3motion"} to that `y position`{:class="block3motion"}: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show ++ go to x: (240) y: (pick random (-80) to (80)) ++ glide (4) secs to x: (-240) y: (y position) +delete this clone +``` + +\--- /task \--- \ No newline at end of file diff --git a/sv-SE/step_5.md b/sv-SE/step_5.md new file mode 100644 index 0000000..f9d79ce --- /dev/null +++ b/sv-SE/step_5.md @@ -0,0 +1,77 @@ +## Make Flappy fall + +Now add a sprite called Flappy and create code it so Flappy falls down the Stage. In the next step, you will add the code to make Flappy fly when you press a key. + +\--- no-print \--- + +![flappy falling animation](images/flappy-falling.gif) + +\--- /no-print \--- + +\--- task \--- + +Add a new sprite that has two costumes, for 'wings up' and 'wings down', and name it `Flappy`. + +The parrot sprite is a good choice. + +![parrot sprite](images/flappy-sprite.png) + +\--- /task \--- + +Flappy needs to be smaller. + +\--- task \--- + +Add code to `set Flappy's size to 25%`{:class="block3looks"} `when the green flag is clicked`{:class="block3events"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +``` + +\--- /task \--- + +When the game starts, Flappy needs to be just left of the centre of the Stage, at coordinates `-50, 0`. + +![flappy shown at the start position](images/flappy-starting-position.png) + +\--- task \--- + +Add code to make Flappy `go to the x and y`{:class="block3motion"} starting position of `x: -50`{:class="block3motion"} and `y: 0`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % ++ go to x: (-50) y: (0) +``` + +[[[generic-scratch3-set-coordinates]]] + +\--- /task \--- + +\--- task \--- + +Now make Flappy keep falling down the Stage by `forever`{:class="block3control"} `changing the sprite's y position by -3`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +go to x: (-50) y: (0) ++ forever + change y by (-3) +end +``` + +\--- /task \--- + +\--- task \--- + +Test your code to make sure Flappy starts in the middle of the screen and falls to the bottom. When you drag Flappy to the top of the Stage, the sprite should fall again. + +\--- /task \--- \ No newline at end of file diff --git a/sv-SE/step_6.md b/sv-SE/step_6.md new file mode 100644 index 0000000..1a98cb2 --- /dev/null +++ b/sv-SE/step_6.md @@ -0,0 +1,106 @@ +## Make Flappy fly + +Now you will make Flappy flap upwards when you press the space bar. When you play the game, you have to time your taps to get Flappy through the gaps in the pipes. + +\--- no-print \--- + +![flappy flying upwards when space bar is pressed](images/flappy-flying.gif) + +\--- /no-print \--- + +Make Flappy fly upwards when you tap the space bar. + +\--- task \--- + +When the `space key is pressed`{:class="block3events"}, Flappy should move upwards by `changing its y coordinate`{:class="block3motion"} by a small amount, for example `6`. + +Flappy flies upwards by `repeating`{:class="block3control"} this movement `10 times`{:class="block3control"}. + +Add this code to your `Flappy` sprite: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +repeat (10) + change y by (6) +end +``` + +\--- /task \--- + +Now you need to get Flappy's wings flapping! + +\--- task \--- + +Click on the **Costumes** tab, and name Flappy's costumes 'wings up' and 'wings down'. + +![naming the costumes](images/flappy-wings.png) + +\--- /task \--- + +\--- task \--- + +Can you make Flappy's costume change to `wings down` when you press space, and then change it back to `wings up` halfway through the upward movement? + +\--- hints \--- + +\--- hint \--- + +You need to split the upward motion in half so that you can use two `repeat`{:class="block3control"} blocks to change Flappy's costume at the beginning and in the middle of the movement. + +Add `switch costume to`{:class="block3looks"} blocks to change how Flappy looks. + +\--- /hint \--- \--- hint \--- + +You need to use these blocks: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +repeat (5) + change y by (6) +end + +repeat (5) + change y by (6) +end + +switch costume to (wings up v) + +switch costume to (wings down v) + +when [space v] key pressed +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +switch costume to (wings down v) +repeat (5) + change y by (6) +end +switch costume to (wings up v) +repeat (5) + change y by (6) +end +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code. As you see, at the moment nothing happens if you let Flappy hit a pipe. + +\--- /task \--- \ No newline at end of file diff --git a/sv-SE/step_7.md b/sv-SE/step_7.md new file mode 100644 index 0000000..40a2720 --- /dev/null +++ b/sv-SE/step_7.md @@ -0,0 +1,77 @@ +## Detect collisions + +To make the game a challenge, the player needs to guide Flappy through the gaps without letting the parrot touch the pipes or the edges of the Stage. You need to add some blocks to detect when Flappy hits something. + +This is called **collision detection**. + +\--- task \--- + +Import a sound from the library that you want to play when Flappy collides with something. The 'screech' sound is a good choice. + +[[[generic-scratch3-sound-from-library]]] + +\--- /task \--- + +A `wait until`{:class="block3control"} block is necessart to check whether Flappy is `touching the pipes`{:class="block3sensing"} `or`{:class="block3operators"} `touching the edge`{:class="block3sensing"}. + +\--- task \--- + +Add a new `when green flag clicked`{:class="block3control"} block to the 'Flappy' sprite, and also add the following code: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) +``` + +\--- /task \--- + +\--- task \--- + +Test your code. If Flappy touches a pipe, the 'screech' sound should play. + +\--- /task \--- + +Next, update the code so that the game stops when Flappy hits a pipe. + +\--- task \--- + +Add the following code to stop the game after a collision is detected: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) ++ say [Game Over!] ++ broadcast (Game Over v) ++ stop [other scripts in sprite v] +``` + +The `broadcast`{:class="block3events"} block tells other sprites that the game is over. + +The `stop`{:class="block3control"} block stops other Flappy scripts that are running so that Flappy stops falling after a collision. + +\--- /task \--- + +\--- task \--- + +Finally, add the following code to the `Pipes` sprite so that pipes `stop`{:class="block3control"} appearing `when the sprite receives Game Over`{:class="block3events"}. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I receive [Game Over v] +stop [other scripts in sprite v] +``` + +\--- /task \--- + +\--- task \--- + +Test your game and see how long you can play before it's 'Game over'! + +\--- /task \--- \ No newline at end of file diff --git a/sv-SE/step_8.md b/sv-SE/step_8.md new file mode 100644 index 0000000..2c5cc08 --- /dev/null +++ b/sv-SE/step_8.md @@ -0,0 +1,116 @@ +## Add a score + +The player should score a point every time Flappy makes it through a gap between pipes. + +\--- task \--- + +Make a new variable **for all sprites** and call it `score`{:class="block3variables"}. + +[[[generic-scratch3-add-variable]]] + +\--- /task \--- + +Each 'Pipes' sprite clone should `wait until`{:class="block3control"} Flappy has flown past and then increase the `score`{:class="block3variables"}. + +\--- task \--- + +First, `set score to 0`{:class="block3variables"} when the game begins: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked ++ set [score v] to [0] +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +\--- /task \--- + +\--- task \--- + +Then add the following code to the `Pipes` sprite: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> +``` + +\--- /task \--- + +\--- task \--- + +Add more code so that, when Flappy's `x` position is greater than the pipe clone's `x` position, the `score`{:class="block3variables"} increases by `1` and a sound of your choice plays. + +You could use the 'pop' sound if you want, or add a sound from the library, for example 'bird'. + +\--- hints \--- + +\--- hint \--- + +You need to `wait until`{:class="block3control"} `Flappy's x position`{:class="block3sensing"} is `greater than (>)`{:class="block3operators"} the `x position`{:class="block3motion"} of `Pipes`. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone ++ wait until <> +``` + +Then `change score by 1`{:class="block3variables"} and `play a sound`{:class="block3sound"}. + +\--- /hint \--- + +\--- hint \--- + +Use these blocks in the correct order: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> + +play sound (pop v) + +change [score v] by (1) + +[x position v] of (Flappy v) + +x position + +() > () +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <([x position v] of (Flappy v)) > (x position)> +change [score v] by (1) +play sound (pop v) +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code and make sure you score a point every time Flappy gets through a gap between pipes. Check whether the `score`{:class="block3variables"} is set to `0` when you start a new game. + +\--- /task \--- \ No newline at end of file diff --git a/sv-SE/step_9.md b/sv-SE/step_9.md new file mode 100644 index 0000000..2f4e2e6 --- /dev/null +++ b/sv-SE/step_9.md @@ -0,0 +1,5 @@ +## Challenge: adjust the difficulty + +Is the game too hard or too easy for you? How many ways can you find to change the difficulty? + +Adjust the game until you are happy with its difficulty! \ No newline at end of file diff --git a/tr-TR/images/banner.png b/tr-TR/images/banner.png new file mode 100644 index 0000000..7a0da5b Binary files /dev/null and b/tr-TR/images/banner.png differ diff --git a/tr-TR/images/binary-showcase.png b/tr-TR/images/binary-showcase.png new file mode 100644 index 0000000..499aa29 Binary files /dev/null and b/tr-TR/images/binary-showcase.png differ diff --git a/tr-TR/images/flappy-clones-test.png b/tr-TR/images/flappy-clones-test.png new file mode 100644 index 0000000..f874059 Binary files /dev/null and b/tr-TR/images/flappy-clones-test.png differ diff --git a/tr-TR/images/flappy-falling.gif b/tr-TR/images/flappy-falling.gif new file mode 100644 index 0000000..970d833 Binary files /dev/null and b/tr-TR/images/flappy-falling.gif differ diff --git a/tr-TR/images/flappy-flying.gif b/tr-TR/images/flappy-flying.gif new file mode 100644 index 0000000..e259ff1 Binary files /dev/null and b/tr-TR/images/flappy-flying.gif differ diff --git a/tr-TR/images/flappy-height-test.png b/tr-TR/images/flappy-height-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/tr-TR/images/flappy-height-test.png differ diff --git a/tr-TR/images/flappy-parrot-showcase.png b/tr-TR/images/flappy-parrot-showcase.png new file mode 100644 index 0000000..493049b Binary files /dev/null and b/tr-TR/images/flappy-parrot-showcase.png differ diff --git a/tr-TR/images/flappy-pipes-duplicate1-annotated.png b/tr-TR/images/flappy-pipes-duplicate1-annotated.png new file mode 100644 index 0000000..65e32c6 Binary files /dev/null and b/tr-TR/images/flappy-pipes-duplicate1-annotated.png differ diff --git a/tr-TR/images/flappy-pipes-duplicate1.png b/tr-TR/images/flappy-pipes-duplicate1.png new file mode 100644 index 0000000..4239b67 Binary files /dev/null and b/tr-TR/images/flappy-pipes-duplicate1.png differ diff --git a/tr-TR/images/flappy-pipes-duplicate2.png b/tr-TR/images/flappy-pipes-duplicate2.png new file mode 100644 index 0000000..ba1a69a Binary files /dev/null and b/tr-TR/images/flappy-pipes-duplicate2.png differ diff --git a/tr-TR/images/flappy-pipes-ends.png b/tr-TR/images/flappy-pipes-ends.png new file mode 100644 index 0000000..ab59aaa Binary files /dev/null and b/tr-TR/images/flappy-pipes-ends.png differ diff --git a/tr-TR/images/flappy-pipes-fill-rectangle.png b/tr-TR/images/flappy-pipes-fill-rectangle.png new file mode 100644 index 0000000..7360b87 Binary files /dev/null and b/tr-TR/images/flappy-pipes-fill-rectangle.png differ diff --git a/tr-TR/images/flappy-pipes-filled.png b/tr-TR/images/flappy-pipes-filled.png new file mode 100644 index 0000000..7d2c0dd Binary files /dev/null and b/tr-TR/images/flappy-pipes-filled.png differ diff --git a/tr-TR/images/flappy-pipes-position.png b/tr-TR/images/flappy-pipes-position.png new file mode 100644 index 0000000..ca2b810 Binary files /dev/null and b/tr-TR/images/flappy-pipes-position.png differ diff --git a/tr-TR/images/flappy-pipes-rectangle.png b/tr-TR/images/flappy-pipes-rectangle.png new file mode 100644 index 0000000..6e3bf02 Binary files /dev/null and b/tr-TR/images/flappy-pipes-rectangle.png differ diff --git a/tr-TR/images/flappy-pipes-test.png b/tr-TR/images/flappy-pipes-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/tr-TR/images/flappy-pipes-test.png differ diff --git a/tr-TR/images/flappy-setup.png b/tr-TR/images/flappy-setup.png new file mode 100644 index 0000000..92f9eca Binary files /dev/null and b/tr-TR/images/flappy-setup.png differ diff --git a/tr-TR/images/flappy-sprite.png b/tr-TR/images/flappy-sprite.png new file mode 100644 index 0000000..6a0c590 Binary files /dev/null and b/tr-TR/images/flappy-sprite.png differ diff --git a/tr-TR/images/flappy-stage.png b/tr-TR/images/flappy-stage.png new file mode 100644 index 0000000..5efe03c Binary files /dev/null and b/tr-TR/images/flappy-stage.png differ diff --git a/tr-TR/images/flappy-starting-position.png b/tr-TR/images/flappy-starting-position.png new file mode 100644 index 0000000..9089c9e Binary files /dev/null and b/tr-TR/images/flappy-starting-position.png differ diff --git a/tr-TR/images/flappy-wings.png b/tr-TR/images/flappy-wings.png new file mode 100644 index 0000000..ef0aa8e Binary files /dev/null and b/tr-TR/images/flappy-wings.png differ diff --git a/tr-TR/images/pipes-sprite.png b/tr-TR/images/pipes-sprite.png new file mode 100644 index 0000000..a9882ed Binary files /dev/null and b/tr-TR/images/pipes-sprite.png differ diff --git a/tr-TR/meta.yml b/tr-TR/meta.yml new file mode 100644 index 0000000..c2fe5e6 --- /dev/null +++ b/tr-TR/meta.yml @@ -0,0 +1,34 @@ +--- +title: Flappy parrot +hero_image: images/banner.png +description: Create a game in which you guide a parrot past moving obstacles +listed: true +copyedit: true +version: 4.1 +last_tested: 2018-10-90 +steps: + - + title: Introduction + - + title: Add the pipes + - + title: "Challenge: make better pipes" + challenge: true + - + title: Make the pipes move + - + title: Make Flappy fall + - + title: Make Flappy fly + - + title: Detect collisions + - + title: Add a score + - + title: 'Challenge: adjust the difficulty' + challenge: true + - + title: 'Challenge: add a high score' + challenge: true + - + title: What next? diff --git a/tr-TR/scratch-translatable.txt b/tr-TR/scratch-translatable.txt new file mode 100644 index 0000000..214e66c --- /dev/null +++ b/tr-TR/scratch-translatable.txt @@ -0,0 +1,13 @@ +Pipes + +costume1 + +Flappy + +wings down + +wings up + +Game Over! + +score diff --git a/tr-TR/solutions/FlappyParrot-Solution.sb3 b/tr-TR/solutions/FlappyParrot-Solution.sb3 new file mode 100644 index 0000000..a0cd354 Binary files /dev/null and b/tr-TR/solutions/FlappyParrot-Solution.sb3 differ diff --git a/tr-TR/step_1.md b/tr-TR/step_1.md new file mode 100644 index 0000000..f7519ae --- /dev/null +++ b/tr-TR/step_1.md @@ -0,0 +1,69 @@ +\--- no-print \--- + +This is the **Scratch 3** version of the project. There is also a [Scratch 2 version of the project](https://projects.raspberrypi.org/en/projects/flappy-parrot-scratch2). + +\--- /no-print \--- + +## Introduction + +Create a game in which you have to guide a parrot past scrolling pipes to score points. + +### What you will make + +\--- no-print \--- + +Click the green flag to start the game. Press the space bar to make the parrot flap its wings, and try to get it to fly through the gaps in the pipes! You score one point for every pipe that you manage to get the parrot past. + +
+ + +
+ +\--- /no-print \--- + +\--- print-only \--- + +You will press the space bar to make the parrot flap its wings, and score one point for every pipe that you manage to get the parrot past. + +![flappy parrot game being played](images/flappy-parrot-showcase.png) + +\--- /print-only \--- + +## \--- collapse \--- + +## title: What you will need + +### Hardware + ++ A computer capable of running Scratch 3 + +### Software + ++ Scratch 3 (either [online](https://rpf.io/scratchon) or [offline](https://rpf.io/scratchoff)) + +\--- /collapse \--- + +## \--- collapse \--- + +## title: What you will learn + ++ How to create sprites using Vector mode ++ How to use sounds ++ How to detect collisions ++ How to control a sprite using the keyboard + +\--- /collapse \--- + +## \--- collapse \--- + +## title: Additional notes for educators + +\--- no-print \--- + +If you need to print this project, please use the [printer-friendly version](https://projects.raspberrypi.org/en/projects/flappy-parrot/print){:target="_blank"}. + +\--- /no-print \--- + +You can find the [completed project here](https://rpf.io/p/en/flappy-parrot-get). + +\--- /collapse \--- \ No newline at end of file diff --git a/tr-TR/step_10.md b/tr-TR/step_10.md new file mode 100644 index 0000000..a5808f3 --- /dev/null +++ b/tr-TR/step_10.md @@ -0,0 +1,9 @@ +## Challenge: add a high score + +\--- challenge \--- + +Can you add a high score to the game so that, in addition to keeping track of score for the current round, it keeps track of the highest score you've ever reached? + +[[[generic-scratch3-high-score]]] + +\--- /challenge \--- \ No newline at end of file diff --git a/tr-TR/step_11.md b/tr-TR/step_11.md new file mode 100644 index 0000000..02ae229 --- /dev/null +++ b/tr-TR/step_11.md @@ -0,0 +1,19 @@ +## What next? + +Try the [Binary hero](https://projects.raspberrypi.org/en/projects/binary-hero?utm_source=pathway&utm_medium=whatnext&utm_campaign=projects) project, where you will make a game in which you play the notes of a song as they scroll down the Stage. + +\--- no-print \--- + +Click the green flag to start the game. Use the z, x, c, and v keys to play the correct notes when these reach the bottom of the Stage. You'll score ten points for every correct note you play. + +
+ +
+ +\--- /no-print \--- + +\--- print-only \--- + +The notes will fall from above, and you will have to press keys to "catch" and play the notes. ![showcase](images/binary-showcase.png) + +\--- /print-only \--- \ No newline at end of file diff --git a/tr-TR/step_2.md b/tr-TR/step_2.md new file mode 100644 index 0000000..d8f2ce5 --- /dev/null +++ b/tr-TR/step_2.md @@ -0,0 +1,84 @@ +## Add the pipes + +First, create the pipes. + +\--- task \--- + +Open a new empty Scratch project. + +[[[generic-scratch3-new-project]]] + +\--- /task \--- + +\--- task \--- + +Add a backdrop with an outdoor landscape. 'Blue Sky' is a good choice. + +![screenshot](images/flappy-stage.png) + +[[[generic-scratch3-backdrop-from-library]]] + +\--- /task \--- + +\--- task \--- + +Create a new sprite and name it 'Pipes'. + +[[[generic-scratch3-draw-sprite]]] + +\--- /task \--- + +The 'Pipes' sprite should be a pair of pipes with a gap in the middle. By moving the sprite up or down, you can put the gap in a different place. + +This picture shows an example of how the pipes could be positioned. The parts of the sprite outside the Stage are normally hidden, you only see then when you drag the sprite: + +![screenshot](images/flappy-pipes-position.png) + +You can't draw a sprite as big as the pipes need to be, but you can increase the size at which the sprite shows on the Stage. + +\--- task \--- + +![pipes sprite](images/pipes-sprite.png) + +Add code to make the sprite bigger. + +```blocks3 +when green flag clicked +set size to (200) % +``` + +This makes it's easier to see how big the pipes should be. + +\--- /task \--- + +\--- task \--- + +Draw a rectangle for the top pipe as shown here: + +![rectangle for the pipe](images/flappy-pipes-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Fill the pipe with a colour you like. + +![fill the rectangle](images/flappy-pipes-fill-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Create a duplicate of the pipe by selecting it and then clicking on **Copy** and **Paste**. + +![copy and paste pipe](images/flappy-pipes-duplicate1-annotated.png) + +\--- /task \--- + +\--- task \--- + +Drag the copy of the pipe to the bottom of the screen so that the copy is in line with the other pipe. There needs to be a gap between the two pipes. + +![screenshot](images/flappy-pipes-duplicate2.png) + +\--- /task \--- \ No newline at end of file diff --git a/tr-TR/step_3.md b/tr-TR/step_3.md new file mode 100644 index 0000000..17f05f7 --- /dev/null +++ b/tr-TR/step_3.md @@ -0,0 +1,11 @@ +## Challenge: make better pipes + +Can you make your pipes look better? + ++ Shade your pipes with a left-to-right gradient. + +![screenshot](images/flappy-pipes-filled.png) + ++ Add extra rectangles to the ends of the pipes: + +![screenshot](images/flappy-pipes-ends.png) \ No newline at end of file diff --git a/tr-TR/step_4.md b/tr-TR/step_4.md new file mode 100644 index 0000000..2beedd9 --- /dev/null +++ b/tr-TR/step_4.md @@ -0,0 +1,65 @@ +## Make the pipes move + +Next you're going to make the pipes move across the screen to create an obstacle course. + +![pipes moving across the screen](images/flappy-clones-test.png) + +\--- task \--- + +First make the pipes appear by adding code to the Pipes sprite so that, `when the green flag is clicked`{:class="block3events"}, the sprite `forever`{:class="block3control"} `creates a clone of itself`{:class="block3control"} every two seconds. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +**Tip:** clones are just copies of a sprite, and they are really useful for creating games. + +\--- /task \--- + +\--- task \--- + +Next make the pipes move by adding code so that, `when a clone starts`{:class="block3control"}, the clone appears on the right side of the Stage and `glides`{:class="block3motion"} across to the left. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show +go to x: (240) y: (0) +glide (4) secs to x: (-240) y: (0) +delete this clone +``` + +**Tip:** you can stop the pipes scrolling by clicking the red **stop** button next to the green flag. + +\--- /task \--- + +Now you should have lots of pipes, but their gaps are always in the same place. + +You can add some variety by using a `random`{:class="block3operators"} number for the Pipes sprite's `y position`{:class="block3motion"}. + +![pipes at different heights](images/flappy-height-test.png) + +\--- task \--- + +Modify your sprite's code so that each sprite clone `picks a random number from -80 to 80`{:class="block3operators"} and `glides`{:class="block3motion"} to that `y position`{:class="block3motion"}: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show ++ go to x: (240) y: (pick random (-80) to (80)) ++ glide (4) secs to x: (-240) y: (y position) +delete this clone +``` + +\--- /task \--- \ No newline at end of file diff --git a/tr-TR/step_5.md b/tr-TR/step_5.md new file mode 100644 index 0000000..f9d79ce --- /dev/null +++ b/tr-TR/step_5.md @@ -0,0 +1,77 @@ +## Make Flappy fall + +Now add a sprite called Flappy and create code it so Flappy falls down the Stage. In the next step, you will add the code to make Flappy fly when you press a key. + +\--- no-print \--- + +![flappy falling animation](images/flappy-falling.gif) + +\--- /no-print \--- + +\--- task \--- + +Add a new sprite that has two costumes, for 'wings up' and 'wings down', and name it `Flappy`. + +The parrot sprite is a good choice. + +![parrot sprite](images/flappy-sprite.png) + +\--- /task \--- + +Flappy needs to be smaller. + +\--- task \--- + +Add code to `set Flappy's size to 25%`{:class="block3looks"} `when the green flag is clicked`{:class="block3events"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +``` + +\--- /task \--- + +When the game starts, Flappy needs to be just left of the centre of the Stage, at coordinates `-50, 0`. + +![flappy shown at the start position](images/flappy-starting-position.png) + +\--- task \--- + +Add code to make Flappy `go to the x and y`{:class="block3motion"} starting position of `x: -50`{:class="block3motion"} and `y: 0`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % ++ go to x: (-50) y: (0) +``` + +[[[generic-scratch3-set-coordinates]]] + +\--- /task \--- + +\--- task \--- + +Now make Flappy keep falling down the Stage by `forever`{:class="block3control"} `changing the sprite's y position by -3`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +go to x: (-50) y: (0) ++ forever + change y by (-3) +end +``` + +\--- /task \--- + +\--- task \--- + +Test your code to make sure Flappy starts in the middle of the screen and falls to the bottom. When you drag Flappy to the top of the Stage, the sprite should fall again. + +\--- /task \--- \ No newline at end of file diff --git a/tr-TR/step_6.md b/tr-TR/step_6.md new file mode 100644 index 0000000..1a98cb2 --- /dev/null +++ b/tr-TR/step_6.md @@ -0,0 +1,106 @@ +## Make Flappy fly + +Now you will make Flappy flap upwards when you press the space bar. When you play the game, you have to time your taps to get Flappy through the gaps in the pipes. + +\--- no-print \--- + +![flappy flying upwards when space bar is pressed](images/flappy-flying.gif) + +\--- /no-print \--- + +Make Flappy fly upwards when you tap the space bar. + +\--- task \--- + +When the `space key is pressed`{:class="block3events"}, Flappy should move upwards by `changing its y coordinate`{:class="block3motion"} by a small amount, for example `6`. + +Flappy flies upwards by `repeating`{:class="block3control"} this movement `10 times`{:class="block3control"}. + +Add this code to your `Flappy` sprite: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +repeat (10) + change y by (6) +end +``` + +\--- /task \--- + +Now you need to get Flappy's wings flapping! + +\--- task \--- + +Click on the **Costumes** tab, and name Flappy's costumes 'wings up' and 'wings down'. + +![naming the costumes](images/flappy-wings.png) + +\--- /task \--- + +\--- task \--- + +Can you make Flappy's costume change to `wings down` when you press space, and then change it back to `wings up` halfway through the upward movement? + +\--- hints \--- + +\--- hint \--- + +You need to split the upward motion in half so that you can use two `repeat`{:class="block3control"} blocks to change Flappy's costume at the beginning and in the middle of the movement. + +Add `switch costume to`{:class="block3looks"} blocks to change how Flappy looks. + +\--- /hint \--- \--- hint \--- + +You need to use these blocks: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +repeat (5) + change y by (6) +end + +repeat (5) + change y by (6) +end + +switch costume to (wings up v) + +switch costume to (wings down v) + +when [space v] key pressed +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +switch costume to (wings down v) +repeat (5) + change y by (6) +end +switch costume to (wings up v) +repeat (5) + change y by (6) +end +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code. As you see, at the moment nothing happens if you let Flappy hit a pipe. + +\--- /task \--- \ No newline at end of file diff --git a/tr-TR/step_7.md b/tr-TR/step_7.md new file mode 100644 index 0000000..40a2720 --- /dev/null +++ b/tr-TR/step_7.md @@ -0,0 +1,77 @@ +## Detect collisions + +To make the game a challenge, the player needs to guide Flappy through the gaps without letting the parrot touch the pipes or the edges of the Stage. You need to add some blocks to detect when Flappy hits something. + +This is called **collision detection**. + +\--- task \--- + +Import a sound from the library that you want to play when Flappy collides with something. The 'screech' sound is a good choice. + +[[[generic-scratch3-sound-from-library]]] + +\--- /task \--- + +A `wait until`{:class="block3control"} block is necessart to check whether Flappy is `touching the pipes`{:class="block3sensing"} `or`{:class="block3operators"} `touching the edge`{:class="block3sensing"}. + +\--- task \--- + +Add a new `when green flag clicked`{:class="block3control"} block to the 'Flappy' sprite, and also add the following code: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) +``` + +\--- /task \--- + +\--- task \--- + +Test your code. If Flappy touches a pipe, the 'screech' sound should play. + +\--- /task \--- + +Next, update the code so that the game stops when Flappy hits a pipe. + +\--- task \--- + +Add the following code to stop the game after a collision is detected: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) ++ say [Game Over!] ++ broadcast (Game Over v) ++ stop [other scripts in sprite v] +``` + +The `broadcast`{:class="block3events"} block tells other sprites that the game is over. + +The `stop`{:class="block3control"} block stops other Flappy scripts that are running so that Flappy stops falling after a collision. + +\--- /task \--- + +\--- task \--- + +Finally, add the following code to the `Pipes` sprite so that pipes `stop`{:class="block3control"} appearing `when the sprite receives Game Over`{:class="block3events"}. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I receive [Game Over v] +stop [other scripts in sprite v] +``` + +\--- /task \--- + +\--- task \--- + +Test your game and see how long you can play before it's 'Game over'! + +\--- /task \--- \ No newline at end of file diff --git a/tr-TR/step_8.md b/tr-TR/step_8.md new file mode 100644 index 0000000..2c5cc08 --- /dev/null +++ b/tr-TR/step_8.md @@ -0,0 +1,116 @@ +## Add a score + +The player should score a point every time Flappy makes it through a gap between pipes. + +\--- task \--- + +Make a new variable **for all sprites** and call it `score`{:class="block3variables"}. + +[[[generic-scratch3-add-variable]]] + +\--- /task \--- + +Each 'Pipes' sprite clone should `wait until`{:class="block3control"} Flappy has flown past and then increase the `score`{:class="block3variables"}. + +\--- task \--- + +First, `set score to 0`{:class="block3variables"} when the game begins: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked ++ set [score v] to [0] +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +\--- /task \--- + +\--- task \--- + +Then add the following code to the `Pipes` sprite: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> +``` + +\--- /task \--- + +\--- task \--- + +Add more code so that, when Flappy's `x` position is greater than the pipe clone's `x` position, the `score`{:class="block3variables"} increases by `1` and a sound of your choice plays. + +You could use the 'pop' sound if you want, or add a sound from the library, for example 'bird'. + +\--- hints \--- + +\--- hint \--- + +You need to `wait until`{:class="block3control"} `Flappy's x position`{:class="block3sensing"} is `greater than (>)`{:class="block3operators"} the `x position`{:class="block3motion"} of `Pipes`. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone ++ wait until <> +``` + +Then `change score by 1`{:class="block3variables"} and `play a sound`{:class="block3sound"}. + +\--- /hint \--- + +\--- hint \--- + +Use these blocks in the correct order: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> + +play sound (pop v) + +change [score v] by (1) + +[x position v] of (Flappy v) + +x position + +() > () +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <([x position v] of (Flappy v)) > (x position)> +change [score v] by (1) +play sound (pop v) +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code and make sure you score a point every time Flappy gets through a gap between pipes. Check whether the `score`{:class="block3variables"} is set to `0` when you start a new game. + +\--- /task \--- \ No newline at end of file diff --git a/tr-TR/step_9.md b/tr-TR/step_9.md new file mode 100644 index 0000000..2f4e2e6 --- /dev/null +++ b/tr-TR/step_9.md @@ -0,0 +1,5 @@ +## Challenge: adjust the difficulty + +Is the game too hard or too easy for you? How many ways can you find to change the difficulty? + +Adjust the game until you are happy with its difficulty! \ No newline at end of file diff --git a/uk-UA/images/banner.png b/uk-UA/images/banner.png new file mode 100644 index 0000000..7a0da5b Binary files /dev/null and b/uk-UA/images/banner.png differ diff --git a/uk-UA/images/binary-showcase.png b/uk-UA/images/binary-showcase.png new file mode 100644 index 0000000..499aa29 Binary files /dev/null and b/uk-UA/images/binary-showcase.png differ diff --git a/uk-UA/images/flappy-clones-test.png b/uk-UA/images/flappy-clones-test.png new file mode 100644 index 0000000..f874059 Binary files /dev/null and b/uk-UA/images/flappy-clones-test.png differ diff --git a/uk-UA/images/flappy-falling.gif b/uk-UA/images/flappy-falling.gif new file mode 100644 index 0000000..970d833 Binary files /dev/null and b/uk-UA/images/flappy-falling.gif differ diff --git a/uk-UA/images/flappy-flying.gif b/uk-UA/images/flappy-flying.gif new file mode 100644 index 0000000..e259ff1 Binary files /dev/null and b/uk-UA/images/flappy-flying.gif differ diff --git a/uk-UA/images/flappy-height-test.png b/uk-UA/images/flappy-height-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/uk-UA/images/flappy-height-test.png differ diff --git a/uk-UA/images/flappy-parrot-showcase.png b/uk-UA/images/flappy-parrot-showcase.png new file mode 100644 index 0000000..493049b Binary files /dev/null and b/uk-UA/images/flappy-parrot-showcase.png differ diff --git a/uk-UA/images/flappy-pipes-duplicate1-annotated.png b/uk-UA/images/flappy-pipes-duplicate1-annotated.png new file mode 100644 index 0000000..65e32c6 Binary files /dev/null and b/uk-UA/images/flappy-pipes-duplicate1-annotated.png differ diff --git a/uk-UA/images/flappy-pipes-duplicate1.png b/uk-UA/images/flappy-pipes-duplicate1.png new file mode 100644 index 0000000..4239b67 Binary files /dev/null and b/uk-UA/images/flappy-pipes-duplicate1.png differ diff --git a/uk-UA/images/flappy-pipes-duplicate2.png b/uk-UA/images/flappy-pipes-duplicate2.png new file mode 100644 index 0000000..ba1a69a Binary files /dev/null and b/uk-UA/images/flappy-pipes-duplicate2.png differ diff --git a/uk-UA/images/flappy-pipes-ends.png b/uk-UA/images/flappy-pipes-ends.png new file mode 100644 index 0000000..ab59aaa Binary files /dev/null and b/uk-UA/images/flappy-pipes-ends.png differ diff --git a/uk-UA/images/flappy-pipes-fill-rectangle.png b/uk-UA/images/flappy-pipes-fill-rectangle.png new file mode 100644 index 0000000..7360b87 Binary files /dev/null and b/uk-UA/images/flappy-pipes-fill-rectangle.png differ diff --git a/uk-UA/images/flappy-pipes-filled.png b/uk-UA/images/flappy-pipes-filled.png new file mode 100644 index 0000000..7d2c0dd Binary files /dev/null and b/uk-UA/images/flappy-pipes-filled.png differ diff --git a/uk-UA/images/flappy-pipes-position.png b/uk-UA/images/flappy-pipes-position.png new file mode 100644 index 0000000..ca2b810 Binary files /dev/null and b/uk-UA/images/flappy-pipes-position.png differ diff --git a/uk-UA/images/flappy-pipes-rectangle.png b/uk-UA/images/flappy-pipes-rectangle.png new file mode 100644 index 0000000..6e3bf02 Binary files /dev/null and b/uk-UA/images/flappy-pipes-rectangle.png differ diff --git a/uk-UA/images/flappy-pipes-test.png b/uk-UA/images/flappy-pipes-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/uk-UA/images/flappy-pipes-test.png differ diff --git a/uk-UA/images/flappy-setup.png b/uk-UA/images/flappy-setup.png new file mode 100644 index 0000000..92f9eca Binary files /dev/null and b/uk-UA/images/flappy-setup.png differ diff --git a/uk-UA/images/flappy-sprite.png b/uk-UA/images/flappy-sprite.png new file mode 100644 index 0000000..6a0c590 Binary files /dev/null and b/uk-UA/images/flappy-sprite.png differ diff --git a/uk-UA/images/flappy-stage.png b/uk-UA/images/flappy-stage.png new file mode 100644 index 0000000..5efe03c Binary files /dev/null and b/uk-UA/images/flappy-stage.png differ diff --git a/uk-UA/images/flappy-starting-position.png b/uk-UA/images/flappy-starting-position.png new file mode 100644 index 0000000..9089c9e Binary files /dev/null and b/uk-UA/images/flappy-starting-position.png differ diff --git a/uk-UA/images/flappy-wings.png b/uk-UA/images/flappy-wings.png new file mode 100644 index 0000000..ef0aa8e Binary files /dev/null and b/uk-UA/images/flappy-wings.png differ diff --git a/uk-UA/images/pipes-sprite.png b/uk-UA/images/pipes-sprite.png new file mode 100644 index 0000000..a9882ed Binary files /dev/null and b/uk-UA/images/pipes-sprite.png differ diff --git a/uk-UA/meta.yml b/uk-UA/meta.yml new file mode 100644 index 0000000..c2fe5e6 --- /dev/null +++ b/uk-UA/meta.yml @@ -0,0 +1,34 @@ +--- +title: Flappy parrot +hero_image: images/banner.png +description: Create a game in which you guide a parrot past moving obstacles +listed: true +copyedit: true +version: 4.1 +last_tested: 2018-10-90 +steps: + - + title: Introduction + - + title: Add the pipes + - + title: "Challenge: make better pipes" + challenge: true + - + title: Make the pipes move + - + title: Make Flappy fall + - + title: Make Flappy fly + - + title: Detect collisions + - + title: Add a score + - + title: 'Challenge: adjust the difficulty' + challenge: true + - + title: 'Challenge: add a high score' + challenge: true + - + title: What next? diff --git a/uk-UA/scratch-translatable.txt b/uk-UA/scratch-translatable.txt new file mode 100644 index 0000000..214e66c --- /dev/null +++ b/uk-UA/scratch-translatable.txt @@ -0,0 +1,13 @@ +Pipes + +costume1 + +Flappy + +wings down + +wings up + +Game Over! + +score diff --git a/uk-UA/solutions/FlappyParrot-Solution.sb3 b/uk-UA/solutions/FlappyParrot-Solution.sb3 new file mode 100644 index 0000000..a0cd354 Binary files /dev/null and b/uk-UA/solutions/FlappyParrot-Solution.sb3 differ diff --git a/uk-UA/step_1.md b/uk-UA/step_1.md new file mode 100644 index 0000000..f7519ae --- /dev/null +++ b/uk-UA/step_1.md @@ -0,0 +1,69 @@ +\--- no-print \--- + +This is the **Scratch 3** version of the project. There is also a [Scratch 2 version of the project](https://projects.raspberrypi.org/en/projects/flappy-parrot-scratch2). + +\--- /no-print \--- + +## Introduction + +Create a game in which you have to guide a parrot past scrolling pipes to score points. + +### What you will make + +\--- no-print \--- + +Click the green flag to start the game. Press the space bar to make the parrot flap its wings, and try to get it to fly through the gaps in the pipes! You score one point for every pipe that you manage to get the parrot past. + +
+ + +
+ +\--- /no-print \--- + +\--- print-only \--- + +You will press the space bar to make the parrot flap its wings, and score one point for every pipe that you manage to get the parrot past. + +![flappy parrot game being played](images/flappy-parrot-showcase.png) + +\--- /print-only \--- + +## \--- collapse \--- + +## title: What you will need + +### Hardware + ++ A computer capable of running Scratch 3 + +### Software + ++ Scratch 3 (either [online](https://rpf.io/scratchon) or [offline](https://rpf.io/scratchoff)) + +\--- /collapse \--- + +## \--- collapse \--- + +## title: What you will learn + ++ How to create sprites using Vector mode ++ How to use sounds ++ How to detect collisions ++ How to control a sprite using the keyboard + +\--- /collapse \--- + +## \--- collapse \--- + +## title: Additional notes for educators + +\--- no-print \--- + +If you need to print this project, please use the [printer-friendly version](https://projects.raspberrypi.org/en/projects/flappy-parrot/print){:target="_blank"}. + +\--- /no-print \--- + +You can find the [completed project here](https://rpf.io/p/en/flappy-parrot-get). + +\--- /collapse \--- \ No newline at end of file diff --git a/uk-UA/step_10.md b/uk-UA/step_10.md new file mode 100644 index 0000000..a5808f3 --- /dev/null +++ b/uk-UA/step_10.md @@ -0,0 +1,9 @@ +## Challenge: add a high score + +\--- challenge \--- + +Can you add a high score to the game so that, in addition to keeping track of score for the current round, it keeps track of the highest score you've ever reached? + +[[[generic-scratch3-high-score]]] + +\--- /challenge \--- \ No newline at end of file diff --git a/uk-UA/step_11.md b/uk-UA/step_11.md new file mode 100644 index 0000000..02ae229 --- /dev/null +++ b/uk-UA/step_11.md @@ -0,0 +1,19 @@ +## What next? + +Try the [Binary hero](https://projects.raspberrypi.org/en/projects/binary-hero?utm_source=pathway&utm_medium=whatnext&utm_campaign=projects) project, where you will make a game in which you play the notes of a song as they scroll down the Stage. + +\--- no-print \--- + +Click the green flag to start the game. Use the z, x, c, and v keys to play the correct notes when these reach the bottom of the Stage. You'll score ten points for every correct note you play. + +
+ +
+ +\--- /no-print \--- + +\--- print-only \--- + +The notes will fall from above, and you will have to press keys to "catch" and play the notes. ![showcase](images/binary-showcase.png) + +\--- /print-only \--- \ No newline at end of file diff --git a/uk-UA/step_2.md b/uk-UA/step_2.md new file mode 100644 index 0000000..d8f2ce5 --- /dev/null +++ b/uk-UA/step_2.md @@ -0,0 +1,84 @@ +## Add the pipes + +First, create the pipes. + +\--- task \--- + +Open a new empty Scratch project. + +[[[generic-scratch3-new-project]]] + +\--- /task \--- + +\--- task \--- + +Add a backdrop with an outdoor landscape. 'Blue Sky' is a good choice. + +![screenshot](images/flappy-stage.png) + +[[[generic-scratch3-backdrop-from-library]]] + +\--- /task \--- + +\--- task \--- + +Create a new sprite and name it 'Pipes'. + +[[[generic-scratch3-draw-sprite]]] + +\--- /task \--- + +The 'Pipes' sprite should be a pair of pipes with a gap in the middle. By moving the sprite up or down, you can put the gap in a different place. + +This picture shows an example of how the pipes could be positioned. The parts of the sprite outside the Stage are normally hidden, you only see then when you drag the sprite: + +![screenshot](images/flappy-pipes-position.png) + +You can't draw a sprite as big as the pipes need to be, but you can increase the size at which the sprite shows on the Stage. + +\--- task \--- + +![pipes sprite](images/pipes-sprite.png) + +Add code to make the sprite bigger. + +```blocks3 +when green flag clicked +set size to (200) % +``` + +This makes it's easier to see how big the pipes should be. + +\--- /task \--- + +\--- task \--- + +Draw a rectangle for the top pipe as shown here: + +![rectangle for the pipe](images/flappy-pipes-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Fill the pipe with a colour you like. + +![fill the rectangle](images/flappy-pipes-fill-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Create a duplicate of the pipe by selecting it and then clicking on **Copy** and **Paste**. + +![copy and paste pipe](images/flappy-pipes-duplicate1-annotated.png) + +\--- /task \--- + +\--- task \--- + +Drag the copy of the pipe to the bottom of the screen so that the copy is in line with the other pipe. There needs to be a gap between the two pipes. + +![screenshot](images/flappy-pipes-duplicate2.png) + +\--- /task \--- \ No newline at end of file diff --git a/uk-UA/step_3.md b/uk-UA/step_3.md new file mode 100644 index 0000000..17f05f7 --- /dev/null +++ b/uk-UA/step_3.md @@ -0,0 +1,11 @@ +## Challenge: make better pipes + +Can you make your pipes look better? + ++ Shade your pipes with a left-to-right gradient. + +![screenshot](images/flappy-pipes-filled.png) + ++ Add extra rectangles to the ends of the pipes: + +![screenshot](images/flappy-pipes-ends.png) \ No newline at end of file diff --git a/uk-UA/step_4.md b/uk-UA/step_4.md new file mode 100644 index 0000000..2beedd9 --- /dev/null +++ b/uk-UA/step_4.md @@ -0,0 +1,65 @@ +## Make the pipes move + +Next you're going to make the pipes move across the screen to create an obstacle course. + +![pipes moving across the screen](images/flappy-clones-test.png) + +\--- task \--- + +First make the pipes appear by adding code to the Pipes sprite so that, `when the green flag is clicked`{:class="block3events"}, the sprite `forever`{:class="block3control"} `creates a clone of itself`{:class="block3control"} every two seconds. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +**Tip:** clones are just copies of a sprite, and they are really useful for creating games. + +\--- /task \--- + +\--- task \--- + +Next make the pipes move by adding code so that, `when a clone starts`{:class="block3control"}, the clone appears on the right side of the Stage and `glides`{:class="block3motion"} across to the left. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show +go to x: (240) y: (0) +glide (4) secs to x: (-240) y: (0) +delete this clone +``` + +**Tip:** you can stop the pipes scrolling by clicking the red **stop** button next to the green flag. + +\--- /task \--- + +Now you should have lots of pipes, but their gaps are always in the same place. + +You can add some variety by using a `random`{:class="block3operators"} number for the Pipes sprite's `y position`{:class="block3motion"}. + +![pipes at different heights](images/flappy-height-test.png) + +\--- task \--- + +Modify your sprite's code so that each sprite clone `picks a random number from -80 to 80`{:class="block3operators"} and `glides`{:class="block3motion"} to that `y position`{:class="block3motion"}: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show ++ go to x: (240) y: (pick random (-80) to (80)) ++ glide (4) secs to x: (-240) y: (y position) +delete this clone +``` + +\--- /task \--- \ No newline at end of file diff --git a/uk-UA/step_5.md b/uk-UA/step_5.md new file mode 100644 index 0000000..f9d79ce --- /dev/null +++ b/uk-UA/step_5.md @@ -0,0 +1,77 @@ +## Make Flappy fall + +Now add a sprite called Flappy and create code it so Flappy falls down the Stage. In the next step, you will add the code to make Flappy fly when you press a key. + +\--- no-print \--- + +![flappy falling animation](images/flappy-falling.gif) + +\--- /no-print \--- + +\--- task \--- + +Add a new sprite that has two costumes, for 'wings up' and 'wings down', and name it `Flappy`. + +The parrot sprite is a good choice. + +![parrot sprite](images/flappy-sprite.png) + +\--- /task \--- + +Flappy needs to be smaller. + +\--- task \--- + +Add code to `set Flappy's size to 25%`{:class="block3looks"} `when the green flag is clicked`{:class="block3events"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +``` + +\--- /task \--- + +When the game starts, Flappy needs to be just left of the centre of the Stage, at coordinates `-50, 0`. + +![flappy shown at the start position](images/flappy-starting-position.png) + +\--- task \--- + +Add code to make Flappy `go to the x and y`{:class="block3motion"} starting position of `x: -50`{:class="block3motion"} and `y: 0`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % ++ go to x: (-50) y: (0) +``` + +[[[generic-scratch3-set-coordinates]]] + +\--- /task \--- + +\--- task \--- + +Now make Flappy keep falling down the Stage by `forever`{:class="block3control"} `changing the sprite's y position by -3`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +go to x: (-50) y: (0) ++ forever + change y by (-3) +end +``` + +\--- /task \--- + +\--- task \--- + +Test your code to make sure Flappy starts in the middle of the screen and falls to the bottom. When you drag Flappy to the top of the Stage, the sprite should fall again. + +\--- /task \--- \ No newline at end of file diff --git a/uk-UA/step_6.md b/uk-UA/step_6.md new file mode 100644 index 0000000..1a98cb2 --- /dev/null +++ b/uk-UA/step_6.md @@ -0,0 +1,106 @@ +## Make Flappy fly + +Now you will make Flappy flap upwards when you press the space bar. When you play the game, you have to time your taps to get Flappy through the gaps in the pipes. + +\--- no-print \--- + +![flappy flying upwards when space bar is pressed](images/flappy-flying.gif) + +\--- /no-print \--- + +Make Flappy fly upwards when you tap the space bar. + +\--- task \--- + +When the `space key is pressed`{:class="block3events"}, Flappy should move upwards by `changing its y coordinate`{:class="block3motion"} by a small amount, for example `6`. + +Flappy flies upwards by `repeating`{:class="block3control"} this movement `10 times`{:class="block3control"}. + +Add this code to your `Flappy` sprite: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +repeat (10) + change y by (6) +end +``` + +\--- /task \--- + +Now you need to get Flappy's wings flapping! + +\--- task \--- + +Click on the **Costumes** tab, and name Flappy's costumes 'wings up' and 'wings down'. + +![naming the costumes](images/flappy-wings.png) + +\--- /task \--- + +\--- task \--- + +Can you make Flappy's costume change to `wings down` when you press space, and then change it back to `wings up` halfway through the upward movement? + +\--- hints \--- + +\--- hint \--- + +You need to split the upward motion in half so that you can use two `repeat`{:class="block3control"} blocks to change Flappy's costume at the beginning and in the middle of the movement. + +Add `switch costume to`{:class="block3looks"} blocks to change how Flappy looks. + +\--- /hint \--- \--- hint \--- + +You need to use these blocks: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +repeat (5) + change y by (6) +end + +repeat (5) + change y by (6) +end + +switch costume to (wings up v) + +switch costume to (wings down v) + +when [space v] key pressed +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +switch costume to (wings down v) +repeat (5) + change y by (6) +end +switch costume to (wings up v) +repeat (5) + change y by (6) +end +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code. As you see, at the moment nothing happens if you let Flappy hit a pipe. + +\--- /task \--- \ No newline at end of file diff --git a/uk-UA/step_7.md b/uk-UA/step_7.md new file mode 100644 index 0000000..40a2720 --- /dev/null +++ b/uk-UA/step_7.md @@ -0,0 +1,77 @@ +## Detect collisions + +To make the game a challenge, the player needs to guide Flappy through the gaps without letting the parrot touch the pipes or the edges of the Stage. You need to add some blocks to detect when Flappy hits something. + +This is called **collision detection**. + +\--- task \--- + +Import a sound from the library that you want to play when Flappy collides with something. The 'screech' sound is a good choice. + +[[[generic-scratch3-sound-from-library]]] + +\--- /task \--- + +A `wait until`{:class="block3control"} block is necessart to check whether Flappy is `touching the pipes`{:class="block3sensing"} `or`{:class="block3operators"} `touching the edge`{:class="block3sensing"}. + +\--- task \--- + +Add a new `when green flag clicked`{:class="block3control"} block to the 'Flappy' sprite, and also add the following code: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) +``` + +\--- /task \--- + +\--- task \--- + +Test your code. If Flappy touches a pipe, the 'screech' sound should play. + +\--- /task \--- + +Next, update the code so that the game stops when Flappy hits a pipe. + +\--- task \--- + +Add the following code to stop the game after a collision is detected: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) ++ say [Game Over!] ++ broadcast (Game Over v) ++ stop [other scripts in sprite v] +``` + +The `broadcast`{:class="block3events"} block tells other sprites that the game is over. + +The `stop`{:class="block3control"} block stops other Flappy scripts that are running so that Flappy stops falling after a collision. + +\--- /task \--- + +\--- task \--- + +Finally, add the following code to the `Pipes` sprite so that pipes `stop`{:class="block3control"} appearing `when the sprite receives Game Over`{:class="block3events"}. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I receive [Game Over v] +stop [other scripts in sprite v] +``` + +\--- /task \--- + +\--- task \--- + +Test your game and see how long you can play before it's 'Game over'! + +\--- /task \--- \ No newline at end of file diff --git a/uk-UA/step_8.md b/uk-UA/step_8.md new file mode 100644 index 0000000..2c5cc08 --- /dev/null +++ b/uk-UA/step_8.md @@ -0,0 +1,116 @@ +## Add a score + +The player should score a point every time Flappy makes it through a gap between pipes. + +\--- task \--- + +Make a new variable **for all sprites** and call it `score`{:class="block3variables"}. + +[[[generic-scratch3-add-variable]]] + +\--- /task \--- + +Each 'Pipes' sprite clone should `wait until`{:class="block3control"} Flappy has flown past and then increase the `score`{:class="block3variables"}. + +\--- task \--- + +First, `set score to 0`{:class="block3variables"} when the game begins: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked ++ set [score v] to [0] +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +\--- /task \--- + +\--- task \--- + +Then add the following code to the `Pipes` sprite: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> +``` + +\--- /task \--- + +\--- task \--- + +Add more code so that, when Flappy's `x` position is greater than the pipe clone's `x` position, the `score`{:class="block3variables"} increases by `1` and a sound of your choice plays. + +You could use the 'pop' sound if you want, or add a sound from the library, for example 'bird'. + +\--- hints \--- + +\--- hint \--- + +You need to `wait until`{:class="block3control"} `Flappy's x position`{:class="block3sensing"} is `greater than (>)`{:class="block3operators"} the `x position`{:class="block3motion"} of `Pipes`. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone ++ wait until <> +``` + +Then `change score by 1`{:class="block3variables"} and `play a sound`{:class="block3sound"}. + +\--- /hint \--- + +\--- hint \--- + +Use these blocks in the correct order: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> + +play sound (pop v) + +change [score v] by (1) + +[x position v] of (Flappy v) + +x position + +() > () +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <([x position v] of (Flappy v)) > (x position)> +change [score v] by (1) +play sound (pop v) +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code and make sure you score a point every time Flappy gets through a gap between pipes. Check whether the `score`{:class="block3variables"} is set to `0` when you start a new game. + +\--- /task \--- \ No newline at end of file diff --git a/uk-UA/step_9.md b/uk-UA/step_9.md new file mode 100644 index 0000000..2f4e2e6 --- /dev/null +++ b/uk-UA/step_9.md @@ -0,0 +1,5 @@ +## Challenge: adjust the difficulty + +Is the game too hard or too easy for you? How many ways can you find to change the difficulty? + +Adjust the game until you are happy with its difficulty! \ No newline at end of file diff --git a/vi-VN/images/banner.png b/vi-VN/images/banner.png new file mode 100644 index 0000000..7a0da5b Binary files /dev/null and b/vi-VN/images/banner.png differ diff --git a/vi-VN/images/binary-showcase.png b/vi-VN/images/binary-showcase.png new file mode 100644 index 0000000..499aa29 Binary files /dev/null and b/vi-VN/images/binary-showcase.png differ diff --git a/vi-VN/images/flappy-clones-test.png b/vi-VN/images/flappy-clones-test.png new file mode 100644 index 0000000..f874059 Binary files /dev/null and b/vi-VN/images/flappy-clones-test.png differ diff --git a/vi-VN/images/flappy-falling.gif b/vi-VN/images/flappy-falling.gif new file mode 100644 index 0000000..970d833 Binary files /dev/null and b/vi-VN/images/flappy-falling.gif differ diff --git a/vi-VN/images/flappy-flying.gif b/vi-VN/images/flappy-flying.gif new file mode 100644 index 0000000..e259ff1 Binary files /dev/null and b/vi-VN/images/flappy-flying.gif differ diff --git a/vi-VN/images/flappy-height-test.png b/vi-VN/images/flappy-height-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/vi-VN/images/flappy-height-test.png differ diff --git a/vi-VN/images/flappy-parrot-showcase.png b/vi-VN/images/flappy-parrot-showcase.png new file mode 100644 index 0000000..493049b Binary files /dev/null and b/vi-VN/images/flappy-parrot-showcase.png differ diff --git a/vi-VN/images/flappy-pipes-duplicate1-annotated.png b/vi-VN/images/flappy-pipes-duplicate1-annotated.png new file mode 100644 index 0000000..65e32c6 Binary files /dev/null and b/vi-VN/images/flappy-pipes-duplicate1-annotated.png differ diff --git a/vi-VN/images/flappy-pipes-duplicate1.png b/vi-VN/images/flappy-pipes-duplicate1.png new file mode 100644 index 0000000..4239b67 Binary files /dev/null and b/vi-VN/images/flappy-pipes-duplicate1.png differ diff --git a/vi-VN/images/flappy-pipes-duplicate2.png b/vi-VN/images/flappy-pipes-duplicate2.png new file mode 100644 index 0000000..ba1a69a Binary files /dev/null and b/vi-VN/images/flappy-pipes-duplicate2.png differ diff --git a/vi-VN/images/flappy-pipes-ends.png b/vi-VN/images/flappy-pipes-ends.png new file mode 100644 index 0000000..ab59aaa Binary files /dev/null and b/vi-VN/images/flappy-pipes-ends.png differ diff --git a/vi-VN/images/flappy-pipes-fill-rectangle.png b/vi-VN/images/flappy-pipes-fill-rectangle.png new file mode 100644 index 0000000..7360b87 Binary files /dev/null and b/vi-VN/images/flappy-pipes-fill-rectangle.png differ diff --git a/vi-VN/images/flappy-pipes-filled.png b/vi-VN/images/flappy-pipes-filled.png new file mode 100644 index 0000000..7d2c0dd Binary files /dev/null and b/vi-VN/images/flappy-pipes-filled.png differ diff --git a/vi-VN/images/flappy-pipes-position.png b/vi-VN/images/flappy-pipes-position.png new file mode 100644 index 0000000..ca2b810 Binary files /dev/null and b/vi-VN/images/flappy-pipes-position.png differ diff --git a/vi-VN/images/flappy-pipes-rectangle.png b/vi-VN/images/flappy-pipes-rectangle.png new file mode 100644 index 0000000..6e3bf02 Binary files /dev/null and b/vi-VN/images/flappy-pipes-rectangle.png differ diff --git a/vi-VN/images/flappy-pipes-test.png b/vi-VN/images/flappy-pipes-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/vi-VN/images/flappy-pipes-test.png differ diff --git a/vi-VN/images/flappy-setup.png b/vi-VN/images/flappy-setup.png new file mode 100644 index 0000000..92f9eca Binary files /dev/null and b/vi-VN/images/flappy-setup.png differ diff --git a/vi-VN/images/flappy-sprite.png b/vi-VN/images/flappy-sprite.png new file mode 100644 index 0000000..6a0c590 Binary files /dev/null and b/vi-VN/images/flappy-sprite.png differ diff --git a/vi-VN/images/flappy-stage.png b/vi-VN/images/flappy-stage.png new file mode 100644 index 0000000..5efe03c Binary files /dev/null and b/vi-VN/images/flappy-stage.png differ diff --git a/vi-VN/images/flappy-starting-position.png b/vi-VN/images/flappy-starting-position.png new file mode 100644 index 0000000..9089c9e Binary files /dev/null and b/vi-VN/images/flappy-starting-position.png differ diff --git a/vi-VN/images/flappy-wings.png b/vi-VN/images/flappy-wings.png new file mode 100644 index 0000000..ef0aa8e Binary files /dev/null and b/vi-VN/images/flappy-wings.png differ diff --git a/vi-VN/images/pipes-sprite.png b/vi-VN/images/pipes-sprite.png new file mode 100644 index 0000000..a9882ed Binary files /dev/null and b/vi-VN/images/pipes-sprite.png differ diff --git a/vi-VN/meta.yml b/vi-VN/meta.yml new file mode 100644 index 0000000..c2fe5e6 --- /dev/null +++ b/vi-VN/meta.yml @@ -0,0 +1,34 @@ +--- +title: Flappy parrot +hero_image: images/banner.png +description: Create a game in which you guide a parrot past moving obstacles +listed: true +copyedit: true +version: 4.1 +last_tested: 2018-10-90 +steps: + - + title: Introduction + - + title: Add the pipes + - + title: "Challenge: make better pipes" + challenge: true + - + title: Make the pipes move + - + title: Make Flappy fall + - + title: Make Flappy fly + - + title: Detect collisions + - + title: Add a score + - + title: 'Challenge: adjust the difficulty' + challenge: true + - + title: 'Challenge: add a high score' + challenge: true + - + title: What next? diff --git a/vi-VN/scratch-translatable.txt b/vi-VN/scratch-translatable.txt new file mode 100644 index 0000000..214e66c --- /dev/null +++ b/vi-VN/scratch-translatable.txt @@ -0,0 +1,13 @@ +Pipes + +costume1 + +Flappy + +wings down + +wings up + +Game Over! + +score diff --git a/vi-VN/solutions/FlappyParrot-Solution.sb3 b/vi-VN/solutions/FlappyParrot-Solution.sb3 new file mode 100644 index 0000000..a0cd354 Binary files /dev/null and b/vi-VN/solutions/FlappyParrot-Solution.sb3 differ diff --git a/vi-VN/step_1.md b/vi-VN/step_1.md new file mode 100644 index 0000000..f7519ae --- /dev/null +++ b/vi-VN/step_1.md @@ -0,0 +1,69 @@ +\--- no-print \--- + +This is the **Scratch 3** version of the project. There is also a [Scratch 2 version of the project](https://projects.raspberrypi.org/en/projects/flappy-parrot-scratch2). + +\--- /no-print \--- + +## Introduction + +Create a game in which you have to guide a parrot past scrolling pipes to score points. + +### What you will make + +\--- no-print \--- + +Click the green flag to start the game. Press the space bar to make the parrot flap its wings, and try to get it to fly through the gaps in the pipes! You score one point for every pipe that you manage to get the parrot past. + +
+ + +
+ +\--- /no-print \--- + +\--- print-only \--- + +You will press the space bar to make the parrot flap its wings, and score one point for every pipe that you manage to get the parrot past. + +![flappy parrot game being played](images/flappy-parrot-showcase.png) + +\--- /print-only \--- + +## \--- collapse \--- + +## title: What you will need + +### Hardware + ++ A computer capable of running Scratch 3 + +### Software + ++ Scratch 3 (either [online](https://rpf.io/scratchon) or [offline](https://rpf.io/scratchoff)) + +\--- /collapse \--- + +## \--- collapse \--- + +## title: What you will learn + ++ How to create sprites using Vector mode ++ How to use sounds ++ How to detect collisions ++ How to control a sprite using the keyboard + +\--- /collapse \--- + +## \--- collapse \--- + +## title: Additional notes for educators + +\--- no-print \--- + +If you need to print this project, please use the [printer-friendly version](https://projects.raspberrypi.org/en/projects/flappy-parrot/print){:target="_blank"}. + +\--- /no-print \--- + +You can find the [completed project here](https://rpf.io/p/en/flappy-parrot-get). + +\--- /collapse \--- \ No newline at end of file diff --git a/vi-VN/step_10.md b/vi-VN/step_10.md new file mode 100644 index 0000000..a5808f3 --- /dev/null +++ b/vi-VN/step_10.md @@ -0,0 +1,9 @@ +## Challenge: add a high score + +\--- challenge \--- + +Can you add a high score to the game so that, in addition to keeping track of score for the current round, it keeps track of the highest score you've ever reached? + +[[[generic-scratch3-high-score]]] + +\--- /challenge \--- \ No newline at end of file diff --git a/vi-VN/step_11.md b/vi-VN/step_11.md new file mode 100644 index 0000000..02ae229 --- /dev/null +++ b/vi-VN/step_11.md @@ -0,0 +1,19 @@ +## What next? + +Try the [Binary hero](https://projects.raspberrypi.org/en/projects/binary-hero?utm_source=pathway&utm_medium=whatnext&utm_campaign=projects) project, where you will make a game in which you play the notes of a song as they scroll down the Stage. + +\--- no-print \--- + +Click the green flag to start the game. Use the z, x, c, and v keys to play the correct notes when these reach the bottom of the Stage. You'll score ten points for every correct note you play. + +
+ +
+ +\--- /no-print \--- + +\--- print-only \--- + +The notes will fall from above, and you will have to press keys to "catch" and play the notes. ![showcase](images/binary-showcase.png) + +\--- /print-only \--- \ No newline at end of file diff --git a/vi-VN/step_2.md b/vi-VN/step_2.md new file mode 100644 index 0000000..d8f2ce5 --- /dev/null +++ b/vi-VN/step_2.md @@ -0,0 +1,84 @@ +## Add the pipes + +First, create the pipes. + +\--- task \--- + +Open a new empty Scratch project. + +[[[generic-scratch3-new-project]]] + +\--- /task \--- + +\--- task \--- + +Add a backdrop with an outdoor landscape. 'Blue Sky' is a good choice. + +![screenshot](images/flappy-stage.png) + +[[[generic-scratch3-backdrop-from-library]]] + +\--- /task \--- + +\--- task \--- + +Create a new sprite and name it 'Pipes'. + +[[[generic-scratch3-draw-sprite]]] + +\--- /task \--- + +The 'Pipes' sprite should be a pair of pipes with a gap in the middle. By moving the sprite up or down, you can put the gap in a different place. + +This picture shows an example of how the pipes could be positioned. The parts of the sprite outside the Stage are normally hidden, you only see then when you drag the sprite: + +![screenshot](images/flappy-pipes-position.png) + +You can't draw a sprite as big as the pipes need to be, but you can increase the size at which the sprite shows on the Stage. + +\--- task \--- + +![pipes sprite](images/pipes-sprite.png) + +Add code to make the sprite bigger. + +```blocks3 +when green flag clicked +set size to (200) % +``` + +This makes it's easier to see how big the pipes should be. + +\--- /task \--- + +\--- task \--- + +Draw a rectangle for the top pipe as shown here: + +![rectangle for the pipe](images/flappy-pipes-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Fill the pipe with a colour you like. + +![fill the rectangle](images/flappy-pipes-fill-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Create a duplicate of the pipe by selecting it and then clicking on **Copy** and **Paste**. + +![copy and paste pipe](images/flappy-pipes-duplicate1-annotated.png) + +\--- /task \--- + +\--- task \--- + +Drag the copy of the pipe to the bottom of the screen so that the copy is in line with the other pipe. There needs to be a gap between the two pipes. + +![screenshot](images/flappy-pipes-duplicate2.png) + +\--- /task \--- \ No newline at end of file diff --git a/vi-VN/step_3.md b/vi-VN/step_3.md new file mode 100644 index 0000000..17f05f7 --- /dev/null +++ b/vi-VN/step_3.md @@ -0,0 +1,11 @@ +## Challenge: make better pipes + +Can you make your pipes look better? + ++ Shade your pipes with a left-to-right gradient. + +![screenshot](images/flappy-pipes-filled.png) + ++ Add extra rectangles to the ends of the pipes: + +![screenshot](images/flappy-pipes-ends.png) \ No newline at end of file diff --git a/vi-VN/step_4.md b/vi-VN/step_4.md new file mode 100644 index 0000000..2beedd9 --- /dev/null +++ b/vi-VN/step_4.md @@ -0,0 +1,65 @@ +## Make the pipes move + +Next you're going to make the pipes move across the screen to create an obstacle course. + +![pipes moving across the screen](images/flappy-clones-test.png) + +\--- task \--- + +First make the pipes appear by adding code to the Pipes sprite so that, `when the green flag is clicked`{:class="block3events"}, the sprite `forever`{:class="block3control"} `creates a clone of itself`{:class="block3control"} every two seconds. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +**Tip:** clones are just copies of a sprite, and they are really useful for creating games. + +\--- /task \--- + +\--- task \--- + +Next make the pipes move by adding code so that, `when a clone starts`{:class="block3control"}, the clone appears on the right side of the Stage and `glides`{:class="block3motion"} across to the left. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show +go to x: (240) y: (0) +glide (4) secs to x: (-240) y: (0) +delete this clone +``` + +**Tip:** you can stop the pipes scrolling by clicking the red **stop** button next to the green flag. + +\--- /task \--- + +Now you should have lots of pipes, but their gaps are always in the same place. + +You can add some variety by using a `random`{:class="block3operators"} number for the Pipes sprite's `y position`{:class="block3motion"}. + +![pipes at different heights](images/flappy-height-test.png) + +\--- task \--- + +Modify your sprite's code so that each sprite clone `picks a random number from -80 to 80`{:class="block3operators"} and `glides`{:class="block3motion"} to that `y position`{:class="block3motion"}: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show ++ go to x: (240) y: (pick random (-80) to (80)) ++ glide (4) secs to x: (-240) y: (y position) +delete this clone +``` + +\--- /task \--- \ No newline at end of file diff --git a/vi-VN/step_5.md b/vi-VN/step_5.md new file mode 100644 index 0000000..f9d79ce --- /dev/null +++ b/vi-VN/step_5.md @@ -0,0 +1,77 @@ +## Make Flappy fall + +Now add a sprite called Flappy and create code it so Flappy falls down the Stage. In the next step, you will add the code to make Flappy fly when you press a key. + +\--- no-print \--- + +![flappy falling animation](images/flappy-falling.gif) + +\--- /no-print \--- + +\--- task \--- + +Add a new sprite that has two costumes, for 'wings up' and 'wings down', and name it `Flappy`. + +The parrot sprite is a good choice. + +![parrot sprite](images/flappy-sprite.png) + +\--- /task \--- + +Flappy needs to be smaller. + +\--- task \--- + +Add code to `set Flappy's size to 25%`{:class="block3looks"} `when the green flag is clicked`{:class="block3events"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +``` + +\--- /task \--- + +When the game starts, Flappy needs to be just left of the centre of the Stage, at coordinates `-50, 0`. + +![flappy shown at the start position](images/flappy-starting-position.png) + +\--- task \--- + +Add code to make Flappy `go to the x and y`{:class="block3motion"} starting position of `x: -50`{:class="block3motion"} and `y: 0`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % ++ go to x: (-50) y: (0) +``` + +[[[generic-scratch3-set-coordinates]]] + +\--- /task \--- + +\--- task \--- + +Now make Flappy keep falling down the Stage by `forever`{:class="block3control"} `changing the sprite's y position by -3`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +go to x: (-50) y: (0) ++ forever + change y by (-3) +end +``` + +\--- /task \--- + +\--- task \--- + +Test your code to make sure Flappy starts in the middle of the screen and falls to the bottom. When you drag Flappy to the top of the Stage, the sprite should fall again. + +\--- /task \--- \ No newline at end of file diff --git a/vi-VN/step_6.md b/vi-VN/step_6.md new file mode 100644 index 0000000..1a98cb2 --- /dev/null +++ b/vi-VN/step_6.md @@ -0,0 +1,106 @@ +## Make Flappy fly + +Now you will make Flappy flap upwards when you press the space bar. When you play the game, you have to time your taps to get Flappy through the gaps in the pipes. + +\--- no-print \--- + +![flappy flying upwards when space bar is pressed](images/flappy-flying.gif) + +\--- /no-print \--- + +Make Flappy fly upwards when you tap the space bar. + +\--- task \--- + +When the `space key is pressed`{:class="block3events"}, Flappy should move upwards by `changing its y coordinate`{:class="block3motion"} by a small amount, for example `6`. + +Flappy flies upwards by `repeating`{:class="block3control"} this movement `10 times`{:class="block3control"}. + +Add this code to your `Flappy` sprite: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +repeat (10) + change y by (6) +end +``` + +\--- /task \--- + +Now you need to get Flappy's wings flapping! + +\--- task \--- + +Click on the **Costumes** tab, and name Flappy's costumes 'wings up' and 'wings down'. + +![naming the costumes](images/flappy-wings.png) + +\--- /task \--- + +\--- task \--- + +Can you make Flappy's costume change to `wings down` when you press space, and then change it back to `wings up` halfway through the upward movement? + +\--- hints \--- + +\--- hint \--- + +You need to split the upward motion in half so that you can use two `repeat`{:class="block3control"} blocks to change Flappy's costume at the beginning and in the middle of the movement. + +Add `switch costume to`{:class="block3looks"} blocks to change how Flappy looks. + +\--- /hint \--- \--- hint \--- + +You need to use these blocks: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +repeat (5) + change y by (6) +end + +repeat (5) + change y by (6) +end + +switch costume to (wings up v) + +switch costume to (wings down v) + +when [space v] key pressed +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +switch costume to (wings down v) +repeat (5) + change y by (6) +end +switch costume to (wings up v) +repeat (5) + change y by (6) +end +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code. As you see, at the moment nothing happens if you let Flappy hit a pipe. + +\--- /task \--- \ No newline at end of file diff --git a/vi-VN/step_7.md b/vi-VN/step_7.md new file mode 100644 index 0000000..40a2720 --- /dev/null +++ b/vi-VN/step_7.md @@ -0,0 +1,77 @@ +## Detect collisions + +To make the game a challenge, the player needs to guide Flappy through the gaps without letting the parrot touch the pipes or the edges of the Stage. You need to add some blocks to detect when Flappy hits something. + +This is called **collision detection**. + +\--- task \--- + +Import a sound from the library that you want to play when Flappy collides with something. The 'screech' sound is a good choice. + +[[[generic-scratch3-sound-from-library]]] + +\--- /task \--- + +A `wait until`{:class="block3control"} block is necessart to check whether Flappy is `touching the pipes`{:class="block3sensing"} `or`{:class="block3operators"} `touching the edge`{:class="block3sensing"}. + +\--- task \--- + +Add a new `when green flag clicked`{:class="block3control"} block to the 'Flappy' sprite, and also add the following code: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) +``` + +\--- /task \--- + +\--- task \--- + +Test your code. If Flappy touches a pipe, the 'screech' sound should play. + +\--- /task \--- + +Next, update the code so that the game stops when Flappy hits a pipe. + +\--- task \--- + +Add the following code to stop the game after a collision is detected: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) ++ say [Game Over!] ++ broadcast (Game Over v) ++ stop [other scripts in sprite v] +``` + +The `broadcast`{:class="block3events"} block tells other sprites that the game is over. + +The `stop`{:class="block3control"} block stops other Flappy scripts that are running so that Flappy stops falling after a collision. + +\--- /task \--- + +\--- task \--- + +Finally, add the following code to the `Pipes` sprite so that pipes `stop`{:class="block3control"} appearing `when the sprite receives Game Over`{:class="block3events"}. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I receive [Game Over v] +stop [other scripts in sprite v] +``` + +\--- /task \--- + +\--- task \--- + +Test your game and see how long you can play before it's 'Game over'! + +\--- /task \--- \ No newline at end of file diff --git a/vi-VN/step_8.md b/vi-VN/step_8.md new file mode 100644 index 0000000..2c5cc08 --- /dev/null +++ b/vi-VN/step_8.md @@ -0,0 +1,116 @@ +## Add a score + +The player should score a point every time Flappy makes it through a gap between pipes. + +\--- task \--- + +Make a new variable **for all sprites** and call it `score`{:class="block3variables"}. + +[[[generic-scratch3-add-variable]]] + +\--- /task \--- + +Each 'Pipes' sprite clone should `wait until`{:class="block3control"} Flappy has flown past and then increase the `score`{:class="block3variables"}. + +\--- task \--- + +First, `set score to 0`{:class="block3variables"} when the game begins: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked ++ set [score v] to [0] +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +\--- /task \--- + +\--- task \--- + +Then add the following code to the `Pipes` sprite: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> +``` + +\--- /task \--- + +\--- task \--- + +Add more code so that, when Flappy's `x` position is greater than the pipe clone's `x` position, the `score`{:class="block3variables"} increases by `1` and a sound of your choice plays. + +You could use the 'pop' sound if you want, or add a sound from the library, for example 'bird'. + +\--- hints \--- + +\--- hint \--- + +You need to `wait until`{:class="block3control"} `Flappy's x position`{:class="block3sensing"} is `greater than (>)`{:class="block3operators"} the `x position`{:class="block3motion"} of `Pipes`. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone ++ wait until <> +``` + +Then `change score by 1`{:class="block3variables"} and `play a sound`{:class="block3sound"}. + +\--- /hint \--- + +\--- hint \--- + +Use these blocks in the correct order: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> + +play sound (pop v) + +change [score v] by (1) + +[x position v] of (Flappy v) + +x position + +() > () +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <([x position v] of (Flappy v)) > (x position)> +change [score v] by (1) +play sound (pop v) +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code and make sure you score a point every time Flappy gets through a gap between pipes. Check whether the `score`{:class="block3variables"} is set to `0` when you start a new game. + +\--- /task \--- \ No newline at end of file diff --git a/vi-VN/step_9.md b/vi-VN/step_9.md new file mode 100644 index 0000000..2f4e2e6 --- /dev/null +++ b/vi-VN/step_9.md @@ -0,0 +1,5 @@ +## Challenge: adjust the difficulty + +Is the game too hard or too easy for you? How many ways can you find to change the difficulty? + +Adjust the game until you are happy with its difficulty! \ No newline at end of file diff --git a/zh-CN/images/banner.png b/zh-CN/images/banner.png new file mode 100644 index 0000000..7a0da5b Binary files /dev/null and b/zh-CN/images/banner.png differ diff --git a/zh-CN/images/binary-showcase.png b/zh-CN/images/binary-showcase.png new file mode 100644 index 0000000..499aa29 Binary files /dev/null and b/zh-CN/images/binary-showcase.png differ diff --git a/zh-CN/images/flappy-clones-test.png b/zh-CN/images/flappy-clones-test.png new file mode 100644 index 0000000..f874059 Binary files /dev/null and b/zh-CN/images/flappy-clones-test.png differ diff --git a/zh-CN/images/flappy-falling.gif b/zh-CN/images/flappy-falling.gif new file mode 100644 index 0000000..970d833 Binary files /dev/null and b/zh-CN/images/flappy-falling.gif differ diff --git a/zh-CN/images/flappy-flying.gif b/zh-CN/images/flappy-flying.gif new file mode 100644 index 0000000..e259ff1 Binary files /dev/null and b/zh-CN/images/flappy-flying.gif differ diff --git a/zh-CN/images/flappy-height-test.png b/zh-CN/images/flappy-height-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/zh-CN/images/flappy-height-test.png differ diff --git a/zh-CN/images/flappy-parrot-showcase.png b/zh-CN/images/flappy-parrot-showcase.png new file mode 100644 index 0000000..493049b Binary files /dev/null and b/zh-CN/images/flappy-parrot-showcase.png differ diff --git a/zh-CN/images/flappy-pipes-duplicate1-annotated.png b/zh-CN/images/flappy-pipes-duplicate1-annotated.png new file mode 100644 index 0000000..65e32c6 Binary files /dev/null and b/zh-CN/images/flappy-pipes-duplicate1-annotated.png differ diff --git a/zh-CN/images/flappy-pipes-duplicate1.png b/zh-CN/images/flappy-pipes-duplicate1.png new file mode 100644 index 0000000..4239b67 Binary files /dev/null and b/zh-CN/images/flappy-pipes-duplicate1.png differ diff --git a/zh-CN/images/flappy-pipes-duplicate2.png b/zh-CN/images/flappy-pipes-duplicate2.png new file mode 100644 index 0000000..ba1a69a Binary files /dev/null and b/zh-CN/images/flappy-pipes-duplicate2.png differ diff --git a/zh-CN/images/flappy-pipes-ends.png b/zh-CN/images/flappy-pipes-ends.png new file mode 100644 index 0000000..ab59aaa Binary files /dev/null and b/zh-CN/images/flappy-pipes-ends.png differ diff --git a/zh-CN/images/flappy-pipes-fill-rectangle.png b/zh-CN/images/flappy-pipes-fill-rectangle.png new file mode 100644 index 0000000..7360b87 Binary files /dev/null and b/zh-CN/images/flappy-pipes-fill-rectangle.png differ diff --git a/zh-CN/images/flappy-pipes-filled.png b/zh-CN/images/flappy-pipes-filled.png new file mode 100644 index 0000000..7d2c0dd Binary files /dev/null and b/zh-CN/images/flappy-pipes-filled.png differ diff --git a/zh-CN/images/flappy-pipes-position.png b/zh-CN/images/flappy-pipes-position.png new file mode 100644 index 0000000..ca2b810 Binary files /dev/null and b/zh-CN/images/flappy-pipes-position.png differ diff --git a/zh-CN/images/flappy-pipes-rectangle.png b/zh-CN/images/flappy-pipes-rectangle.png new file mode 100644 index 0000000..6e3bf02 Binary files /dev/null and b/zh-CN/images/flappy-pipes-rectangle.png differ diff --git a/zh-CN/images/flappy-pipes-test.png b/zh-CN/images/flappy-pipes-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/zh-CN/images/flappy-pipes-test.png differ diff --git a/zh-CN/images/flappy-setup.png b/zh-CN/images/flappy-setup.png new file mode 100644 index 0000000..92f9eca Binary files /dev/null and b/zh-CN/images/flappy-setup.png differ diff --git a/zh-CN/images/flappy-sprite.png b/zh-CN/images/flappy-sprite.png new file mode 100644 index 0000000..6a0c590 Binary files /dev/null and b/zh-CN/images/flappy-sprite.png differ diff --git a/zh-CN/images/flappy-stage.png b/zh-CN/images/flappy-stage.png new file mode 100644 index 0000000..5efe03c Binary files /dev/null and b/zh-CN/images/flappy-stage.png differ diff --git a/zh-CN/images/flappy-starting-position.png b/zh-CN/images/flappy-starting-position.png new file mode 100644 index 0000000..9089c9e Binary files /dev/null and b/zh-CN/images/flappy-starting-position.png differ diff --git a/zh-CN/images/flappy-wings.png b/zh-CN/images/flappy-wings.png new file mode 100644 index 0000000..ef0aa8e Binary files /dev/null and b/zh-CN/images/flappy-wings.png differ diff --git a/zh-CN/images/pipes-sprite.png b/zh-CN/images/pipes-sprite.png new file mode 100644 index 0000000..a9882ed Binary files /dev/null and b/zh-CN/images/pipes-sprite.png differ diff --git a/zh-CN/meta.yml b/zh-CN/meta.yml new file mode 100644 index 0000000..c2fe5e6 --- /dev/null +++ b/zh-CN/meta.yml @@ -0,0 +1,34 @@ +--- +title: Flappy parrot +hero_image: images/banner.png +description: Create a game in which you guide a parrot past moving obstacles +listed: true +copyedit: true +version: 4.1 +last_tested: 2018-10-90 +steps: + - + title: Introduction + - + title: Add the pipes + - + title: "Challenge: make better pipes" + challenge: true + - + title: Make the pipes move + - + title: Make Flappy fall + - + title: Make Flappy fly + - + title: Detect collisions + - + title: Add a score + - + title: 'Challenge: adjust the difficulty' + challenge: true + - + title: 'Challenge: add a high score' + challenge: true + - + title: What next? diff --git a/zh-CN/scratch-translatable.txt b/zh-CN/scratch-translatable.txt new file mode 100644 index 0000000..214e66c --- /dev/null +++ b/zh-CN/scratch-translatable.txt @@ -0,0 +1,13 @@ +Pipes + +costume1 + +Flappy + +wings down + +wings up + +Game Over! + +score diff --git a/zh-CN/solutions/FlappyParrot-Solution.sb3 b/zh-CN/solutions/FlappyParrot-Solution.sb3 new file mode 100644 index 0000000..a0cd354 Binary files /dev/null and b/zh-CN/solutions/FlappyParrot-Solution.sb3 differ diff --git a/zh-CN/step_1.md b/zh-CN/step_1.md new file mode 100644 index 0000000..f7519ae --- /dev/null +++ b/zh-CN/step_1.md @@ -0,0 +1,69 @@ +\--- no-print \--- + +This is the **Scratch 3** version of the project. There is also a [Scratch 2 version of the project](https://projects.raspberrypi.org/en/projects/flappy-parrot-scratch2). + +\--- /no-print \--- + +## Introduction + +Create a game in which you have to guide a parrot past scrolling pipes to score points. + +### What you will make + +\--- no-print \--- + +Click the green flag to start the game. Press the space bar to make the parrot flap its wings, and try to get it to fly through the gaps in the pipes! You score one point for every pipe that you manage to get the parrot past. + +
+ + +
+ +\--- /no-print \--- + +\--- print-only \--- + +You will press the space bar to make the parrot flap its wings, and score one point for every pipe that you manage to get the parrot past. + +![flappy parrot game being played](images/flappy-parrot-showcase.png) + +\--- /print-only \--- + +## \--- collapse \--- + +## title: What you will need + +### Hardware + ++ A computer capable of running Scratch 3 + +### Software + ++ Scratch 3 (either [online](https://rpf.io/scratchon) or [offline](https://rpf.io/scratchoff)) + +\--- /collapse \--- + +## \--- collapse \--- + +## title: What you will learn + ++ How to create sprites using Vector mode ++ How to use sounds ++ How to detect collisions ++ How to control a sprite using the keyboard + +\--- /collapse \--- + +## \--- collapse \--- + +## title: Additional notes for educators + +\--- no-print \--- + +If you need to print this project, please use the [printer-friendly version](https://projects.raspberrypi.org/en/projects/flappy-parrot/print){:target="_blank"}. + +\--- /no-print \--- + +You can find the [completed project here](https://rpf.io/p/en/flappy-parrot-get). + +\--- /collapse \--- \ No newline at end of file diff --git a/zh-CN/step_10.md b/zh-CN/step_10.md new file mode 100644 index 0000000..a5808f3 --- /dev/null +++ b/zh-CN/step_10.md @@ -0,0 +1,9 @@ +## Challenge: add a high score + +\--- challenge \--- + +Can you add a high score to the game so that, in addition to keeping track of score for the current round, it keeps track of the highest score you've ever reached? + +[[[generic-scratch3-high-score]]] + +\--- /challenge \--- \ No newline at end of file diff --git a/zh-CN/step_11.md b/zh-CN/step_11.md new file mode 100644 index 0000000..02ae229 --- /dev/null +++ b/zh-CN/step_11.md @@ -0,0 +1,19 @@ +## What next? + +Try the [Binary hero](https://projects.raspberrypi.org/en/projects/binary-hero?utm_source=pathway&utm_medium=whatnext&utm_campaign=projects) project, where you will make a game in which you play the notes of a song as they scroll down the Stage. + +\--- no-print \--- + +Click the green flag to start the game. Use the z, x, c, and v keys to play the correct notes when these reach the bottom of the Stage. You'll score ten points for every correct note you play. + +
+ +
+ +\--- /no-print \--- + +\--- print-only \--- + +The notes will fall from above, and you will have to press keys to "catch" and play the notes. ![showcase](images/binary-showcase.png) + +\--- /print-only \--- \ No newline at end of file diff --git a/zh-CN/step_2.md b/zh-CN/step_2.md new file mode 100644 index 0000000..d8f2ce5 --- /dev/null +++ b/zh-CN/step_2.md @@ -0,0 +1,84 @@ +## Add the pipes + +First, create the pipes. + +\--- task \--- + +Open a new empty Scratch project. + +[[[generic-scratch3-new-project]]] + +\--- /task \--- + +\--- task \--- + +Add a backdrop with an outdoor landscape. 'Blue Sky' is a good choice. + +![screenshot](images/flappy-stage.png) + +[[[generic-scratch3-backdrop-from-library]]] + +\--- /task \--- + +\--- task \--- + +Create a new sprite and name it 'Pipes'. + +[[[generic-scratch3-draw-sprite]]] + +\--- /task \--- + +The 'Pipes' sprite should be a pair of pipes with a gap in the middle. By moving the sprite up or down, you can put the gap in a different place. + +This picture shows an example of how the pipes could be positioned. The parts of the sprite outside the Stage are normally hidden, you only see then when you drag the sprite: + +![screenshot](images/flappy-pipes-position.png) + +You can't draw a sprite as big as the pipes need to be, but you can increase the size at which the sprite shows on the Stage. + +\--- task \--- + +![pipes sprite](images/pipes-sprite.png) + +Add code to make the sprite bigger. + +```blocks3 +when green flag clicked +set size to (200) % +``` + +This makes it's easier to see how big the pipes should be. + +\--- /task \--- + +\--- task \--- + +Draw a rectangle for the top pipe as shown here: + +![rectangle for the pipe](images/flappy-pipes-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Fill the pipe with a colour you like. + +![fill the rectangle](images/flappy-pipes-fill-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Create a duplicate of the pipe by selecting it and then clicking on **Copy** and **Paste**. + +![copy and paste pipe](images/flappy-pipes-duplicate1-annotated.png) + +\--- /task \--- + +\--- task \--- + +Drag the copy of the pipe to the bottom of the screen so that the copy is in line with the other pipe. There needs to be a gap between the two pipes. + +![screenshot](images/flappy-pipes-duplicate2.png) + +\--- /task \--- \ No newline at end of file diff --git a/zh-CN/step_3.md b/zh-CN/step_3.md new file mode 100644 index 0000000..17f05f7 --- /dev/null +++ b/zh-CN/step_3.md @@ -0,0 +1,11 @@ +## Challenge: make better pipes + +Can you make your pipes look better? + ++ Shade your pipes with a left-to-right gradient. + +![screenshot](images/flappy-pipes-filled.png) + ++ Add extra rectangles to the ends of the pipes: + +![screenshot](images/flappy-pipes-ends.png) \ No newline at end of file diff --git a/zh-CN/step_4.md b/zh-CN/step_4.md new file mode 100644 index 0000000..2beedd9 --- /dev/null +++ b/zh-CN/step_4.md @@ -0,0 +1,65 @@ +## Make the pipes move + +Next you're going to make the pipes move across the screen to create an obstacle course. + +![pipes moving across the screen](images/flappy-clones-test.png) + +\--- task \--- + +First make the pipes appear by adding code to the Pipes sprite so that, `when the green flag is clicked`{:class="block3events"}, the sprite `forever`{:class="block3control"} `creates a clone of itself`{:class="block3control"} every two seconds. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +**Tip:** clones are just copies of a sprite, and they are really useful for creating games. + +\--- /task \--- + +\--- task \--- + +Next make the pipes move by adding code so that, `when a clone starts`{:class="block3control"}, the clone appears on the right side of the Stage and `glides`{:class="block3motion"} across to the left. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show +go to x: (240) y: (0) +glide (4) secs to x: (-240) y: (0) +delete this clone +``` + +**Tip:** you can stop the pipes scrolling by clicking the red **stop** button next to the green flag. + +\--- /task \--- + +Now you should have lots of pipes, but their gaps are always in the same place. + +You can add some variety by using a `random`{:class="block3operators"} number for the Pipes sprite's `y position`{:class="block3motion"}. + +![pipes at different heights](images/flappy-height-test.png) + +\--- task \--- + +Modify your sprite's code so that each sprite clone `picks a random number from -80 to 80`{:class="block3operators"} and `glides`{:class="block3motion"} to that `y position`{:class="block3motion"}: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show ++ go to x: (240) y: (pick random (-80) to (80)) ++ glide (4) secs to x: (-240) y: (y position) +delete this clone +``` + +\--- /task \--- \ No newline at end of file diff --git a/zh-CN/step_5.md b/zh-CN/step_5.md new file mode 100644 index 0000000..f9d79ce --- /dev/null +++ b/zh-CN/step_5.md @@ -0,0 +1,77 @@ +## Make Flappy fall + +Now add a sprite called Flappy and create code it so Flappy falls down the Stage. In the next step, you will add the code to make Flappy fly when you press a key. + +\--- no-print \--- + +![flappy falling animation](images/flappy-falling.gif) + +\--- /no-print \--- + +\--- task \--- + +Add a new sprite that has two costumes, for 'wings up' and 'wings down', and name it `Flappy`. + +The parrot sprite is a good choice. + +![parrot sprite](images/flappy-sprite.png) + +\--- /task \--- + +Flappy needs to be smaller. + +\--- task \--- + +Add code to `set Flappy's size to 25%`{:class="block3looks"} `when the green flag is clicked`{:class="block3events"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +``` + +\--- /task \--- + +When the game starts, Flappy needs to be just left of the centre of the Stage, at coordinates `-50, 0`. + +![flappy shown at the start position](images/flappy-starting-position.png) + +\--- task \--- + +Add code to make Flappy `go to the x and y`{:class="block3motion"} starting position of `x: -50`{:class="block3motion"} and `y: 0`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % ++ go to x: (-50) y: (0) +``` + +[[[generic-scratch3-set-coordinates]]] + +\--- /task \--- + +\--- task \--- + +Now make Flappy keep falling down the Stage by `forever`{:class="block3control"} `changing the sprite's y position by -3`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +go to x: (-50) y: (0) ++ forever + change y by (-3) +end +``` + +\--- /task \--- + +\--- task \--- + +Test your code to make sure Flappy starts in the middle of the screen and falls to the bottom. When you drag Flappy to the top of the Stage, the sprite should fall again. + +\--- /task \--- \ No newline at end of file diff --git a/zh-CN/step_6.md b/zh-CN/step_6.md new file mode 100644 index 0000000..1a98cb2 --- /dev/null +++ b/zh-CN/step_6.md @@ -0,0 +1,106 @@ +## Make Flappy fly + +Now you will make Flappy flap upwards when you press the space bar. When you play the game, you have to time your taps to get Flappy through the gaps in the pipes. + +\--- no-print \--- + +![flappy flying upwards when space bar is pressed](images/flappy-flying.gif) + +\--- /no-print \--- + +Make Flappy fly upwards when you tap the space bar. + +\--- task \--- + +When the `space key is pressed`{:class="block3events"}, Flappy should move upwards by `changing its y coordinate`{:class="block3motion"} by a small amount, for example `6`. + +Flappy flies upwards by `repeating`{:class="block3control"} this movement `10 times`{:class="block3control"}. + +Add this code to your `Flappy` sprite: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +repeat (10) + change y by (6) +end +``` + +\--- /task \--- + +Now you need to get Flappy's wings flapping! + +\--- task \--- + +Click on the **Costumes** tab, and name Flappy's costumes 'wings up' and 'wings down'. + +![naming the costumes](images/flappy-wings.png) + +\--- /task \--- + +\--- task \--- + +Can you make Flappy's costume change to `wings down` when you press space, and then change it back to `wings up` halfway through the upward movement? + +\--- hints \--- + +\--- hint \--- + +You need to split the upward motion in half so that you can use two `repeat`{:class="block3control"} blocks to change Flappy's costume at the beginning and in the middle of the movement. + +Add `switch costume to`{:class="block3looks"} blocks to change how Flappy looks. + +\--- /hint \--- \--- hint \--- + +You need to use these blocks: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +repeat (5) + change y by (6) +end + +repeat (5) + change y by (6) +end + +switch costume to (wings up v) + +switch costume to (wings down v) + +when [space v] key pressed +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +switch costume to (wings down v) +repeat (5) + change y by (6) +end +switch costume to (wings up v) +repeat (5) + change y by (6) +end +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code. As you see, at the moment nothing happens if you let Flappy hit a pipe. + +\--- /task \--- \ No newline at end of file diff --git a/zh-CN/step_7.md b/zh-CN/step_7.md new file mode 100644 index 0000000..40a2720 --- /dev/null +++ b/zh-CN/step_7.md @@ -0,0 +1,77 @@ +## Detect collisions + +To make the game a challenge, the player needs to guide Flappy through the gaps without letting the parrot touch the pipes or the edges of the Stage. You need to add some blocks to detect when Flappy hits something. + +This is called **collision detection**. + +\--- task \--- + +Import a sound from the library that you want to play when Flappy collides with something. The 'screech' sound is a good choice. + +[[[generic-scratch3-sound-from-library]]] + +\--- /task \--- + +A `wait until`{:class="block3control"} block is necessart to check whether Flappy is `touching the pipes`{:class="block3sensing"} `or`{:class="block3operators"} `touching the edge`{:class="block3sensing"}. + +\--- task \--- + +Add a new `when green flag clicked`{:class="block3control"} block to the 'Flappy' sprite, and also add the following code: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) +``` + +\--- /task \--- + +\--- task \--- + +Test your code. If Flappy touches a pipe, the 'screech' sound should play. + +\--- /task \--- + +Next, update the code so that the game stops when Flappy hits a pipe. + +\--- task \--- + +Add the following code to stop the game after a collision is detected: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) ++ say [Game Over!] ++ broadcast (Game Over v) ++ stop [other scripts in sprite v] +``` + +The `broadcast`{:class="block3events"} block tells other sprites that the game is over. + +The `stop`{:class="block3control"} block stops other Flappy scripts that are running so that Flappy stops falling after a collision. + +\--- /task \--- + +\--- task \--- + +Finally, add the following code to the `Pipes` sprite so that pipes `stop`{:class="block3control"} appearing `when the sprite receives Game Over`{:class="block3events"}. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I receive [Game Over v] +stop [other scripts in sprite v] +``` + +\--- /task \--- + +\--- task \--- + +Test your game and see how long you can play before it's 'Game over'! + +\--- /task \--- \ No newline at end of file diff --git a/zh-CN/step_8.md b/zh-CN/step_8.md new file mode 100644 index 0000000..2c5cc08 --- /dev/null +++ b/zh-CN/step_8.md @@ -0,0 +1,116 @@ +## Add a score + +The player should score a point every time Flappy makes it through a gap between pipes. + +\--- task \--- + +Make a new variable **for all sprites** and call it `score`{:class="block3variables"}. + +[[[generic-scratch3-add-variable]]] + +\--- /task \--- + +Each 'Pipes' sprite clone should `wait until`{:class="block3control"} Flappy has flown past and then increase the `score`{:class="block3variables"}. + +\--- task \--- + +First, `set score to 0`{:class="block3variables"} when the game begins: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked ++ set [score v] to [0] +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +\--- /task \--- + +\--- task \--- + +Then add the following code to the `Pipes` sprite: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> +``` + +\--- /task \--- + +\--- task \--- + +Add more code so that, when Flappy's `x` position is greater than the pipe clone's `x` position, the `score`{:class="block3variables"} increases by `1` and a sound of your choice plays. + +You could use the 'pop' sound if you want, or add a sound from the library, for example 'bird'. + +\--- hints \--- + +\--- hint \--- + +You need to `wait until`{:class="block3control"} `Flappy's x position`{:class="block3sensing"} is `greater than (>)`{:class="block3operators"} the `x position`{:class="block3motion"} of `Pipes`. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone ++ wait until <> +``` + +Then `change score by 1`{:class="block3variables"} and `play a sound`{:class="block3sound"}. + +\--- /hint \--- + +\--- hint \--- + +Use these blocks in the correct order: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> + +play sound (pop v) + +change [score v] by (1) + +[x position v] of (Flappy v) + +x position + +() > () +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <([x position v] of (Flappy v)) > (x position)> +change [score v] by (1) +play sound (pop v) +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code and make sure you score a point every time Flappy gets through a gap between pipes. Check whether the `score`{:class="block3variables"} is set to `0` when you start a new game. + +\--- /task \--- \ No newline at end of file diff --git a/zh-CN/step_9.md b/zh-CN/step_9.md new file mode 100644 index 0000000..2f4e2e6 --- /dev/null +++ b/zh-CN/step_9.md @@ -0,0 +1,5 @@ +## Challenge: adjust the difficulty + +Is the game too hard or too easy for you? How many ways can you find to change the difficulty? + +Adjust the game until you are happy with its difficulty! \ No newline at end of file diff --git a/zh-TW/images/banner.png b/zh-TW/images/banner.png new file mode 100644 index 0000000..7a0da5b Binary files /dev/null and b/zh-TW/images/banner.png differ diff --git a/zh-TW/images/binary-showcase.png b/zh-TW/images/binary-showcase.png new file mode 100644 index 0000000..499aa29 Binary files /dev/null and b/zh-TW/images/binary-showcase.png differ diff --git a/zh-TW/images/flappy-clones-test.png b/zh-TW/images/flappy-clones-test.png new file mode 100644 index 0000000..f874059 Binary files /dev/null and b/zh-TW/images/flappy-clones-test.png differ diff --git a/zh-TW/images/flappy-falling.gif b/zh-TW/images/flappy-falling.gif new file mode 100644 index 0000000..970d833 Binary files /dev/null and b/zh-TW/images/flappy-falling.gif differ diff --git a/zh-TW/images/flappy-flying.gif b/zh-TW/images/flappy-flying.gif new file mode 100644 index 0000000..e259ff1 Binary files /dev/null and b/zh-TW/images/flappy-flying.gif differ diff --git a/zh-TW/images/flappy-height-test.png b/zh-TW/images/flappy-height-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/zh-TW/images/flappy-height-test.png differ diff --git a/zh-TW/images/flappy-parrot-showcase.png b/zh-TW/images/flappy-parrot-showcase.png new file mode 100644 index 0000000..493049b Binary files /dev/null and b/zh-TW/images/flappy-parrot-showcase.png differ diff --git a/zh-TW/images/flappy-pipes-duplicate1-annotated.png b/zh-TW/images/flappy-pipes-duplicate1-annotated.png new file mode 100644 index 0000000..65e32c6 Binary files /dev/null and b/zh-TW/images/flappy-pipes-duplicate1-annotated.png differ diff --git a/zh-TW/images/flappy-pipes-duplicate1.png b/zh-TW/images/flappy-pipes-duplicate1.png new file mode 100644 index 0000000..4239b67 Binary files /dev/null and b/zh-TW/images/flappy-pipes-duplicate1.png differ diff --git a/zh-TW/images/flappy-pipes-duplicate2.png b/zh-TW/images/flappy-pipes-duplicate2.png new file mode 100644 index 0000000..ba1a69a Binary files /dev/null and b/zh-TW/images/flappy-pipes-duplicate2.png differ diff --git a/zh-TW/images/flappy-pipes-ends.png b/zh-TW/images/flappy-pipes-ends.png new file mode 100644 index 0000000..ab59aaa Binary files /dev/null and b/zh-TW/images/flappy-pipes-ends.png differ diff --git a/zh-TW/images/flappy-pipes-fill-rectangle.png b/zh-TW/images/flappy-pipes-fill-rectangle.png new file mode 100644 index 0000000..7360b87 Binary files /dev/null and b/zh-TW/images/flappy-pipes-fill-rectangle.png differ diff --git a/zh-TW/images/flappy-pipes-filled.png b/zh-TW/images/flappy-pipes-filled.png new file mode 100644 index 0000000..7d2c0dd Binary files /dev/null and b/zh-TW/images/flappy-pipes-filled.png differ diff --git a/zh-TW/images/flappy-pipes-position.png b/zh-TW/images/flappy-pipes-position.png new file mode 100644 index 0000000..ca2b810 Binary files /dev/null and b/zh-TW/images/flappy-pipes-position.png differ diff --git a/zh-TW/images/flappy-pipes-rectangle.png b/zh-TW/images/flappy-pipes-rectangle.png new file mode 100644 index 0000000..6e3bf02 Binary files /dev/null and b/zh-TW/images/flappy-pipes-rectangle.png differ diff --git a/zh-TW/images/flappy-pipes-test.png b/zh-TW/images/flappy-pipes-test.png new file mode 100644 index 0000000..eaa7d0a Binary files /dev/null and b/zh-TW/images/flappy-pipes-test.png differ diff --git a/zh-TW/images/flappy-setup.png b/zh-TW/images/flappy-setup.png new file mode 100644 index 0000000..92f9eca Binary files /dev/null and b/zh-TW/images/flappy-setup.png differ diff --git a/zh-TW/images/flappy-sprite.png b/zh-TW/images/flappy-sprite.png new file mode 100644 index 0000000..6a0c590 Binary files /dev/null and b/zh-TW/images/flappy-sprite.png differ diff --git a/zh-TW/images/flappy-stage.png b/zh-TW/images/flappy-stage.png new file mode 100644 index 0000000..5efe03c Binary files /dev/null and b/zh-TW/images/flappy-stage.png differ diff --git a/zh-TW/images/flappy-starting-position.png b/zh-TW/images/flappy-starting-position.png new file mode 100644 index 0000000..9089c9e Binary files /dev/null and b/zh-TW/images/flappy-starting-position.png differ diff --git a/zh-TW/images/flappy-wings.png b/zh-TW/images/flappy-wings.png new file mode 100644 index 0000000..ef0aa8e Binary files /dev/null and b/zh-TW/images/flappy-wings.png differ diff --git a/zh-TW/images/pipes-sprite.png b/zh-TW/images/pipes-sprite.png new file mode 100644 index 0000000..a9882ed Binary files /dev/null and b/zh-TW/images/pipes-sprite.png differ diff --git a/zh-TW/meta.yml b/zh-TW/meta.yml new file mode 100644 index 0000000..c2fe5e6 --- /dev/null +++ b/zh-TW/meta.yml @@ -0,0 +1,34 @@ +--- +title: Flappy parrot +hero_image: images/banner.png +description: Create a game in which you guide a parrot past moving obstacles +listed: true +copyedit: true +version: 4.1 +last_tested: 2018-10-90 +steps: + - + title: Introduction + - + title: Add the pipes + - + title: "Challenge: make better pipes" + challenge: true + - + title: Make the pipes move + - + title: Make Flappy fall + - + title: Make Flappy fly + - + title: Detect collisions + - + title: Add a score + - + title: 'Challenge: adjust the difficulty' + challenge: true + - + title: 'Challenge: add a high score' + challenge: true + - + title: What next? diff --git a/zh-TW/scratch-translatable.txt b/zh-TW/scratch-translatable.txt new file mode 100644 index 0000000..214e66c --- /dev/null +++ b/zh-TW/scratch-translatable.txt @@ -0,0 +1,13 @@ +Pipes + +costume1 + +Flappy + +wings down + +wings up + +Game Over! + +score diff --git a/zh-TW/solutions/FlappyParrot-Solution.sb3 b/zh-TW/solutions/FlappyParrot-Solution.sb3 new file mode 100644 index 0000000..a0cd354 Binary files /dev/null and b/zh-TW/solutions/FlappyParrot-Solution.sb3 differ diff --git a/zh-TW/step_1.md b/zh-TW/step_1.md new file mode 100644 index 0000000..f7519ae --- /dev/null +++ b/zh-TW/step_1.md @@ -0,0 +1,69 @@ +\--- no-print \--- + +This is the **Scratch 3** version of the project. There is also a [Scratch 2 version of the project](https://projects.raspberrypi.org/en/projects/flappy-parrot-scratch2). + +\--- /no-print \--- + +## Introduction + +Create a game in which you have to guide a parrot past scrolling pipes to score points. + +### What you will make + +\--- no-print \--- + +Click the green flag to start the game. Press the space bar to make the parrot flap its wings, and try to get it to fly through the gaps in the pipes! You score one point for every pipe that you manage to get the parrot past. + +
+ + +
+ +\--- /no-print \--- + +\--- print-only \--- + +You will press the space bar to make the parrot flap its wings, and score one point for every pipe that you manage to get the parrot past. + +![flappy parrot game being played](images/flappy-parrot-showcase.png) + +\--- /print-only \--- + +## \--- collapse \--- + +## title: What you will need + +### Hardware + ++ A computer capable of running Scratch 3 + +### Software + ++ Scratch 3 (either [online](https://rpf.io/scratchon) or [offline](https://rpf.io/scratchoff)) + +\--- /collapse \--- + +## \--- collapse \--- + +## title: What you will learn + ++ How to create sprites using Vector mode ++ How to use sounds ++ How to detect collisions ++ How to control a sprite using the keyboard + +\--- /collapse \--- + +## \--- collapse \--- + +## title: Additional notes for educators + +\--- no-print \--- + +If you need to print this project, please use the [printer-friendly version](https://projects.raspberrypi.org/en/projects/flappy-parrot/print){:target="_blank"}. + +\--- /no-print \--- + +You can find the [completed project here](https://rpf.io/p/en/flappy-parrot-get). + +\--- /collapse \--- \ No newline at end of file diff --git a/zh-TW/step_10.md b/zh-TW/step_10.md new file mode 100644 index 0000000..a5808f3 --- /dev/null +++ b/zh-TW/step_10.md @@ -0,0 +1,9 @@ +## Challenge: add a high score + +\--- challenge \--- + +Can you add a high score to the game so that, in addition to keeping track of score for the current round, it keeps track of the highest score you've ever reached? + +[[[generic-scratch3-high-score]]] + +\--- /challenge \--- \ No newline at end of file diff --git a/zh-TW/step_11.md b/zh-TW/step_11.md new file mode 100644 index 0000000..02ae229 --- /dev/null +++ b/zh-TW/step_11.md @@ -0,0 +1,19 @@ +## What next? + +Try the [Binary hero](https://projects.raspberrypi.org/en/projects/binary-hero?utm_source=pathway&utm_medium=whatnext&utm_campaign=projects) project, where you will make a game in which you play the notes of a song as they scroll down the Stage. + +\--- no-print \--- + +Click the green flag to start the game. Use the z, x, c, and v keys to play the correct notes when these reach the bottom of the Stage. You'll score ten points for every correct note you play. + +
+ +
+ +\--- /no-print \--- + +\--- print-only \--- + +The notes will fall from above, and you will have to press keys to "catch" and play the notes. ![showcase](images/binary-showcase.png) + +\--- /print-only \--- \ No newline at end of file diff --git a/zh-TW/step_2.md b/zh-TW/step_2.md new file mode 100644 index 0000000..d8f2ce5 --- /dev/null +++ b/zh-TW/step_2.md @@ -0,0 +1,84 @@ +## Add the pipes + +First, create the pipes. + +\--- task \--- + +Open a new empty Scratch project. + +[[[generic-scratch3-new-project]]] + +\--- /task \--- + +\--- task \--- + +Add a backdrop with an outdoor landscape. 'Blue Sky' is a good choice. + +![screenshot](images/flappy-stage.png) + +[[[generic-scratch3-backdrop-from-library]]] + +\--- /task \--- + +\--- task \--- + +Create a new sprite and name it 'Pipes'. + +[[[generic-scratch3-draw-sprite]]] + +\--- /task \--- + +The 'Pipes' sprite should be a pair of pipes with a gap in the middle. By moving the sprite up or down, you can put the gap in a different place. + +This picture shows an example of how the pipes could be positioned. The parts of the sprite outside the Stage are normally hidden, you only see then when you drag the sprite: + +![screenshot](images/flappy-pipes-position.png) + +You can't draw a sprite as big as the pipes need to be, but you can increase the size at which the sprite shows on the Stage. + +\--- task \--- + +![pipes sprite](images/pipes-sprite.png) + +Add code to make the sprite bigger. + +```blocks3 +when green flag clicked +set size to (200) % +``` + +This makes it's easier to see how big the pipes should be. + +\--- /task \--- + +\--- task \--- + +Draw a rectangle for the top pipe as shown here: + +![rectangle for the pipe](images/flappy-pipes-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Fill the pipe with a colour you like. + +![fill the rectangle](images/flappy-pipes-fill-rectangle.png) + +\--- /task \--- + +\--- task \--- + +Create a duplicate of the pipe by selecting it and then clicking on **Copy** and **Paste**. + +![copy and paste pipe](images/flappy-pipes-duplicate1-annotated.png) + +\--- /task \--- + +\--- task \--- + +Drag the copy of the pipe to the bottom of the screen so that the copy is in line with the other pipe. There needs to be a gap between the two pipes. + +![screenshot](images/flappy-pipes-duplicate2.png) + +\--- /task \--- \ No newline at end of file diff --git a/zh-TW/step_3.md b/zh-TW/step_3.md new file mode 100644 index 0000000..17f05f7 --- /dev/null +++ b/zh-TW/step_3.md @@ -0,0 +1,11 @@ +## Challenge: make better pipes + +Can you make your pipes look better? + ++ Shade your pipes with a left-to-right gradient. + +![screenshot](images/flappy-pipes-filled.png) + ++ Add extra rectangles to the ends of the pipes: + +![screenshot](images/flappy-pipes-ends.png) \ No newline at end of file diff --git a/zh-TW/step_4.md b/zh-TW/step_4.md new file mode 100644 index 0000000..2beedd9 --- /dev/null +++ b/zh-TW/step_4.md @@ -0,0 +1,65 @@ +## Make the pipes move + +Next you're going to make the pipes move across the screen to create an obstacle course. + +![pipes moving across the screen](images/flappy-clones-test.png) + +\--- task \--- + +First make the pipes appear by adding code to the Pipes sprite so that, `when the green flag is clicked`{:class="block3events"}, the sprite `forever`{:class="block3control"} `creates a clone of itself`{:class="block3control"} every two seconds. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +**Tip:** clones are just copies of a sprite, and they are really useful for creating games. + +\--- /task \--- + +\--- task \--- + +Next make the pipes move by adding code so that, `when a clone starts`{:class="block3control"}, the clone appears on the right side of the Stage and `glides`{:class="block3motion"} across to the left. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show +go to x: (240) y: (0) +glide (4) secs to x: (-240) y: (0) +delete this clone +``` + +**Tip:** you can stop the pipes scrolling by clicking the red **stop** button next to the green flag. + +\--- /task \--- + +Now you should have lots of pipes, but their gaps are always in the same place. + +You can add some variety by using a `random`{:class="block3operators"} number for the Pipes sprite's `y position`{:class="block3motion"}. + +![pipes at different heights](images/flappy-height-test.png) + +\--- task \--- + +Modify your sprite's code so that each sprite clone `picks a random number from -80 to 80`{:class="block3operators"} and `glides`{:class="block3motion"} to that `y position`{:class="block3motion"}: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +show ++ go to x: (240) y: (pick random (-80) to (80)) ++ glide (4) secs to x: (-240) y: (y position) +delete this clone +``` + +\--- /task \--- \ No newline at end of file diff --git a/zh-TW/step_5.md b/zh-TW/step_5.md new file mode 100644 index 0000000..f9d79ce --- /dev/null +++ b/zh-TW/step_5.md @@ -0,0 +1,77 @@ +## Make Flappy fall + +Now add a sprite called Flappy and create code it so Flappy falls down the Stage. In the next step, you will add the code to make Flappy fly when you press a key. + +\--- no-print \--- + +![flappy falling animation](images/flappy-falling.gif) + +\--- /no-print \--- + +\--- task \--- + +Add a new sprite that has two costumes, for 'wings up' and 'wings down', and name it `Flappy`. + +The parrot sprite is a good choice. + +![parrot sprite](images/flappy-sprite.png) + +\--- /task \--- + +Flappy needs to be smaller. + +\--- task \--- + +Add code to `set Flappy's size to 25%`{:class="block3looks"} `when the green flag is clicked`{:class="block3events"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +``` + +\--- /task \--- + +When the game starts, Flappy needs to be just left of the centre of the Stage, at coordinates `-50, 0`. + +![flappy shown at the start position](images/flappy-starting-position.png) + +\--- task \--- + +Add code to make Flappy `go to the x and y`{:class="block3motion"} starting position of `x: -50`{:class="block3motion"} and `y: 0`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % ++ go to x: (-50) y: (0) +``` + +[[[generic-scratch3-set-coordinates]]] + +\--- /task \--- + +\--- task \--- + +Now make Flappy keep falling down the Stage by `forever`{:class="block3control"} `changing the sprite's y position by -3`{:class="block3motion"}. + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +set size to (25) % +go to x: (-50) y: (0) ++ forever + change y by (-3) +end +``` + +\--- /task \--- + +\--- task \--- + +Test your code to make sure Flappy starts in the middle of the screen and falls to the bottom. When you drag Flappy to the top of the Stage, the sprite should fall again. + +\--- /task \--- \ No newline at end of file diff --git a/zh-TW/step_6.md b/zh-TW/step_6.md new file mode 100644 index 0000000..1a98cb2 --- /dev/null +++ b/zh-TW/step_6.md @@ -0,0 +1,106 @@ +## Make Flappy fly + +Now you will make Flappy flap upwards when you press the space bar. When you play the game, you have to time your taps to get Flappy through the gaps in the pipes. + +\--- no-print \--- + +![flappy flying upwards when space bar is pressed](images/flappy-flying.gif) + +\--- /no-print \--- + +Make Flappy fly upwards when you tap the space bar. + +\--- task \--- + +When the `space key is pressed`{:class="block3events"}, Flappy should move upwards by `changing its y coordinate`{:class="block3motion"} by a small amount, for example `6`. + +Flappy flies upwards by `repeating`{:class="block3control"} this movement `10 times`{:class="block3control"}. + +Add this code to your `Flappy` sprite: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +repeat (10) + change y by (6) +end +``` + +\--- /task \--- + +Now you need to get Flappy's wings flapping! + +\--- task \--- + +Click on the **Costumes** tab, and name Flappy's costumes 'wings up' and 'wings down'. + +![naming the costumes](images/flappy-wings.png) + +\--- /task \--- + +\--- task \--- + +Can you make Flappy's costume change to `wings down` when you press space, and then change it back to `wings up` halfway through the upward movement? + +\--- hints \--- + +\--- hint \--- + +You need to split the upward motion in half so that you can use two `repeat`{:class="block3control"} blocks to change Flappy's costume at the beginning and in the middle of the movement. + +Add `switch costume to`{:class="block3looks"} blocks to change how Flappy looks. + +\--- /hint \--- \--- hint \--- + +You need to use these blocks: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +repeat (5) + change y by (6) +end + +repeat (5) + change y by (6) +end + +switch costume to (wings up v) + +switch costume to (wings down v) + +when [space v] key pressed +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when [space v] key pressed +switch costume to (wings down v) +repeat (5) + change y by (6) +end +switch costume to (wings up v) +repeat (5) + change y by (6) +end +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code. As you see, at the moment nothing happens if you let Flappy hit a pipe. + +\--- /task \--- \ No newline at end of file diff --git a/zh-TW/step_7.md b/zh-TW/step_7.md new file mode 100644 index 0000000..40a2720 --- /dev/null +++ b/zh-TW/step_7.md @@ -0,0 +1,77 @@ +## Detect collisions + +To make the game a challenge, the player needs to guide Flappy through the gaps without letting the parrot touch the pipes or the edges of the Stage. You need to add some blocks to detect when Flappy hits something. + +This is called **collision detection**. + +\--- task \--- + +Import a sound from the library that you want to play when Flappy collides with something. The 'screech' sound is a good choice. + +[[[generic-scratch3-sound-from-library]]] + +\--- /task \--- + +A `wait until`{:class="block3control"} block is necessart to check whether Flappy is `touching the pipes`{:class="block3sensing"} `or`{:class="block3operators"} `touching the edge`{:class="block3sensing"}. + +\--- task \--- + +Add a new `when green flag clicked`{:class="block3control"} block to the 'Flappy' sprite, and also add the following code: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) +``` + +\--- /task \--- + +\--- task \--- + +Test your code. If Flappy touches a pipe, the 'screech' sound should play. + +\--- /task \--- + +Next, update the code so that the game stops when Flappy hits a pipe. + +\--- task \--- + +Add the following code to stop the game after a collision is detected: + +![parrot sprite](images/flappy-sprite.png) + +```blocks3 +when green flag clicked +wait until < or > +play sound (screech v) ++ say [Game Over!] ++ broadcast (Game Over v) ++ stop [other scripts in sprite v] +``` + +The `broadcast`{:class="block3events"} block tells other sprites that the game is over. + +The `stop`{:class="block3control"} block stops other Flappy scripts that are running so that Flappy stops falling after a collision. + +\--- /task \--- + +\--- task \--- + +Finally, add the following code to the `Pipes` sprite so that pipes `stop`{:class="block3control"} appearing `when the sprite receives Game Over`{:class="block3events"}. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I receive [Game Over v] +stop [other scripts in sprite v] +``` + +\--- /task \--- + +\--- task \--- + +Test your game and see how long you can play before it's 'Game over'! + +\--- /task \--- \ No newline at end of file diff --git a/zh-TW/step_8.md b/zh-TW/step_8.md new file mode 100644 index 0000000..2c5cc08 --- /dev/null +++ b/zh-TW/step_8.md @@ -0,0 +1,116 @@ +## Add a score + +The player should score a point every time Flappy makes it through a gap between pipes. + +\--- task \--- + +Make a new variable **for all sprites** and call it `score`{:class="block3variables"}. + +[[[generic-scratch3-add-variable]]] + +\--- /task \--- + +Each 'Pipes' sprite clone should `wait until`{:class="block3control"} Flappy has flown past and then increase the `score`{:class="block3variables"}. + +\--- task \--- + +First, `set score to 0`{:class="block3variables"} when the game begins: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when green flag clicked ++ set [score v] to [0] +set size to (200) % +hide +forever + create clone of (myself v) + wait (2) seconds +end +``` + +\--- /task \--- + +\--- task \--- + +Then add the following code to the `Pipes` sprite: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> +``` + +\--- /task \--- + +\--- task \--- + +Add more code so that, when Flappy's `x` position is greater than the pipe clone's `x` position, the `score`{:class="block3variables"} increases by `1` and a sound of your choice plays. + +You could use the 'pop' sound if you want, or add a sound from the library, for example 'bird'. + +\--- hints \--- + +\--- hint \--- + +You need to `wait until`{:class="block3control"} `Flappy's x position`{:class="block3sensing"} is `greater than (>)`{:class="block3operators"} the `x position`{:class="block3motion"} of `Pipes`. + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone ++ wait until <> +``` + +Then `change score by 1`{:class="block3variables"} and `play a sound`{:class="block3sound"}. + +\--- /hint \--- + +\--- hint \--- + +Use these blocks in the correct order: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <> + +play sound (pop v) + +change [score v] by (1) + +[x position v] of (Flappy v) + +x position + +() > () +``` + +\--- /hint \--- + +\--- hint \--- + +Your code should look like this: + +![pipes sprite](images/pipes-sprite.png) + +```blocks3 +when I start as a clone +wait until <([x position v] of (Flappy v)) > (x position)> +change [score v] by (1) +play sound (pop v) +``` + +\--- /hint \--- + +\--- /hints \--- + +\--- /task \--- + +\--- task \--- + +Test your code and make sure you score a point every time Flappy gets through a gap between pipes. Check whether the `score`{:class="block3variables"} is set to `0` when you start a new game. + +\--- /task \--- \ No newline at end of file diff --git a/zh-TW/step_9.md b/zh-TW/step_9.md new file mode 100644 index 0000000..2f4e2e6 --- /dev/null +++ b/zh-TW/step_9.md @@ -0,0 +1,5 @@ +## Challenge: adjust the difficulty + +Is the game too hard or too easy for you? How many ways can you find to change the difficulty? + +Adjust the game until you are happy with its difficulty! \ No newline at end of file