鱼C论坛

 找回密码
 立即注册
查看: 4233|回复: 0

为什么背景显是不出来

[复制链接]
发表于 2022-9-11 12:19:00 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
  1. Import library
  2. import pygame
  3. from pygame.locals import *

  4. # 2 - Initialize the game
  5. pygame.init()
  6. width, height = 640, 480
  7. screen=pygame.display.set_mode((width, height))

  8. # 3 - Load images
  9. player = pygame.image.load("""D:\\llllllllllllllllllllllllllllllll\\kunkun\\kk.jpg""")

  10. # 4 - keep looping through
  11. while 1:
  12.     # 5 - clear the screen before drawing it again
  13.     screen.fill(0)
  14.     # 6 - draw the screen elements
  15.     screen.blit(player, (100,100))
  16.     # 7 - update the screen
  17.     pygame.display.flip()
  18.     # 8 - loop through the events
  19.     for event in pygame.event.get():
  20.         # check if the event is the X button
  21.         if event.type==pygame.QUIT:
  22.             # if it is quit the game
  23.             pygame.quit()
  24.             exit(0)
  25.             
  26. grass = pygame.image.load("D:\\llllllllllllllllllllllllllllllll\\kunkun\\kk2.jpg")
  27. castle = pygame.image.load("D:\\llllllllllllllllllllllllllllllll\\kunkun\\kk2.jpg")

  28. for x in range(width/grass.get_width()+1):
  29.     for y in range(height/grass.get_height()+1):
  30.         screen.blit(grass,(x*100,y*100))
  31. screen.blit(castle,(0,30))
  32. screen.blit(castle,(0,135))
  33. screen.blit(castle,(0,240))
  34. screen.blit(castle,(0,345 ))
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-4-26 21:33

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表