本文整理汇总了Python中Client.moveEntity方法的典型用法代码示例。如果您正苦于以下问题:Python Client.moveEntity方法的具体用法?Python Client.moveEntity怎么用?Python Client.moveEntity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Client
的用法示例。
在下文中一共展示了Client.moveEntity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: tick
# 需要导入模块: import Client [as 别名]
# 或者: from Client import moveEntity [as 别名]
def tick(self):
global x,y
super(Animal,self).tick()
xa = 0
ya = 0
self.centreX= self.x+31
self.centreY= self.y+63
xx = self.centreX >>5
yy = self.centreY >>5
if self.ticks%random.randint(1,100)==0:
xa = random.randint(-4,4)
else:
xa = 0
if xa != 0 or ya != 0:
self.isMoving = not self.move(xa, ya)
if Client.isHost == True and gui.isMultiplayer==True:
Client.moveEntity(self.id,self.x,self.y,self.movingDir,self.isSwimming)
else:
self.isMoving = False
if self.getTileUnder().getId() == Tile.water.getId():
self.isSwimming = True
else:
self.isSwimming = False
示例2: tick
# 需要导入模块: import Client [as 别名]
# 或者: from Client import moveEntity [as 别名]
def tick(self):
global x,y
super(Animal.Animal,self).tick()
self.breedCoolDown -=1
self.deathTimer -=1
if self.deathTimer <0:self.die()
self.centreX= self.x+16
self.centreY= self.y+16
xx = self.centreX >>5
yy = self.centreY >>5
if self.entityCollidedWith != None:
try:self.mate(self.level,self.entityCollidedWith)
except:print "That can't mate with a duck!"
#print self,self.entityCollidedWith
self.entityCollidedWith = None
if self.ticks%random.randint(1,500)==0:
self.xa = random.randint(-1,1)
self.ya = random.randint(-1,1)
if self.xa != 0 or self.ya != 0:
self.isMoving = not self.move(self.xa,self.ya)
if Client.isHost == True and gui.isMultiplayer == True:
Client.moveEntity(self.id,self.x,self.y,self.movingDir,self.isSwimming)
else:
self.isMoving = False
if self.getTileUnder().getId() == Tile.water.getId():
self.isSwimming = True
else:
self.isSwimming = False