Step 17: Duplicate and Change Code

Goal:


Big_Asteroid_2 needs similar code as Big_Asteroid_1. To save time, let’s duplicate code and paste it into the other sprite.

Once that code is duplicated, we need to make a small change which includes making a new broadcast message for Big_Asteroid_2

Steps:

  1. Grab the IF statement we just made, and drag it to the sprite for Big_Asteroid_2 and place it where it needs to go in the code.
  2. Do the same with the When I receive code.
  3. Click on the Big_Asteroid_2 sprite.
  4. Find and click on the block that says broadcast Destroyed1. Click on New message and create a new message called Destroyed2.

Code:


Click to replay

Click to replay