本文整理汇总了Python中Character.Character.enterNewRoom方法的典型用法代码示例。如果您正苦于以下问题:Python Character.enterNewRoom方法的具体用法?Python Character.enterNewRoom怎么用?Python Character.enterNewRoom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Character.Character
的用法示例。
在下文中一共展示了Character.enterNewRoom方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Model
# 需要导入模块: from Character import Character [as 别名]
# 或者: from Character.Character import enterNewRoom [as 别名]
#.........这里部分代码省略.........
theta = atan(yDistance / xDistance)
if theta < 0:
theta += 2 * pi
if xDistance < 0 and yDistance > 0:
theta += -pi
elif xDistance < 0 and yDistance < 0:
theta += pi
elif yDistance > 0 and xDistance != 0:
theta = pi / 2
elif yDistance < 0 and xDistance != 0:
theta = 3 * pi / 2
else:
theta = None
if theta and distance > 0:
actor.collideAngle = theta * 180 / pi
actor.check_collisions()
for projectile in actor.projectiles:
for collision in rabbyt.collisions.collide_single(projectile, self.spritesOnScreen):
if collision.viewable:
if collision != actor:
if projectile in actor.projectiles:
actor.projectiles.remove(projectile)
if isinstance(collision, Character) or isinstance(collision, Enemy) and collision is not actor:
collision.health -= actor.damage + \
actor.day ** 1.25
def change_room(self):
if self.player.newRoom == "up":
if self.roomCoordinate[1] > -self.mapSizeY / 2:
self.roomCoordinate = (
self.roomCoordinate[0], self.roomCoordinate[1] - 1)
self.player.enterNewRoom()
self.newRoom = True
elif self.player.newRoom == "down":
if self.roomCoordinate[1] < self.mapSizeY / 2:
self.roomCoordinate = (
self.roomCoordinate[0], self.roomCoordinate[1] + 1)
self.player.enterNewRoom()
self.newRoom = True
elif self.player.newRoom == "right":
if self.roomCoordinate[0] < self.mapSizeX / 2:
self.roomCoordinate = (
self.roomCoordinate[0] + 1, self.roomCoordinate[1])
self.player.enterNewRoom()
self.newRoom = True
elif self.player.newRoom == "left":
if self.roomCoordinate[0] > -self.mapSizeX / 2:
self.roomCoordinate = (
self.roomCoordinate[0] - 1, self.roomCoordinate[1])
self.player.enterNewRoom()
self.newRoom = True
if self.newRoom:
self.room = self.map[self.roomCoordinate]
self.spritesOnScreen = self.room.roomItems
if self.player not in self.spritesOnScreen:
self.spritesOnScreen.append(self.player)
self.actorsOnScreen = self.room.enemies
self.actorsOnScreen.append(self.player)
self.newRoom = False
self.notificationSystem.update_coordinates(
str(self.roomCoordinate))
def return_crew(self):