Skip to content

Please update your browser

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

Transcript

In this add-on, you’ll program the ship to sink and add events that 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 "say" 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.”

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! Awesome!

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 onto 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 sprites 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 out together.

Awesome!

Next, build this 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.

Add events to make the sinking ship part of your story.

Choose an Add-On
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 Back
Next arrow_forward
Instructions
  1. Choose an Add-On, and click "watch" to learn how to build it.
  2. Once you finish one Add-On, try another one below the video!