STEP 7: Let's change the default code to customize our collision event.

  • Click into the code editor inside the collision event.
  • Delete the line: ····sprite.go_to(0,0)¬
  • Now our sprite will stay where it is and the other sprite will "hide" so it looks like our sprite picked it up!

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

stage.set_background("winter") sprite = codesters.Sprite("snowman") sprite.set_size(.5) sprite.pen_down() sprite.glide_to(5, -6) def collision(sprite, hit_sprite): sprite.go_to(0,0) hit_sprite.hide() # add any other actions... sprite.event_collision(collision)
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)