I'm a newbie to Python, and I was wondering whether anyone could give me any pointers on improving the following code:import pygame, sys, timefrom pygame.locals import *# Define defaultsbg = (0,0,0) # background colourspl = (255,255,255) # splash colourver = INDEV v1.0 # current versionimg = icn.png # corner icon (UNUSED)cur = cur.png # cursor iconplayer = player.png # playerlogo = pixl.png # splash logocurrtile_x = 0currtile_y = 0# Player detailspx = 20py = 20speedy = 25up = Falsedown = Falseleft = Falseright = Falsesinglerun = 1# Load Mapwith open('townhall.map', 'r') as f:    for line in f:            for character in line:                if character == \n:                    print Newline                else:                    if character == x:                        print WALL                    else:                         if character == a:                            print LAND# Othercompleted = 0clock = pygame.time.Clock()splashboot = 0# Initialise screenpygame.init()pygame.mouse.set_visible(False)screen = pygame.display.set_mode((640, 420))pygame.display.set_caption('The Missing Piece ' + ver)# Unused#icon = pygame.image.load(img).convert_alpha()#pygame.display.set_icon(icon)# Initialise spritestry:    cursor = pygame.image.load(cur).convert_alpha()    logo = pygame.image.load(logo).convert_alpha()    player = pygame.image.load(player).convert_alpha()except:    print Unexpected error loading sprites!    raw_input(Press ENTER to exit)    pygame.quit()    raise# Splash screenwhile splashboot != 25:    for event in pygame.event.get():        if event.type == QUIT:            pygame.quit()    splash = pygame.Surface(screen.get_size())    splash = splash.convert()    splash.fill(spl)    x, y = screen.get_size()    gx = x - 600    yx = (y / 2) - 25    font = pygame.font.Font(None, 20)    splashver = font.render(ver, 20, (0, 0, 0))    screen.blit(splash, (0, 0))    screen.blit(logo, (gx,yx))    screen.blit(splashver, (520, yx + 50))    pygame.display.update()    splashboot += 1    time.sleep(0.1)    print splashboot# Fill backgroundbackground = pygame.Surface(screen.get_size())background = background.convert()background.fill(bg)# Define instructionsfont = pygame.font.Font(None, 20)ver = font.render(The Missing Piece  + ver, 20, (0, 0, 0))conl1 = font.render(W = UP, 20, (0, 0, 0))conl2 = font.render(A = LEFT, 20, (0, 0, 0))conl3 = font.render(S = DOWN, 20, (0, 0, 0))conl4 = font.render(D = RIGHT, 20, (0, 0, 0))# Event loopwhile completed != 1:    dt = clock.tick(60)    speed = speedy / float(dt)    for event in pygame.event.get():        if event.type == QUIT:            completed = 1            pygame.quit()        if event.type == KEYDOWN:            if event.key == K_LEFT:                left = True            if event.key == K_RIGHT:                right = True               if event.key == K_UP:                up = True            if event.key == K_DOWN:                down = True            if event.key == K_a:                left = True            if event.key == K_d:                right = True               if event.key == K_w:                up = True            if event.key == K_s:                down = True        if event.type == KEYUP:            if event.key == K_LEFT:                left = False            if event.key == K_RIGHT:                right = False               if event.key == K_UP:                up = False            if event.key == K_DOWN:                down = False            if event.key == K_a:                left = False            if event.key == K_d:                right = False               if event.key == K_w:                up = False            if event.key == K_s:                down = False    # direction scripts    if up:        py -= speed    if down:        py += speed    if left:        px -= speed    if right:        px += speed    # cursor settings    mousex,mousey = pygame.mouse.get_pos()    mousex -= cursor.get_width()/2    mousey -= cursor.get_height()/2    x, y = screen.get_size()    gx = x - 200    # draw background    screen.blit(background, (0, 0))    #pygame.draw.rect(screen, (255,255,255), (10,10,200,200), 0) # testbox    pygame.draw.rect(screen, (255,255,255), (gx,0,200,y), 0) # sidebar    # draw player    screen.blit(player, (px, py))    # draw version    screen.blit(ver, (gx,1))    # draw instructions    screen.blit(conl1, (gx+2,20))    screen.blit(conl2, (gx+2,32))    screen.blit(conl3, (gx+2,44))    screen.blit(conl4, (gx+2,56))    # draw cursor    screen.blit(cursor, (mousex, mousey))    pygame.display.update()I have been given one or two suggestions about snippets of the code, but I would like to know how I can make my code more efficient and simpler. I seem to have gone the long / difficult way around.
Moving a game character around the screen
python;performance;beginner;game;console