让我们帮助刺猬Hedgey乘坐火箭遨游太空, 在一分钟内收集尽可能多的星星和积分!

你将有机会在此模块中制作和自定义这个游戏。

  • 点击 运行。然后按向左键和向右键将刺猬向星星移动。
  • 按向上键启动 Hedgey。Hedgey将在按键后2秒启动。
  • 在时间用完之前,Hedgey从旅途中返回后将重复这个步骤,继续收集积分!

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

stage.set_background("moon") hedgey = codesters.Sprite("hedgehog") hedgey.go_to(0, -210) points = 0 score_board = codesters.Display(points, -209, -209) time = 0 timer_board = codesters.Display(time, 194,-197) def interval(): global time time +=1 timer_board.update(time) if time %2 == 0: x = random.randint(-230,230) y = random.randint(0,230) star = codesters.Star(x, y, 5, 20, "yellow") if time == 60: stage.remove_sprite(hedgey) text = codesters.Text("HEDGEY SCORED "+ str(points) + " POINTS!", -21, -176, "red") stage.event_interval(interval, 1) def left(): hedgey.turn_left(20) stage.event_left_key(left) def right(): hedgey.turn_right(20) stage.event_right_key(right) def up(): hedgey.set_say_color("white") hedgey.say("BLAST OFF !",2) hedgey.move_forward(575) stage.wait(0.1) hedgey.go_to(0, -210) stage.event_up_key(up) def collision(star, hit_sprite): global points points += 1 hit_sprite.hide() score_board.update(points) hedgey.event_collision(collision)
  • Run Code
  • 提交作品
  • 下个活动
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)