14 步:如果球碰到砖块,它应该改变方向!

  • 在图形中在第二个 if 语句中添加Set x Speed
  • .set_x_speed()中的参数更改为- ball_x_speed
  • 在第二个 if 块中添加Set y Speed 。让我们编辑参数为运动添加一点随机性!
  • 删除5并输入random .randint(- 5 , 5 ) 。这会将 y 速度设置为 -5 到 5 之间的随机整数!

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
  • 提交作品
  • 下个活动
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)