ssoni

hover.py

Mar 6th, 2026
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. import math
  2. import pygame
  3. import sys
  4.  
  5. pygame.init()
  6.  
  7. screen = pygame.display.set_mode((800,400))
  8. pygame.display.set_caption('Game Title')
  9.  
  10. clock = pygame.time.Clock()
  11. angle=0
  12. moveAmt = 1
  13. x1=100
  14. y1=100
  15.  
  16. while True:
  17.     for event in pygame.event.get():
  18.         if event.type == pygame.QUIT:
  19.             pygame.quit()
  20.             sys.exit()
  21.  
  22.     angle += 10
  23.     y1 += math.sin(math.radians(angle))*moveAmt
  24.    
  25.     screen.fill((70,70,70))
  26.    
  27.     pygame.draw.circle(screen, 'red', (x1,y1), 5)
  28.  
  29.     pygame.display.update()     ## vs. flip()
  30.     clock.tick(60)
  31.  
Advertisement
Add Comment
Please, Sign In to add comment