Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stage.set_background("space")
- spaceship = codesters.Sprite("ufo")
- spaceship.set_size(.4)
- star1 = codesters.Star(200, 200, 5, 10, "orange")
- star2 = codesters.Star(-200, -200, 5, 10, "orange")
- def collision(sprite, hit_sprite):
- sprite.glide_to(0,0)
- hit_sprite.hide()
- # add any other actions...
- spaceship.event_collision(collision)
- def left_key():
- spaceship.move_left(20)
- # add other actions...
- stage.event_key("left", left_key)
- def right_key():
- spaceship.move_right(20)
- # add other actions...
- stage.event_key("right", right_key)
- def up_key():
- spaceship.move_up(20)
- # add other actions...
- stage.event_key("up", up_key)
- def down_key():
- spaceship.move_down(20)
- # add other actions...
- stage.event_key("down", down_key)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement