问题遇到的现象和发生背景
今天我想做一个快乐小鸡的游戏,等鸡下完蛋后过一定时间就会付出小鸡,于是用了一个for循环,先记录下单时间,在一定时间范围内将不孵化,但是一直显示不出
问题相关代码,请勿粘贴截图
import sys
import pygame
from pygame.locals import *
pygame.init()
screen = pygame.display.set_mode((1000, 600), 0, 32)
pygame.display.set_caption("快♂乐♂shit♂鸡")
chick = pygame.image.load("HappyChick/photos/chick.bmp")
chick = pygame.transform.smoothscale(chick, (100, 100))
background = pygame.image.load("HappyChick/photos/background.png")
background = pygame.transform.smoothscale(background, (1000, 600))
egg = pygame.image.load("HappyChick/photos/egg.bmp")
egg = pygame.transform.smoothscale(egg, (60, 60))
x_chick = 450
y_chick = 250
egg_list = []
appear = False
i = 0
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
if event.type == pygame.MOUSEBUTTONDOWN:
x_chick, y_chick = pygame.mouse.get_pos()
x_chick, y_chick = x_chick-50, y_chick-50
egg_list.append(i)
for j in egg_list:
if i >= j and j <= i + 200:
screen.blit(egg, (12,123))
screen.blit(background, (0, 0))
screen.blit(chick, (x_chick, y_chick))
pygame.display.update()
i = i+1