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 Shrinking Platforms

Transcript

One way to make your game more challenging is to make a platform shrink if the sprite touches it. This screencast will show you how to make shrinking platforms, then you’ll have a chance to create them for your game. First, you’ll need to find a way to shrink the platform sprite. Before, you used the shrink tool to shrink a sprite by clicking on it. With computer science, you can program the computer to do things, like this, for you. In this case, you will tell the computer to shrink the platform if the sprite touches it.

To shrink the sprite, click on looks and drag out the “change size by” block.

Clicking this block makes the sprite bigger. To make the sprite smaller, change this value to a negative number.

Good, that makes it smaller.

This platform should shrink, if the sprite touches it.

Go to control, drag out an if statement, and place it around the “change size by” block Then, go to sensing, drag out a “touching” block, and change the value to the name of the main character sprite.

Now this reads: Now, you need to tell the computer when to check this if statement.

The computer needs to check the if statement the the entire time the program is running.

To make sure that happens, put a forever block around the if statement.

You also need to let the computer know when to run the code. Add a “when flag clicked” block to tell the code when to start running. Test your code to see if that worked.

Whoa!

When the sprite touches the platform, the platform starts to shrink.

There is one problem, though. The sprite never returns to its full size. Anyone who plays this game now will have a tiny platform. Well, that’s no fun!

To fix that, put a “set size to 100%” block just under the “when flag clicked” block.

Now, the platform will always start the game at full size.

Choose an Add-On
Time to Celebrate!
Create a wild winning celebration using some of these ideas.
Moving Platforms
Make your game more challenging by creating moving platforms.
Shrinking Platforms
Create a shrinking platform to increase your game's difficulty.
Splash! You Lose
Create a way for the player to lose in your game.
Add Some Tunes
Add some background music to your game.
Bug Fix: Land on Your Feet...or Not
Fix the bug that allows things other than a sprite's feet to keep it on a platform.
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!