Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stage.set_background("spring")
- player = codesters.Sprite("blackcat", -200,-200)
- villan = codesters.Sprite("zombie2", 200,-200)
- #stage.set_gravity(10)
- stage.set_bounce(0)
- ############################################
- def left_key():
- player.move_left(20)
- # add other actions...
- stage.event_key("left", left_key)
- def right_key():
- player.move_right(20)
- # add other actions...
- stage.event_key("right", right_key)
- def space_bar():
- shoot(player, 20, collision, "purple")
- #add other actions...
- stage.event_key("space", space_bar)
- ############################################
- def shoot(shooter, speed, collision, color):
- x = shooter.get_x()
- y = shooter.get_y()
- sprite = codesters.Circle(x, y, 10, color)
- sprite.set_x_speed(speed)
- sprite.event_collision(collision)
- def collision(sprite, hit_sprite):
- if hit_sprite == villan :
- stage.remove_sprite(hit_sprite)
- stage.remove_sprite(sprite)
- for counter in range(999):
- print(counter)
- villan.go_to(199, -125)
- villan.move_left(500)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement