-2
我試圖做一個射擊遊戲pygame的,但是當我跑我的遊戲,它顯示pygame的窗口,而是給出了一個錯誤:類型錯誤:必需的參數「DEST」(位置2)未找到
Traceback (most recent call last):
File "C:\Users\Nnamdi\AppData\Local\Programs\Python\Python36-32\game.py", line 26, in <module>
SCREEN.blit(text)
TypeError: Required argument 'dest' (pos 2) not found
這裏是我的代碼:
import pygame, sys
from pygame.locals import *
pygame.init()
ammo = "10" # you have ten ammo, use it wisely...
WIDTH = 600
HEIGHT = 600
SCREEN = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption('Bomber')
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
DARKBLUE = (2, 9, 129)
YELLOW = (255, 255, 255)
SCREEN.fill(DARKBLUE)
pygame.display.flip()
basicfont = pygame.font.SysFont(None, 48)
text = basicfont.render('Bomber', True, (255, 0, 0), (255, 255, 255))
SCREEN.blit(text, dest)
is_running = True
while is_running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
is_running = False
pygame.quit()
希望能幫到你。
你能不能給我們整個的錯誤? – Rishav
'dest'是什麼? – eyllanesc
您的錯誤['SCREEN.blit(text)']中的第26行和您發佈的代碼['SCREEN.blit(text,dest)']中的第26行(當前)明顯不同。這使得其中一個不正確。 – donkopotamus