Skip to content

Please update your browser

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

Bemærk: Dette tema er ikke opdateret til at afspejle Scratch 3.0. Se denne hjælpeartikel for yderligere oplysninger.

arrow_back Sink the Ship

Transskription

In this add-on, you'll program the ship to sink and add events to make the ship sinking part of your story.

To start, program the boat to move down.

Click the boat sprite and the motion menu.

To smoothly move a sprite to a different position, use a glide block.

This block has two values, an x and a y.

The x value shows the sprite's position on the left or right sides of the stage.

And the y value shows its position on the top or bottom of the stage.

Click and move the boat to a spot at the bottom of the sea.

Notice that the values in the glide block changed to reflect the boat's position.

Drag out the glide block.

When you run this block, the sprite will glide to the position you just selected.

Click and drag the boat to a different spot.

Then click the block.

Great, the sprite glides to the spot set by the x and y values in the block.

The ship is sinking.

Next, program a starting position for the ship.

Drag the boat until it's floating on the water and place a go to x y block under the when flag clicked block.

The values in the go to x y block also update to the sprite's current position.

To test this, click the flag.

The boat starts on top of the water.

When you click the glide block, the ship sinks, awesome.

Next, tell the code when to run.

In this example, the ship sinks after the save blocks run.

Click the last sprite to talk.

Select events and drag a broadcast block to the end of the block stack.

Click the dropdown and create a new message called sink the ship.

Next, select the boat sprite and add a when I receive sink the ship event above the glide block.

When the broadcast block runs at the end of the dialogue, it will send the message telling this glide block to run.

Click the flag to try it out.

The dialogue runs.

Then the boat sinks, cool.

Next, program the sprites to sink with the boat.

Reuse the code from the sinking ship for the two talking sprites.

Drag the when I receive block into each sprite.

This copies the code.

Click on each sprite to check that the code is there.

Next, set a starting position for each sprite.

To make the sprite start on top of the water, drag a go to block after the when flag clicked for each sprite.

Click the flag to try it all together.

Awesome, next build the sinking ship into your storyline.

In this example, one sprite jumps up and down before the ship sinks making it look like the sprite is responsible.

Now it's your turn.

Make the sprites sink using a glide block.

Program the sprites to start in the same position each time with go to blocks, broadcast a message to trigger the code for sinking the ship, and add a when I receive event to the glide block.

And finally, add events to make the sinking ship part of your story.

Vælg en udvidelse
Sea Sounds
Add sound effects to your story.
Sun Ray Animation
Draw and animate a sun sprite.
Sink the Ship
Program a sinking ship in your story.
Second Scene
Program a Second Scene for your Story.
Clouds
Draw and program clouds that move.
Gamify
Program one or more sprites to move when keys on the keyboard are pressed.
arrow_backward Tilbage
Næste arrow_forward