View Single Post
Old 01-12-2012, 03:48 AM   PM User | #1
usmc10000
New to the CF scene

 
Join Date: Jan 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
usmc10000 is an unknown quantity at this point
User input problem

It is my first game and I need to know how to, for lack of a better word, pause the program but still run my animations and only stop them and continue the program when it receives use input.

Code:
    for event in pygame.event.get():
        if event.type == KEYDOWN:
            if event.key == K_g:
                screen.blit(btlgrd, (0,0))
                screen.blit(bluect, (30,441))
                screen.blit(greyct, (1042,441))
                screen.blit(bulet1, (a,502))
                screen.blit(bulet2, (b,502))
                a+=1
                b-=1
                if a>1050:
                    a=120
                if b<120:
                    b=1050
                if event.key == K_r:
                    screen.blit(unionvic, (400,100))
                if event.key == K_q:
                  pygame.event.post(pygame.event.Event(QUIT))
            if event.key == K_i:
                screen.blit(info, (0,0))
When I run it and press "g" it does as shown BUT I don't know how to make it wait until either "r" or "q" is pressed. Thank you and yes I am a noob.
usmc10000 is offline   Reply With Quote