shejiyouxi
# 1 - Import libraryimport pygame
from pygame.locals import *
# 2 - Initialize the game
pygame.init()
width, height = 640, 480
screen = pygame.display.set_mode((width, height))
# 3 - Load images
player = pygame.image.load("resources/images/dude.png")
# 4 - keep looping through
while 1:
# 5 - clear the screen before drawing it again
screen.fill(0)
# 6 - draw the screen elements
screen.blit(player, (100, 100))
# 7 - update the screen
pygame.display.flip()
# 8 - loop through the events
for event in pygame.event.get():
# check if the event is the X button
if event.type == pygame.QUIT:
# if it is quit the game
pygame.quit()
exit(0)
grass = pygame.image.load("resources/images/grass.png")
castle = pygame.image.load("resources/images/castle.png")
for x in range(width/grass.get_width()+1):
for y in range(height/grass.get_height()+1):
screen.blit(grass, (x*100, y*100))
screen.blit(castle, (0, 30))
screen.blit(castle, (0, 135))
screen.blit(castle, (0, 240))
screen.blit(castle, (0, 345))
why出错
有这张图片吗? qiuyouzhi 发表于 2021-1-31 21:18
有这张图片吗?
是不是我版本不对 Sss123057057 发表于 2021-1-31 21:20
是不是我版本不对
和那个没关系
你看下你的代码文件下有没有这个文件 你要不试试绝对路径,就是文件的完整路径{:10_245:} qiuyouzhi 发表于 2021-1-31 21:31
和那个没关系
你看下你的代码文件下有没有这个文件
谢谢
页:
[1]