Step 41: Duplicate Code

Goal:


Both Asteroid sprites act the same in the game, therefore they have the same code.

There are two options that we can do:

First, we can drag the code from one sprite to the other as shown in the picture.

Second, we can right-click the first Asteroid and click duplicate to create an exact copy of it. You would then have to remove the original second asteroid as it would have no code and would sit on the screen.

Let’s do the first option.

Steps:

  1. Hover over the When Flag Clicked block.
  2. Left-click and hold on your mouse to drag all of that code to the sprite for the other Big Asteroid.
  3. Do the same with the When I Start as a clone block.

Code:


Click to replay