Skip to content

Please update your browser

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

arrow_back Falling Blocks (Part 1 of 2)

Transcript

This add on will be more challenging than some of the others.

When you are finished, you will have created a cool architecture game in which the users make a building with falling blocks.

The game doesn't need a toolbox.

So, start by hiding it.

Click on the toolbox sprite add a one green flag clicked block and a hide block underneath it.

Test this works by clicking the green flag.

The toolbox disappears!

Great, next program the stamp to move with the arrow keys.

Create code for one sprite and copy the code later to use for the other sprites.

Click on the arch to start.

Use the move block to move the sprite right.

To make the sprite move right when the right arrow key is pressed, place the when key pressed block above the move block.

Test it by pressing the right arrow key.

The sprite moves to the right.

It doesn't move very smoothly though.

To smooth out the movement make the sprite keep moving right until the user stops pressing the right arrow key.

To make that happen place a repeat until block around the move block.

Then, fill out the condition for the repeat until block.

It should use the not operator form the operators menu and they key pressed condition from the sensing menu.

Click the drop down on the key pressed condition to make sure the right arrow key is selected.

Next, program the sprite to move left.

Right click the code and duplicate it.

Putting a positive number inside the move block makes it move right.

Putting a negative number instead will make it move left.

Make the key press even read left arrow key instead of right arrow key.

Make the condition of the statement read: wait until not, left arrow key, pressed.

Test it.

The sprite should move in both the left and right directions.

Copy the code to each of the other sprites to make them move left and right as well.

In the next video, you'll learn how to make the stamp sprites fall.

Now it's your turn!

Hide the toolbox.

Use the repeat until block, the not operator, key pressed condition, and move blocks to make the sprites move left and right.

Choose an Add-On
Falling Blocks (Part 1 of 2)
Create a game in which users create a building using falling blocks.
Falling Blocks (Part 2 of 2)
Create a game in which users create a building using falling blocks.
Rainbow City
Make the landscape turn into rainbow colors.
Detail Work
Make the sprites change size!
World Renowned Architect
Change the backdrop to other scenes.
Blueprints (Part 1 of 2)
Blueprints (Part 2 of 2)
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!