Now we'll use a collision event to change how that ball moves after it collides with bricks or the paddle.

  • From, drag in a Collision with Shape. Assign the event to ball in the event handler.
  • Use Global Variable to update score. Drop it directly under the line that defines the collision event.
  • Change the variable my_var to color anywhere it is used in the collision() event.
  • Change the first if statement to test for the color of your paddle and the second one to test for the bricks color.

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)