View difference between Paste ID: xAAda30e and J5Qd91Yp
SHOW: | | - or go back to the newest paste.
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
# Setup the paddle
19-
clock = pygame.time.Clock()
19+
20
paddle_rect = beeper.get_rect()
21
bounds_rect = pygame.Rect(880,200,0,500)
22
23
while True:
24
     for event in pygame.event.get():
25
          if event.type == QUIT:
26
               sys.exit()
27
28
     # Draw the net
29
     pygame.draw.line(screen, game.lineColor, game.net1, game.net2, game.netWidth)
30
31
     # Player paddle animation
32
     paddle_rect.center = pygame.mouse.get_pos()
33
     paddle_rect.clamp_ip(bounds_rect)
34
     screen.blit(beeper, paddle_rect)
35
     pygame.display.update()
36
     screen.blit(bpaddle, paddle_rect)