Step 3: Beginning Laser Behavior

Goal:


When the laser clone is made, it will appear and move up on the game screen.

Up on the game screen is a change in the positive y direction, however Stormtroopers are not the best with accuracy.

Once the Lasers reach the edge of the game screen, they will be deleted

Steps:

  1. Stay on the “Laser” sprite
  2. From Control, place a When I start as a clone block
  3. From Looks, place a show block
  4. From Motion, place a Point in direction block
  5. From Operators, place a pick random inside of point in direction and set it from -20 to 20.
  6. From Control,  place a forever block
  7. From Motion, place a move 10 steps block and change it to 20.
  8. From Control, place an if statement
  9. From Sensing, place a touching mouse-pointer block
  10. Change it to touching edge
  11. From Control, place a delete this clone block

Code:


Click to replay