当前位置: 首页>>代码示例>>Python>>正文


Python Monster.move方法代码示例

本文整理汇总了Python中monster.Monster.move方法的典型用法代码示例。如果您正苦于以下问题:Python Monster.move方法的具体用法?Python Monster.move怎么用?Python Monster.move使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在monster.Monster的用法示例。


在下文中一共展示了Monster.move方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: range

# 需要导入模块: from monster import Monster [as 别名]
# 或者: from monster.Monster import move [as 别名]
			while p_go == False:
				for i in range(3):
					for j in range(3):
						if [i, j] == player.getPos():
							print('*', end="")
							if j != 2:
								print('|', end="")
						else:
							print(' ', end="")
							if j != 2:
								print('|', end="")
					print()
					if i != 2:
						print('_ _ _')
				print('Where do you want to go?(Up:u, Down:d, Left:l, Right:r)')
				key_value = sys.stdin.readline().strip('\n')
				p_go = player.move(key_value)
				if player.getPos() == monster.getPos():
					success = True
					print('You enconter a monster and dead. Game over!')
				if player.getPos() == exit.getPos():
					success = True
					print('Congrats, you leave the maze!')
		elif wh_idx % 2 == 1:
			m_go = False
			while m_go == False:
				m_go = monster.move(random.choice(['u','d','l','r']), exit.getPos())
				if monster.getPos() == player.getPos():
					success = True
					print('You enconter a monster and dead. Game over!')
		wh_idx = wh_idx + 1
开发者ID:wayne31623,项目名称:Orientation-Github-Python-HW,代码行数:33,代码来源:main.py

示例2: and

# 需要导入模块: from monster import Monster [as 别名]
# 或者: from monster.Monster import move [as 别名]
                key_monitor.key_up(event)

        # Game loop
        if game.started() and (time.time()*1000.0)-last_time > FRAME_TIME:
            last_time = time.time()*1000.0
            game.tick()
            key_monitor.tick()

            witch.update()
            zombie.update()
            monster.update()
            skeleton.update()

            witch.move(SPEED)
            zombie.move(SPEED)
            monster.move(SPEED)
            skeleton.move(SPEED)

            screen.fill(black)

            game.check_piece([witch,zombie,monster,skeleton], key_monitor)

            game.draw_background(screen)

            screen.blit(witch.get_image(), witch.get_rect())
            screen.blit(zombie.get_image(), zombie.get_rect())
            screen.blit(monster.get_image(), monster.get_rect())
            screen.blit(skeleton.get_image(), skeleton.get_rect())

            pygame.display.flip()
        elif not game.started():
开发者ID:filtoid,项目名称:PumpkinHero,代码行数:33,代码来源:main.py


注:本文中的monster.Monster.move方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。