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

This add-on will make the terrain more interesting.

Look how it rises and falls – it’s like the hero is walking over hills on its epic quest.

You won’t see all the steps, so you’ll have to figure some of it out for yourself.

Think about these three things as you figure out how to do this task: First, how can you “set” or “change” the height?

Second, when should it change?

And third, what else needs to change with the height to keep the game the same?

Make a variable called “ground height.”

If you’ve done the power-up add-on, think about the way the hero’s “jump height” changes, and think about how you could set the “ground height” the same way.

You’ll make a new ground sprite code stack.

Start with “when flag clicked."

Then, use a “forever” loop to “wait” a random number of seconds, then “set” the ground height.

This add-on is intended to be a little more challenging, so it’s up to you to keep track of all the code.

When you set the ground height, you probably want it to be random, so consider setting it to a random value between negative 120 and negative 80.

Use the new ground height variable in this “go to” block under the “when I receive ‘forward’” event.

It replaces the y value in the block.

Finally, if it changes, what happens with the other sprites?

What do you need to change about them to keep the game interesting?

The bug’s y position needs to go up and down.

If you’ve done the power-up, it should change too.

Into the “forever” loop that makes the clones, drag a “set y” block, then place the ground height variable into that block.

Test often!

Good luck!

Now, it’s your turn.

Set the height to change.

Change the height at different times while the game plays.

Add code or fixes to other sprites.

Choose an Add-On
Game Over
Give your hero a set number of lives.
Laser
Program your hero to shoot lasers to vanquish the evil bugs.
Power-up
Add a power pellet to make the hero jump higher.
Falling Rocks
Add a falling obstacle to your game.
Platforms
The terrain of your game will change to move up and down.
Follower Friend
Add a cute buddy who follows your hero around.
arrow_backward Back
Next arrow_forward
Instructions
  1. Choose an add-on, and click "watch" to learn how to customize your project.
  2. When you finish, come back to the add-ons screen and try another add-on!