Example #1
0
            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)):
                    if math.sqrt(math.pow(guy.x-blist[i].x,2)+math.pow(guy.y-blist[i].y,2))<=35:
                        blist[i].interact(guy,grass)
                for i in range(len(guy.placed)):
                    if math.sqrt(math.pow(guy.x-guy.placed[i].x,2)+math.pow(guy.y-guy.placed[i].y,2))<=35:
                        guy.placed[i].interact(guy)
    
    pygame.time.wait(int(round(guy.gamespeed,0)))