文件usables.py无法从“资源”导入名称“FountainOfYouthSprite”

2024-05-18 21:04:23 发布

您现在位置:Python中文网/ 问答频道 /正文

在修复了我的资源文件(其中保存了所有精灵和音乐数据)中类对象的问题后,突然很难将其数据导入到描述武器和物品功能的usables文件中

不仅如此,如果我从导入列表中删除FountainofYouthSprite,它会报告列表中的下一项,可选刻线也不存在

资源文件内容:

import pygame
from Animation import *
from FECD import char
pygame.init()
Selectable_Reticle = pygame.image.load("Images/Tiles/ITEMS AND SELECTABLES/Selectable Box.png").convert()
Recoverable_Reticle = pygame.image.load("Images/Tiles/ITEMS AND SELECTABLES/Selectable Recovery Box.png").convert()
Smoke_Reticle = pygame.image.load("Images/Tiles/ITEMS AND SELECTABLES/Smoke Box.png").convert_alpha()
Thunder_Reticle = pygame.image.load("Images/Tiles/ITEMS AND SELECTABLES/Thunder Box.png").convert()
FountainOfYouthSprite = pygame.image.load("Images/Tiles/ITEMS AND SELECTABLES/Fountain of youth.png").convert_alpha()

可用文件内容:

import pygame
import random
from resources import FountainOfYouthSprite, Selectable_Reticle, Recoverable_Reticle, Smoke_Reticle, Thunder_Reticle, CharUnderFog, PotionUseSound, ScrimitarClashSound
from Character import Character
from utils import blit_alpha

主要文件内容:

# all of the importing from different files
from math import sin, cos
from resources import *
from usables import *
from utils import *
from Map import *
from Menu import *
from InputManager import *
from Character import *

我希望游戏能够正常运行,或者为动画函数提供太多位置参数的消息,但现在这是一个不同的主题


Tags: and文件fromimageimportconvertpngload

热门问题