第10步:现在我们将在函数中嵌入一个 if 语句。确保它缩进8个空格,并且带有一个 ········

  • 点击 ,将 if or 拖动到函数内部。
  • 设置 if 语句以测试 rand_y 是否等于 -150 或者 rand_y 是否等于 50
  • Sprite at Position 拖动到 if 语句内部,并将其名称更改为 car
  • 将图像名称更改为 car_img。将其 x 坐标更改为 -400,并将其 y 坐标更改为 rand_y

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)