I have python 3.0 and im trying to get this code to work but I don't believe it is recognizing all the attributes it's supposed to.
import pygame, sys, random
from pygame.locals import *
#*******************************************SETUPVAR**************************************************
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
ORANGE = (255,180,0)
YELLOW=(230,230,0)
#***********************************************DEFINE*************************************************
def newscreen():
pygame.init()
mainClock = pygame.time.Clock()
windowSurface = pygame.display.set_mode((700,600), 0, 32)
pygame.display.set_caption('test')
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
ORANGE = (255,180,0)
YELLOW=(230,230,0)
basicFont = pygame.font.SysFont(None, 48)
Font1 = pygame.font.SysFont('ActionIsShaded', 25)
windowSurface.fill(BLACK)
text = basicFont.render ('test,False,WHITE,BLUE)
textRect = text.get_rect()
textRect.centerx = windowSurface.get_rect().centerx
textRect.centery = windowSurface.get_rect().centery-250
windowSurface.blit(text,textRect)
pygame.display.update()
return windowSurface
return event
def menu():
windowSurface = newscreen()
event = newscreen()
pygame.init()
basicFont = pygame.font.SysFont(None, 48)
Font1 = pygame.font.SysFont('ActionIsShaded', 25)
1 = basicFont.render('1', False, WHITE, RED)
2 = basicFont.render('2',False,WHITE,GREEN)
3 = basicFont.render('3',False,WHITE,ORANGE)
4 = basicFont.render('4',False,WHITE,YELLOW)
3Rect = vl.get_rect()
3Rect.centerx = windowSurface.get_rect().centerx+200
3Rect.centery = windowSurface.get_rect().centery-100
2Rect = games.get_rect()
2Rect.centerx = windowSurface.get_rect().centerx-200
2Rect.centery = windowSurface.get_rect().centery-100
1Rect = text.get_rect()
1Rect.centerx = windowSurface.get_rect().centerx +200
1Rect.centery = windowSurface.get_rect().centery+150
1Rect.size = (100,100)
4Rect = end.get_rect()
4Rect.centerx = windowSurface.get_rect().centerx-200
4Rect.centery = windowSurface.get_rect().centery+150
windowSurface.blit(1, 1Rect)
windowSurface.blit(2,2Rect)
windowSurface.blit(3,3Rect)
windowSurface.blit(4,4Rect)
pygame.display.update()
#keepgoing = True
while True:
# check for events
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
if event.type == KEYUP:
if event.key == K_ESCAPE:
pygame.quit()
sys.exit()
if event.key == K_RIGHT or event.key == ord('d'):
print('yes')
if event.key == ord('x'):
print('correct')
if event.type == MOUSEBUTTONUP:
M = pygame.mouse.get_pos
if M == textRect.collidepoint:
newscreen()
#***********************************************START***************************************************
newscreen()
menu()
# run the game loop
while True:
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()