Advertisement
Guest User

Untitled

a guest
Mar 11th, 2013
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.05 KB | None | 0 0
  1. '''
  2. Main file for Swift Pong
  3. '''
  4. #!/usr/bin/python
  5. import pygame
  6. from pong import Pong
  7. from pygame.locals import *
  8.  
  9. # Create an instance
  10. game = Pong()
  11.  
  12. # Initalize the game
  13. pygame.init()
  14.  
  15. pygame.display.set_caption("Swift Pong!")  # Window Caption Title
  16.  
  17. screen = pygame.display.set_mode((900,600),0,32)
  18. screen.blit(screen, (0,0))
  19.  
  20. pygame.mouse.set_visible(False)     # Hide mr. mouse
  21. beeper = pygame.image.load('paddle.png')     # Paddle
  22. bpaddle = pygame.image.load('blank_paddle.png')     # Paddle that is drawn over the green one to ensure "motion"
  23.  
  24.  
  25.  
  26. paddle_rect = beeper.get_rect()
  27. bounds_rect = pygame.Rect(0, 0, 300, 300)
  28.    
  29. clock = pygame.time.Clock()
  30.  
  31. while True:
  32.     for event in pygame.event.get():
  33.         if event.type == QUIT:
  34.             sys.exit()
  35.  
  36.     screen.blit(bpaddle, paddle_rect)
  37.     # Draw the net
  38.     pygame.draw.line(screen, game.lineColor, game.net1, game.net2, game.netWidth)
  39.  
  40.     paddle_rect.clamp_ip(bounds_rect)
  41.     screen.blit(beeper, paddle_rect)
  42.     screen.blit(bpaddle, paddle_rect)
  43.  
  44.     clock.tick(50)
  45.  
  46.     pygame.display.update()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement