本文整理汇总了Python中Avatar.Avatar.setPosition方法的典型用法代码示例。如果您正苦于以下问题:Python Avatar.setPosition方法的具体用法?Python Avatar.setPosition怎么用?Python Avatar.setPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Avatar.Avatar
的用法示例。
在下文中一共展示了Avatar.setPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: BotWrapper
# 需要导入模块: from Avatar import Avatar [as 别名]
# 或者: from Avatar.Avatar import setPosition [as 别名]
class BotWrapper(object):
"""Provides access to user bot methods and keeps meta-data for user bots"""
def __init__(self,plyr,parent=None):
#Bot __init__ is given starthealth, parent class
self.bot = __import__(plyr).Bot(parent.STARTHEALTH,self)
self.name = self.bot.getName()
self.imagesDict = self.bot.getImages()
self.parent = parent
self.VERSION = self.parent.VERSION
self.botmodifiers = BotModifiers(self.name)
self.botstats = BotStats(self.name,self.botmodifiers)
self.__position = [0,0]
self.__ids = [0,0,0,0,0]
self.resetStats()
self.avatar = Avatar(self.name,self.__position,self.imagesDict)
#def addEnemy(self,enemy):
# self.bot.addEnemy(enemy)
def addPoints(self,n):
self.botstats.add("points",n)
#args: Damage object
#Return: integer health
def adjustHealth(self,damage):
return self.bot.adjustHealth(damage)
#args: string command
#Return: none
#executes user inputted commands
def command(self,command):
print "COMMAND: ",command," , made it to the botwrapper of: ",self.name
self.bot.command(command)
#args integer round number
#Return: none
def endRound(self,roundnumber):
self.bot.endRound(roundnumber)
if self.bot.getHealth() <= 0:
self.__stance = "OUT!!"
#args: none
#return: none
def endGame(self):
self.botstats.endgame()
mod = self.botstats.getNextModifier()
while mod:
self.botmodifiers.adjustModifier(*mod)
mod = self.botstats.getNextModifier()
def getAvatar(self):
self.avatar.stance = self.getStance()
self.avatar.setPosition(self.__position)
self.avatar.health = self.getHealth()
self.avatar.enemies = self.getEnemies()
self.avatar.modifiers = self.botmodifiers.getModifiers(True)
try:
self.avatar.color = self.bot.getColor()
except AttributeError:
self.avatar.color = (255,255,255)
return copy.copy(self.avatar)
#args: none
#Return: list of enemies' names
def getEnemies(self):
return self.bot.getEnemies()
#args: none
#Return: integer health
def getHealth(self):
return self.bot.getHealth()
def getIds(self):
return self.__ids
#args: none
#Return: float angle to look
def getLookDirection(self):
return self.bot.getLookDirection()
def getModifier(self,name):
return self.botmodifiers.getModifier(name)
def getMoveDirection(self):
return self.bot.getMoveDirection()
#args: none
#Return: string name
def getName(self):
return self.name
def getPosition(self):
return self.__position
#args: none
#Return: Stance object
def getStance(self):
if self.__stance:
#.........这里部分代码省略.........