Thank you all!!!! you are helping me so much. I thought i was pretty proficient in pygame so im very sorry for my 'stupid' questions but i cannot for the life of me figure this one out. I made all the neceesary changes and ive blitted correctly i think but i keep getting... KeyError: 4 import pygame pygame.init() import sys,random,os from pygame.locals import* from Classes import Arrow clock=pygame.time.Clock() clock.tick(30) def main_menu(): menuclock=pygame.time.Clock() clock.tick(30) menuscreen=pygame.display.set_mode((640, 480))#FULLSCREEN pygame.display.set_caption('Dog Fight') #pygame.mouse.set_visible(False) WHITE=(255,255,255) BLACK=(0,0,0) GREEN=(0,255,0) BLUE=(0,0,255) background="" style="color: #2934d5">'data/background.png') lasersound=pygame.mixer.Sound('data/lasershot.wav') arrow=pygame.image.load('data/arrow.png') menuscreen.blit(background,(0,0)) arrowpos = { 0 : (100,20) , 1:(100,40) , 2:(100,60) , 3 :(100,60) } def dostuff(): print('Hi') menu='go' counter = 0 menuscreen.blit(arrow,arrowpos[counter]) while menu == "go": for event in pygame.event.get(): if event.type == QUIT: pygame.quit() sys.exit() if event.type == KEYDOWN: if event.key == K_ESCAPE: menu = "off" if event.key == K_UP: if counter > 0: counter -= 1 menuscreen.blit(arrow,arrowpos[counter]) if event.key == K_DOWN: if counter < 4: counter += 1 menuscreen.blit(arrow,arrowpos[counter]) if event.key == K_RETURN: return counter pygame.display.update() main_menu() THANK YOU!!!!! On Feb 28, 2012, at 1:21 AM, Bartosz Debski wrote:
|