Example #1
0
 if event.type==QUIT or (event.type==KEYUP and event.key==K_ESCAPE):
     pygame.quit()
     sys.exit()
 elif event.type==KEYDOWN:
     if event.key==K_UP:
         guy.moveUp()
     elif event.key==K_DOWN:
         guy.moveDown()
     elif event.key==K_LEFT:
         guy.moveLeft()
     elif event.key==K_m:
         guy.cs+=15
     elif event.key==K_RIGHT:
         guy.moveRight()
     elif event.key==K_s:
         guy.showskins()
     elif event.key==K_g:
         guy.showbgs(grass)
     elif event.key==K_p:
         guy.tryplace()
     elif event.key==K_o:
         guy.changespeed()
     elif event.key==K_SPACE:
         for i in range(len(peoplelist)):
             #print(math.sqrt(math.pow(guy.x-peoplelist[i].x,2)+math.pow(guy.y-peoplelist[i].y,2)))
             if math.sqrt(math.pow(guy.x-peoplelist[i].x,2)+math.pow(guy.y-peoplelist[i].y,2))<=35:
                 guy.dirchange(peoplelist[i])
                 peoplelist[i].draw(screen)
                 pygame.display.update()
                 peoplelist[i].interact(guy,grass)
         for i in range(len(blist)):