Skip to content

Please update your browser

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

Remarque : Ce thème n’a pas été mis à jour pour intégrer Scratch 3.0. Pour plus d’informations, voir cet article d’aide.
Transcription

Ready for a challenge?

Step up to this add-on, which will guide you through a new concept: creating a list.

Use your curiosity and persistance, as you complete this add-on.

Once you have finished this add-on, your users will be able to save their projects in Scratch.

To start, save the X and Y location of the stamp, each time it is placed.

To do that, make a list that records the X position of the sprite, and a different list, that records the Y position of the sprite.

Start by creating a list for the arch sprite.

To make a list, click on make a list.

Give the list a name that makes sense, such as arch X.

Make sure to check off for all sprite's, otherwise your lists will only save the X position of the original sprite, not its clone.

Next, make the arch X list save the clones X position when it stamps.

To do that, use the add to block from the data menu, which will add whatever is in the box to the list you select.

In this example, the box says thing.

First make sure the check box next to arch X clicked, so you can see the correct list.

Then click the add to block.

Thing shows up in the arch X list.

That was just a test.

Your list should keep track of the X position of the arch when it stamps.

So it shouldn't say thing.

To remove thing from the list, click on the orange box with thing in it, then click the X next to it.

Place the add to block, just after the stamp, but before the clone gets deleted.

Right now it still adds thing to the arch X list.

Next, you will make it save the X position of the sprite in the list.

To do that, drag the X position variable from the motion menu, to the spot on the add to block that says thing.

Test this code.

Click on the arch, move it to a position on the screen, and click.

As soon as you click, the X position of the sprite, should show up in the arch X list.

Great!

Again that was just a test, so delete this number as well.

Next, save the sprite's Y position.

This will get its own list with a name that makes sense, like arch Y.

Place a new add to block under the first add to block, that saves the sprite's X position.

Make sure this block is adding to arch Y, or whatever you named the Y position list.

Now place the Y position variable inside the second add to block, where it says thing.

Test the code by stamping the arch sprite, somewhere on the screen.

When you stamp, a number should appear in both the X and Y lists.

If the numbers are the same, check that you have put X position on the arch X list, and Y position on the arch Y list.

If two numbers appeared on one list, and no number appeared on the other, check that one add to block is saving to arch X, and the other add to block is adding to the arch Y list.

Stamp the arch again.

A second number should appear on both lists.

In part two of this add on, you will learn how to use these lists to recreate an image.

Now it is your turn.

Create a list for a sprite's X and Y position.

And add the X and Y positions to the correct lists, after the sprite's stamps.

Choisir une extension
Pivoteur
Faites tourner l'estampille du lutin vers la droite et la gauche quand on appuie sur les touches fléchées.
Chute de blocs (Part 1 of 2)
Créez un jeu dans lequel les utilisateurs construisent un bâtiment à l'aide de blocs qui tombent.
Chute de blocs (Part 2 of 2)
Créez un jeu dans lequel les utilisateurs construisent un bâtiment à l'aide de blocs qui tombent.
Ville Arc-en-ciel
Transformez le paysage en y ajoutant les couleurs de l'arc-en-ciel
Détails
Faites changer les lutins de taille !
Starchitecte
Changez l'arrière-plan à d'autres scènes.
Blueprints (Part 1 of 2)
Blueprints (Part 2 of 2)
arrow_backward Retour
Suivant arrow_forward
Instructions
Regardez la vidéo de présentation pour découvrir les extensions, puis sélectionnes-en une ou plusieurs parmi celles qu’on trouve ci-dessous !