RFNXVfwQQPS4J

Sprite walk at the lake

Source: licencja: CC 0.

Spacer duszka nad jeziorem

You will learn
  • how to create your first animated storystorystory.

R1VpxctHfvj0V1
nagranie abstraktu

If you already know how to program the basic movements of the sprite, you can create your first animated story. Your task is to build a scriptscriptscript, in which your sprite will walk back and forth on the pierpierpier located on the lake. So far, the sprite was wandering on an empty stage. However, if we want to create a storystorystory, we need a backdropbackdropbackdrop for it.

Task 1
R1BtscyR6lkUY1
nagranie abstraktu

Replace white backdrop of the stage with an image of the boardwalk. If you do not know how to do it, read the following instructions and watch the slideshow.

RM5G5mSU7SJKE1
nagranie abstraktu

Step 1.

Find the icon for choosing a new backdrop from the gallery in the lower left corner of the screenscreenscreen in the area of stage management. Click on it.

Step 2.

You have the BackdropbackdropBackdrop LibrarylibraryLibrary window in front of you. Select the backdrop with the pier on the lakelakelake named boardwalk and confirm your selection with the OK buttonbuttonbutton.

Step 3.

Next to the stage window select a blank backdrop No. 1 and delete it by clicking on the cross.

Step 4.

Click on the sprite in the area of the sprite management, and then on the scripts tab to return to the familiar look of your screen.

Rn1AZSnWYIxZV1
Pokaz slajdów prezentuje w kolejnych krokach, w jaki sposób zmienić tło. Instrukcja obsługi z poziomu klawiatury: 1. Uruchomienie aplikacji - ENTER, 2. Na każdym ze slajdów czytany jest automatycznie tekst alternatywny po polsku, 3. Przy pierwszym uruchomieniu na pierwszym slajdzie, czytanie tekstu po angielsku - TAB, 4. Przejście między slajdami: do następnego slajdu - TAB, do poprzedniego slajdu - TAB + SHIFT, 5. Przejście do czytania napisu po angielsku - strzałka w górę + strzałka w dół (czyta tekst po angielsku widoczny na slajdzie).
Source: GroMar, licencja: CC BY 3.0.
R1QTVFbmozFP11
nagranie abstraktu

We want the sprite to walk along the pierpierpier. Not only one way, but back and forth. Because dragging the sprite every time it disappears behind the edge of the stage spoils the whole effect of the story you create.

Task 2
Rgp8g312kf5gX1
nagranie abstraktu

Prepare a basic scriptscriptscript, in which the sprite will take 10 steps.

Enter the following modifications in the script:

  • After reaching the edge of the stage, the sprite turns around and continues to walk the other way.

  • After bouncing off the wall he does not walk upside down.

If you have problems finding the right blocks, see the instructions.

R12FpAUkGempn1
nagranie abstraktu

In order for the sprite to turn around and continue walking the other way after reaching the edge of the stage, one should choose from the Motion categorycategorycategory the block if on edge, bounce.

So that the sprite after bouncing from the wall does not walk upside down, it is necessary to choose from the Motion category the block set rotation style ... and the left‑right option from drop‑down menu.

RBlJl9w3rIjwK1
Source: GroMar, licencja: CC BY 3.0.
R12rjanymzIIc1
nagranie abstraktu

Until now, the sprite walked only when we pressed the key. We can automate his movement: partially or completely.

In the Control categorycategorycategory there are blocks repeat ... and forever.

The first one is used to execute commands contained in it as many times as we enter in its field. The second performs commands indefinitely. Therefore, you cannot attach another block to it (no teeth).

RUyrgYMcOSKte1
Source: GroMar, licencja: CC BY 3.0.
Task 3
RWpVS98QsQAry1
nagranie abstraktu

Test in your script, how the blocks repeat ... and forever work.

R15hdIzoL2LfL1
nagranie abstraktu

The animation you create will be more convincing if the movement of the sprite is accompanied by the movement of his body. This effect will arise if we use the costume blocks in the Look categorycategorycategory. What kind of costumes your sprite has, you can check by clicking on the Costumes tab.

The sprite body will move when walking, if it has at least two costumes.

R1WW9dFsu77z91
Source: GroMar, licencja: CC BY 3.0.
R1ONpOQUorA3k1
nagranie abstraktu

The computer can perform many commands at the same time, so you can write different tasks in the form of separate scripts. You already have a script that causes the sprite to move on stage. You can add a second script, which will cause that the sprite will be animated due to the change of costumes. Both scripts will run simultaneously if they are started with the same key or green flag. You can also add additional scripts.

