函数缺少必需的参数“目标”(位置2)

时间:2019-07-17 08:16:25

标签: python pygame

import pygame 

**函数缺少必需的参数“ dest”(位置2)чтоэтозначит? УменяпростоанимированыйplayerStandиянаписалавоттакelse:         win.blit(playerStand [animCount // 5]),(x,y)         animCount + = 1

// win.blit(bg,(0,0))   // pygame.display.update()

ивыдалоошибкуdest.Обьяснитекто-нибудьпожалуйста。 Гуглила,какие-топроблемыспарсингом。**

pygame.init()
win = pygame.display.set_mode((1210, 750))

pygame.display.set_caption("Cbes Game")

runRight = [pygame.image.load ('Run (1).png'),pygame.image.load ('Run 
(2).png'),pygame.image.load ('Run (3).png'),pygame.image.load ('Run 
(4).png'),pygame.image.load ('Run (5).png'),pygame.image.load ('Run 
(6).png'),pygame.image.load ('Run (7).png'),pygame.image.load ('Run 
(8).png'),pygame.image.load ('Run (9).png'),pygame.image.load ('Run 
(10).png'),pygame.image.load ('Run (11).png'),pygame.image.load ('Run 
(12).png'),pygame.image.load ('Run (13).png'),pygame.image.load ('Run 
(14).png'),pygame.image.load ('Run (15).png'),pygame.image.load ('Run 
(16).png'),pygame.image.load ('Run (17).png'),pygame.image.load ('Run 
(18).png'),pygame.image.load ('Run (19).png'),pygame.image.load ('Run 
(20).png')]

runLeft = [pygame.image.load ('runLEFT(1).png'),pygame.image.load 
('runLEFT(2).png'),pygame.image.load ('runLEFT(3).png'),pygame.image.load 
('runLEFT(4).png'),pygame.image.load ('runLEFT(5).png'),pygame.image.load 
('runLEFT(6).png'),pygame.image.load ('runLEFT(7).png'),pygame.image.load 
('runLEFT(8).png'),pygame.image.load ('runLEFT(9).png'),pygame.image.load 
('runLEFT(10).png'),pygame.image.load 
('runLEFT(11).png'),pygame.image.load 
('runLEFT(12).png'),pygame.image.load 
('runLEFT(13).png'),pygame.image.load 
('runLEFT(14).png'),pygame.image.load 
('runLEFT(15).png'),pygame.image.load 
('runLEFT(16).png'),pygame.image.load 
('runLEFT(17).png'),pygame.image.load 
('runLEFT(18).png'),pygame.image.load 
('runLEFT(19).png'),pygame.image.load ('runLEFT(20).png')]

bg = pygame.image.load ('bg.jpg')

playerStand = [pygame.image.load ('Idle (1).png'),pygame.image.load 
('Idle (2).png'),pygame.image.load ('Idle (3).png'),pygame.image.load 
('Idle (4).png'),pygame.image.load ('Idle (5).png'),pygame.image.load 
('Idle (6).png'),pygame.image.load ('Idle (7).png'),pygame.image.load 
('Idle (8).png'),pygame.image.load ('Idle (9).png'),pygame.image.load 
('Idle (10).png'),pygame.image.load ('Idle (11).png'),pygame.image.load 
('Idle (12).png'),pygame.image.load ('Idle (13).png'),pygame.image.load 
('Idle (14).png'),pygame.image.load ('Idle (15).png'),pygame.image.load 
('Idle (16).png')]

clock = pygame.time.Clock()

x= 50
y = 425
width = 416
hight = 454
speed = 5

isJump = False
jumpCount = 10

left = False
right = False
animCount = 0

def drawWindow():
    global animCount

    if animCount + 1 >= 100:
        animCount = 0

    if left:
        win.blit(runLeft[animCount // 5]), (x, y)
        animCount += 1
    elif right:
        win.blit(runRight[animCount // 5]), (x, y)
        animCount += 1
    else:
        win.blit(playerStand[animCount // 5]), (x, y)
        animCount += 1

    win.blit(bg, (0, 0))
    pygame.display.update()

run = True
while run:
    clock.tick(100)

    for event in pygame.event.get():
     if event.type == pygame.QUIT:
        run = False

    keys = pygame.key.get_pressed()
    if keys[pygame.K_LEFT] and x > 5:
        x -= speed
        left = True
        right = False
    elif keys[pygame.K_RIGHT] and x < 500 - width - 5:
        x += speed
        left = False
        right = True
    else:
        left = False
        right = False
        animCount = 0
    if not(isJump):
        if keys[pygame.K_UP] and y > 5:
            y -= speed
        if keys[pygame.K_DOWN] and y < 500 - hight - 15:
            y += speed
        if keys[pygame.K_SPACE]:
            isJump = True
    else:
        if jumpCount >= -10:
            if jumpCount < 0:
                y += (jumpCount ** 2) / 2
            else:
                y -= (jumpCount ** 2) / 2
            jumpCount -= 1
        else:
            isJump = False
            jumpCount = 10

    drawWindow()

pygame.quit()

0 个答案:

没有答案