Commit 2b086610 by BellCodeEditor

auto save

parent 98582dab
Showing with 22 additions and 16 deletions
apple.png

2.05 KB

bg.png

22.5 KB

# 古代测量臂力是靠不同重量的石锁,只能测整数哦。 import pygame
# 最小的石锁是30公斤最大的石锁是100公斤,注意输入的数字哦。 from pygame import locals
# 请优化刚刚的代码,并增添交互效果,和自动输出最强三人信息的功能~ pygame.init()
screen = pygame.display.set_mode((660,480))
# 问询处 background = pygame.image.load('bg.png')
name=input('你叫啥名') food = pygame.image.load('apple.png')
power=int(input()) banana = pygame.image.load('xigua.png')
# 归档处 while True:
hero=['赵一',30,'丁二',37,'孙五',52,'王猛',89,'周亮',98,'张宇',100] for event in pygame.event.get():
for i in range(len(hero)): if event.type == locals.QUIT:
if 1%2==1 and hero[i]>=power: #接收到退出事件后退出程序
hero.insert(i-1,name) exit()
hero.insert(i-1,power) #将背景图画上去
screen.blit(background,(0,0))
#将果实画上去
# 打印出臂力最强的三个人和他们对应的臂力值: screen.blit(food,(0,0))
screen.blit(food,(0,450))
screen.blit(food,(630,0))
screen.blit(food,(630,450))
screen.blit(banana,(220,150))
#
pygame.display.update()
xigua.png

51.4 KB

Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment