本文整理汇总了Python中Units.drawEnemyPic方法的典型用法代码示例。如果您正苦于以下问题:Python Units.drawEnemyPic方法的具体用法?Python Units.drawEnemyPic怎么用?Python Units.drawEnemyPic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Units
的用法示例。
在下文中一共展示了Units.drawEnemyPic方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: drawHUD
# 需要导入模块: import Units [as 别名]
# 或者: from Units import drawEnemyPic [as 别名]
def drawHUD(self, unitOn, camera):
HEALTHSIZE = 100
unit = PTRS["UNITS"].alliedUnits[unitOn]
if unit:
if unit.getTargetHealth() > 0 or unit.getHealth() > 0:
healthBarRect = [[10, camera.Height() - 20], [HEALTHSIZE, 12]]
expBarRect = [[10, camera.Height() - 40], [HEALTHSIZE, 12]]
self.drawStatusBar(unit, camera, unit.getHealth(), unit.getTargetHealth(), unit.getMaxHealth(), healthBarRect,
[255, 0, 0], [0, 255, 0], [155, 0, 0])
self.drawStatusBar(unit, camera, unit.guilds.getActiveGuild().experience, unit.guilds.getActiveGuild().targetExperience,
unit.guilds.getActiveGuild().getExperienceRequirement(), expBarRect,
EXPERIENCECOLOUR, DARKEXPERIENCECOLOUR, [255, 255, 255])
for i in range(ABILITYSLOTS):
abil = unit.getSelectedAbil(i)
if abil:
icon = abil.icon
if i == unit.selectedAbil:
frameIcon = "SelectedFrame"
else:
frameIcon = "BattleFrame"
pos = (5 + i * 45, 5)
if abil.cooldown[0] > 0:
drawAbilIcon(camera.getSurface(), pos, icon, frameIcon, abil.cooldown[0] / float(abil.cooldown[1]))
else:
drawAbilIcon(camera.getSurface(), pos, icon, frameIcon)
if unit.lastHitTargets:
on = len(unit.lastHitTargets)
done = 0
for u in unit.lastHitTargets:
if not u.isTrainingDummy():
pos = [camera.Width() - HEALTHSIZE - 10, camera.Height() - 20 - done * 15]
hPct = u.getHealth() / float(u.getMaxHealth())
hAmt = min(max(int(HEALTHSIZE * hPct), 1), HEALTHSIZE)
clr = [150, 0, 0]
if u == unit.target:
clr = [255, 0, 0]
pygame.draw.rect(camera.getSurface(), clr, [pos, [hAmt, 10]]) #Bright red health
pygame.draw.rect(camera.getSurface(), [255] * 3, [pos, [HEALTHSIZE, 10]], 1)
if unit.team == 1:
Units.drawEnemyPic(camera.getSurface(), u.picture, [pos[0] - 15, pos[1]], int(u.animationFrames[int(u.frame)]))
on -= 1
done += 1
if done > 5:
break