When I finally got the input to work in this code it stopped displaying the txt on the screen. Any suggestions on how to fix this.
import pygame, sys
from pygame.locals import *
import time
mo = 0
# set up pygame
pygame.init()
# set up the window
windowSurface = pygame.display.set_mode((500, 400), 0, 32)
pygame.display.set_caption('Test')
# set up the colors
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
# set up fonts
basicFont = pygame.font.SysFont(None, 48)
# draw the black background onto the surface
windowSurface.fill(BLACK)
#Click Here
text2 = basicFont.render ('Test',False,WHITE,BLUE)
text = basicFont.render('Click Here to continue...', False, GREEN, BLACK)
textRect = text.get_rect()
textRect.centerx = windowSurface.get_rect().centerx
textRect.centery = windowSurface.get_rect().centery
text2Rect = text.get_rect()
text2Rect.centerx = windowSurface.get_rect().centerx
text2Rect.centery = windowSurface.get_rect().centery-150
# draw the text onto the surface
windowSurface.blit(text, textRect)
windowSurface.blit(text2,text2Rect)
mo == 0
while True:
# check for events
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
if event.type == KEYDOWN:
# change the keyboard variables
if event.key == K_LEFT or event.key == ord('a'):
print('yes')
if event.key == K_UP or event.key == ord('w'):
print('yes ')
if event.key == K_DOWN or event.key == ord('s'):
print('yes')
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:
print('perfect')
mo = mo+1
# get a pixel array of the surface
pixArray = pygame.PixelArray(windowSurface)
pixArray[480][380] = BLACK
del pixArray
# draw the text onto the surface
windowSurface.blit(text, textRect)
windowSurface.blit(text2,text2Rect)
# draw the window onto the screen
pygame.display.update()
# run the game loop
mo==1
while True:
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()