Advertisement
faefgagfrasdasfwe

turtle traffic 19

May 26th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. stage.set_background("space")
  2.  
  3. spaceship = codesters.Sprite("ufo")
  4. spaceship.set_size(.4)
  5.  
  6. star1 = codesters.Star(200, 200, 5, 10, "orange")
  7. star2 = codesters.Star(-200, -200, 5, 10, "orange")
  8.  
  9.  
  10.  
  11. def collision(sprite, hit_sprite):
  12. sprite.glide_to(0,0)
  13. hit_sprite.hide()
  14. # add any other actions...
  15. spaceship.event_collision(collision)
  16.  
  17.  
  18.  
  19. def left_key():
  20. spaceship.move_left(20)
  21. # add other actions...
  22. stage.event_key("left", left_key)
  23. def right_key():
  24. spaceship.move_right(20)
  25. # add other actions...
  26. stage.event_key("right", right_key)
  27. def up_key():
  28. spaceship.move_up(20)
  29. # add other actions...
  30. stage.event_key("up", up_key)
  31. def down_key():
  32. spaceship.move_down(20)
  33. # add other actions...
  34. stage.event_key("down", down_key)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement