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


In this video, you'll make your game more challenging by shrinking the platform if the sprite touches it.

First, shrink the platform sprite.

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 a change size by block.

Clicking this block makes the sprite bigger.

To make the sprite smaller, change it's value to a negative number.


Next, program the platform to shrink if the sprite touches it.

Click control, and place an if block around the change size by block.

From sensing, add a touching block and change the value to the name of the main character sprite.

Now this reads, if touching the sprite, change size by negative ten.

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

Add a forever block around the if statement, and the when flag clicked block to the top of the code stack.

Test your code to see if that worked.


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

Tinker with the value in the change size block to get an effect that you like for your program.

There is one bug.

The sprite never returns to it's 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 one hundred percent block under the when flag clicked block.

Great, now the platform will always start the game at full size.

Now it's your turn.

Program the platform to shrink if it's touching the player sprite using change size by, if touching, forever, and when flag clicked blocks.

Reset the platform with the set size block.

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
  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!
  • The song “Magic Marker” is © YouTube-- CC-BY-SA 4.0 does not apply.