猫史档案馆


【Python作品分享】L_10加载一张图

用户:哈利·波特OEV3哈利·波特OEV3查看:0 回复:0 评论:0 创建时间:2022-05-08T19:36:12


【作品展示】

center_image

 

【作品介绍】

k

 

【作品源代码】

import pygame,time
from pygame.locals import *
pygame.init() 
screen = pygame.display.set_mode((800, 600))
horse=pygame.image.load("1.png")
horse=pygame.image.load("2.png")
bj=pygame.image.load("pk.png")
horselist=[]
for i in range(4):
    horse=pygame.image.load(str(i+1)+'.png')
    horselist.append(horse)
gk=1
x=800
for i in range(1000):
    screen.fill((0, 0, 0))
    time.sleep(0.1)
    if gk==4:
        gk=1
    else:
        gk=gk+1
    screen.blit(bj, (0,0))
    screen.blit(horselist[gk-1], (x,240))
    if x == -55:
        x = 800
    else:
        x=x-15
    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
        if event.type == KEYDOWN:
            pass
    pygame.display.update()

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页