用python怎么说?

2024-09-26 18:14:22 发布

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

我正试图为我的科学俱乐部的一个游戏建立一个法师,我想说“如果没有火或地法师(以“火”和“地”为代表),没有人可以从中吸取生命(以“吸收目标”为代表)攻击第一个敌人。”用python怎么说? 谢谢你的帮助! 编辑:我想做一个“如果”的陈述。对不起,我是一个新的编码,所以我真的不知道包括什么细节,使一个适当的问题。我使用一种叫做“喷水”的咒语来攻击。当代码检查敌人的生命值低于某一生命值,而我的生命值高于某一生命值时,吸收目标的索引将被添加到索引中。你知道吗


Tags: 代码游戏编辑目标编码代表科学细节
2条回答

我想。。。根据你所说的,你可以。。。你知道吗

if ((Fire != True) or (Earth != True)) and absorb_target_index != True:
    DoSomething()

但是如果你不知道你想要什么,那就对我很有帮助了?你知道吗

假设你这样做。。。你知道吗

Fire = []
Earth = []
absorb_target_index = []
#you have another function which populates these lists with the names of Earth and Fire mages, you would then do
if len(Fire) == 0 and len(Earth) == 0 and len(absorb_target_index) == 0:
    Attack()

正如评论所说,你的问题太模糊了。你的游戏如何定义“攻击”敌人?其他法师是如何被识别的?“吸收目标指数”的值从何而来?你知道吗

相关问题 更多 >

    热门问题