ZFGC

Resources => Coding => Topic started by: Alex on March 13, 2013, 11:23:56 pm

Title: Any pygame users?
Post by: Alex on March 13, 2013, 11:23:56 pm
I have a problem in the pong game I am developing using the pygame module (written in python).  My problem is the paddle (mouse) won't show up, it's just blank.  If you need further input about my code at all, feel free to ask.

Code: [Select]
#!/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"

paddle_rect = beeper.get_rect()
blank_rect = bpaddle.get_rect()
bounds_rect = pygame.Rect(0, 0, 300, 300)
paddle_pos = (0,0)

while True:
     for event in pygame.event.get():
          if event.type == QUIT:
               sys.exit()

     paddle_pos = pygame.mouse.get_pos()
     paddle_rect.center = pygame.mouse.get_pos()
     screen.blit(beeper, paddle_rect)
     pygame.draw.line(screen, game.lineColor, game.net1, game.net2, game.netWidth)
     screen.blit(bpaddle, paddle_rect)
     pygame.display.update()

Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved