我有一个滚动背景游戏,您可以在角色在屏幕上移动时对其进行控制(例如Mario)。我如何做到这一点,以便如果角色在地面上撞到某些东西(例如尖峰),它会开始闪烁?
答案 0 :(得分:1)
做类似的事情
from bs4 import BeautifulSoup
import requests
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT x.y; Win64; x64; rv:10.0) Gecko/20100101 Firefox/10.0 '}
url = "https://www.pixiv.net/en/users/14792128"
response = requests.get(url,headers=headers)
soup = BeautifulSoup(response.text, 'lxml')
print(soup.prettify())
#in chr initial
self.deathloop = 0
或者无论如何#in loop (if you have a update function specific for chr)
if self.death == True:
if self.deathloop < 30:
blit
elif self.deathloop < 60:
pass
else:
deathloop = 0
deathloop +=1
持续一定时间,然后blit
停止同样的时间,因此它在blit
时可见,而在{{1}以外时不可见}}。