Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import pygame
- from pong import Pong
- from pygame.locals import *
- # Create an instance
- game = Pong()
- # Initalize the game
- pygame.init()
- screen = pygame.display.set_mode((900,600),0,32)
- screen.blit(screen, (0,0))
- pygame.mouse.set_visible(False) # Hide mr. mouse
- beeper = pygame.image.load('paddle.png') # Paddle
- bpaddle = pygame.image.load('blank_paddle.png') # Paddle that is drawn over the green one to ensure "motion"
- # Setup the paddle
- paddle_pos = (0,0)
- paddle_rect = beeper.get_rect()
- bounds_rect = pygame.Rect(880,200,0,500)
- while True:
- for event in pygame.event.get():
- if event.type == QUIT:
- sys.exit()
- # Draw the net
- pygame.draw.line(screen, game.lineColor, game.net1, game.net2, game.netWidth)
- # Player paddle animation
- paddle_rect.center = pygame.mouse.get_pos()
- paddle_rect.clamp_ip(bounds_rect)
- screen.blit(beeper, paddle_rect)
- pygame.display.update()
- screen.blit(bpaddle, paddle_rect)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement