[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] Re: [pygame] [pygame] Moving a ….sprite…item?



Wow! Insanely helpful! One last question though, how do i use the dictionary to blit the arrow?
This is what i have now..

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')
    aroow=pygame.image.load('data/arrow.png')
    menuscreen.blit(background,(0,0))
    arrowpos = { 0 : (20,20) , 1:(20,40) , 2:(20,60) , 3 :(20,60) }
    def dostuff():
        print('Hi')

    


    menu='go'
    counter = 0
    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,(#WHAT GOES HERE?)

            if event.key == K_DOWN:
                if counter < 4:
                    counter += 1

            if event.key == K_RETURN:
                return counter

        pygame.display.update()



main_menu()


its the what goes here part im confused at. How does the dict help me blit?
On Feb 27, 2012, at 4:23 PM, Bartosz Debski wrote:

counter = 0
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

if event.key == K_DOWN:
if counter < 4:
counter += 1

if event.key == K_RETURN:
"action"