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


Python Arena.update方法代码示例

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


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

示例1: main_loop

# 需要导入模块: from arena import Arena [as 别名]
# 或者: from arena.Arena import update [as 别名]
def main_loop():
	screen = get_screen(SCREEN_WIDTH, SCREEN_HEIGHT)

	arena = Arena(screen)

	arena.make(Ship, position=(5,5))
	arena.make(Ship, position=(2,2))
	arena.make(Ship, position=(2,8))
	arena.make(Ship, position=(8,2))
	arena.make(Ship, position=(8,8))
	arena.make(Bullet)

	space = Spacilizer(arena.view)

	playing = True
	isPaused = True
	currentTime = get_ticks()
	while playing:

		previousTime = currentTime
		currentTime = get_ticks()
		deltaTime = currentTime - previousTime

		for event in events.get():
			if event.type == QUIT:
				playing = False

			elif event.type is KEYDOWN:
				if event.key is pygame.K_SPACE:
					isPaused = not isPaused
				elif event.key is pygame.K_RETURN:
					arena.focus_on_next_ship()

		arena.update(deltaTime)

		start_frame(screen)
		space.draw()
		for entity in arena.entities:
			entity.draw()
		finish_frame(screen)

		elapsedTime = get_ticks() - currentTime
		if elapsedTime < IDEAL_FRAME_TIME:
			wait(IDEAL_FRAME_TIME - elapsedTime)	
开发者ID:Beyamor,项目名称:sapce,代码行数:46,代码来源:main.py

示例2: Battle

# 需要导入模块: from arena import Arena [as 别名]
# 或者: from arena.Arena import update [as 别名]
class Battle(object):

    def __init__(self):

        # Initialize arena
        self.arena = Arena()

        # Initialize other bookkeeping variables
        self.total_elapsed = 0

    """
    Called once per game tick
    Updates arena
    """
    def update(self, events, elapsed):
        self.arena.update(events, elapsed)
        self.total_elapsed += elapsed

    """
    Called once per frame
    Draws the arena
    """
    def draw(self, screen):
        return self.arena.draw(screen)
开发者ID:uclaacm,项目名称:ai-combat,代码行数:26,代码来源:battle.py

示例3: open

# 需要导入模块: from arena import Arena [as 别名]
# 或者: from arena.Arena import update [as 别名]
        if not os.path.exists(filename):
            break
        
        try:
            fil = open(filename, 'r')
            buf = ""
            while True:
                line = fil.readline()
                if line == "":
                    break
                buf += line
            fil.close()
        
        except IOError as err:
            print "Error: reading file failed"
            exit(1)
    
        if i == 1:
            #buf = con.read() # read arena
            arena = Arena(buf)
            sched = Scheduler(arena, connector.DummyConnector())
            
            #while True:

        else:
            #buf = con.read()
            
            arena.update(buf)
            
        sched.update()
开发者ID:basman,项目名称:atc_bot,代码行数:32,代码来源:bot_live_tester.py


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