第 11 步:现在让我们的足球弹跳起来!

精灵的x 速度是它水平移动的速度。精灵的y 速度是它垂直移动的速度。

  • 在工具包中,单击并将Set x Speed拖到代码编辑器的底部。
  • 点击运行。你应该看到你的足球运动员水平地来回弹跳。

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

microbit = codesters.Microbit() microbit.show_string("hello") stage.set_background("soccerfield") sprite = codesters.Sprite("athlete2") sprite.move_down(150) def button_a(): sprite.move_left(50) microbit.event_button_a(button_a) def button_b(): sprite.move_right(50) microbit.event_button_b(button_b) ball = codesters.Sprite("soccerball")
  • Run Code
  • 提交作品
  • 下个活动
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)