Task 4
Rvt62NxmxoJDk1
nagranie abstraktu

Modify your scriptscriptscript or add additional scripts that will do the following tasks:

  • the movement of the sprite will last for a short time after pressing the selected key,

  • the sprite will change the costume while walking,

  • the sprite will greet you before walking.

  • the sprite will end the walk, saying he is tired.

Example solution

R1Rn9DpdRn4oh1
Source: GroMar, licencja: CC BY 3.0.
R1VSzcYdCK6jX1
nagranie abstraktu

You can change the backdropbackdropbackdrop; it is worth to test other characters than the cat‑sprite. Some sprites have more costumes.

Watch the slideshow to learn how to choose a new sprite.

RH6vcLNI2GD8Z1
Pokaz przedstawia dodawanie nowego duszka. Instrukcja obsługi z poziomu klawiatury: 1. Uruchomienie aplikacji - ENTER, 2. Na każdym ze slajdów czytany jest automatycznie tekst alternatywny po polsku, 3. Przy pierwszym uruchomieniu na pierwszym slajdzie, czytanie tekstu po angielsku - TAB, 4. Przejście między slajdami: do następnego slajdu - TAB, do poprzedniego slajdu - TAB + SHIFT, 5. Przejście do czytania napisu po angielsku - strzałka w górę + strzałka w dół (czyta tekst po angielsku widoczny na slajdzie).
Source: GroMar, licencja: CC BY 3.0.
R15Zr72J0qqdx1
nagranie abstraktu

The sprite can move, bounce off the wall. To get the effect of body movement, you should insert a sprite animation into the script. We use the sprite costumes for that.

Exercises

Exercise 1
RlnYXdY269fVJ
Wersja alternatywna ćwiczenia: Which sentences are true? Możliwe odpowiedzi: 1. Sprites are elements of the program to which we can assign scripts., 2. The appearance of the sprite can be changed using the Costumes tab., 3. Scratch libraries contain a lot of different backdrops., 4. Different scripts cannot be executed simultaneously.
zadanie
Source: GroMar, licencja: CC BY 3.0.
Exercise 2

Design a script illustrating a short story about a bat flying in the castle. Look for options that allow you to change the backdrop during the flight of the bat. Use in your project ready‑made backdrops of the castle in Scratch program.

Exercise 3

Explain in English how the costumes are used in the animation of the sprites.

Exercise 4
R1HL8e2M7QmXN
Wersja alternatywna ćwiczenia: Indicate which pairs of expressions or words are translated correctly. Możliwe odpowiedzi: 1. tło - backdrop, 2. biblioteka - library, 3. zmiana - modification, 4. skrypt - script, 5. jezioro - pier, 6. pomost - script
zadanie
Source: GroMar, licencja: CC BY 3.0.
R14TKxORVYrpX1
Interaktywna gra, polegająca na łączeniu wyrazów w pary w ciągu jednej minuty. Czas zaczyna upływać wraz z rozpoczęciem gry. Jeden ruch to odkrywanie najpierw jednej potem drugiej karty z wyrazem. Każdy wyraz jest odczytywany. Kolejny ruch to odkrywanie trzeciej i czwartej karty. W ten sposób odsłuchasz wszystkie wyrazy. Nawigacja z poziomu klawiatury za pomocą strzałek, odsłuchiwanie wyrazów enterem lub spacją. Znajdź wszystkie pary wyrazów.
Source: Zespół autorski Politechniki Łódzkiej, licencja: CC BY 3.0.

Glossary

backdrop
backdrop

tło

R1FTvW0VVUVR51
wymowa w języku angielskim: backdrop
button
button

przycisk

R1aUHRKC2Av1s1
wymowa w języku angielskim: button
category
category

kategoria

R15CvxIpBH5V81
wymowa w języku angielskim: category
lake
lake

jezioro

R17CoQRN0P4bN1
wymowa w języku angielskim: lake
library
library

biblioteka

RSFr105IahvM21
wymowa w języku angielskim: library
modification
modification

zmiana

R1JLXWSyXCviu
wymowa w języku angielskim: modification
pier
pier

pomost

R4qiYHADL7FlL1
wymowa w języku angielskim: pier
screen
screen

ekran

RJr38oWq4rQ2n1
wymowa w języku angielskim: screen
script
script

skrypt

RMyWVl1qQpEdg1
wymowa w języku angielskim: script
story
story

historia

R1EfOBOSUzu9X1
wymowa w języku angielskim: story

Keywords

backdropbackdropbackdrop

librarylibrarylibrary

modificationmodificationmodification

scriptscriptscript