STEP 8: Let's display the score on the stage so that the player can see it.

  • From drag out Variable Display to the bottom of your program.
  • Change the display variable name from my_display to score_board.
  • Change the variable in .Display() from my_var to score.
  • Change the y-coordinate in .Display() from 150 to 200. Click Run. Now our score shows on the stage!

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

stage.set_background("underwater") sprite = codesters.Sprite("fish") sprite.go_to(-100, -220) stage.disable_floor() stage.set_gravity(4) sprite.set_gravity_off() def right_key(): sprite.move_right(20) # add other actions... stage.event_key("right", right_key) def left_key(): sprite.move_left(20) # add other actions... stage.event_key("left", left_key) score = 0
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)