在pygame中按下鼠标时制作精灵更改图像

问题描述

我怎样才能让一个精灵在按下鼠标一小会儿改变它的图像,然后在 pygame 中恢复正常?我尝试制作一个点击函数,尝试在短时间内改变图像。

这是那个函数

import requests

url = "https://app.dnbhoovers.com/api/auth/login-details"
data = {"username": "email@email.com"}
headers = {"Content-Type": "application/json"}

response = requests.post(url,data = data,headers=headers) 

print(response.json())

这是来电者:

def hit(self,hit_img):
    self.image = hit_img
    for i in range(300):
        self.update()

这是武器类的 eq 函数

if pygame.mouse.get_pressed():
    if weapon == "axe.png":
        weapon.hit("axe_hit.png")

但这没有用。我该怎么办?

编辑:所以把[两个下划线]eq[两个下划线]变成了eq

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)