• 点击 ,拖出两个 Random Integer 指令。
  • 将其放置在间隔事件内部 goal_star 形状的上方。
  • 将它们重命名为 rand_xrand_y
  • rand_x 的范围更改为 ( -250, 250)。将 rand_y 的范围更改为 (-100, 250)
  • 现在将 goal_star 的 x 坐标替换为 rand_x ,将其 y 坐标替换为 rand_y

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

stage.set_background("moon") sprite = codesters.Sprite("hedgehog") sprite.go_to(0, -210) def left(): sprite.turn_left(20) stage.event_left_key(left) def right(): sprite.turn_right(20) stage.event_right_key(right) def up(): sprite.move_forward(575) stage.wait(0.1) sprite.go_to(0, -210) stage.event_up_key(up) def interval(): goal_star = codesters.Star(0, 0, 5, 15, "yellow") # add any other actions... stage.event_interval(interval, 2)
  • Run Code
  • 提交作品
  • 下个活动
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)