############################################################################# #The main menu classes for pong # ############################################################################# import pygame, os, sys from pygame.locals import * class menu(): def DrawMenu(self): #setup the screen# self.screen = pygame.display.set_mode ((800,600)) pygame.display.set_caption ("pong") #set image variables and load background# self.BackGround = pygame.image.load (os.path.join ("Data","menubackground.jpeg")) self.BackGround = self.BackGround.convert() #blit image to screen# self.screen.blit(self.BackGround,(0,0)) def SelBall(self): #setting possitional variables# self.BallX = 140 self.BallY = 140 #get the graphic# self.Ball = pygame.image.load (os.path.join ("Data", "ball.jpeg")) self.Ball = self.Ball.convert() #blit image# self.screen.blit(self.Ball,(self.BallX,self.BallY)) #menu selct variable and loop# self.MenuSel = "none" while MenuSel == "none": for event in pygame.event.get(): if event.type == pygame.KEYDOWN: #moves ball to bottom choice and checks to see if its there,and exits game if event.key == K_DOWN and self.BallY != 100: self.BallY = self.BallY - 40 if event.key == K_RETURN and self.BallY == 100: exit() #moves ball to top choice and checks to see if its there,and exits loop if event.key == K_UP and self.BallY != 140: self.BallY = self.BallY +40 if event.Key == K_RETURN and self.BallY == 140: self.MenuSel = "enterpong"