Guest User

Untitled

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