Advertisement
ML2030

Untitled

Sep 28th, 2021
2,035
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import pygame
  2.  
  3. pygame.init()
  4. window = pygame.display.set_mode([800,580])
  5.  
  6. X = 200
  7. Y = 200
  8. speedX = 1
  9. speedY = 1
  10. clock = pygame.time.Clock()
  11.  
  12. while True:
  13.     window.fill((255,255,255))
  14.  
  15.     pygame.draw.circle(
  16.       window,
  17.       [255,0,0],
  18.       [X,Y],
  19.       70
  20.     )
  21.  
  22.     X += speedX
  23.     Y += speedY
  24.  
  25.     if X < 70 or X > 730:
  26.       speedX= -speedX;
  27.     if Y < 70 or Y > 510:
  28.       speedY = -speedY;
  29.  
  30.     pygame.display.update()
  31.     clock.tick(60)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement