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


Python Map.render方法代码示例

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


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

示例1: Game

# 需要导入模块: from Map import Map [as 别名]
# 或者: from Map.Map import render [as 别名]
class Game(object):

    def __init__(self):
        self.TITLE = "TEST (by zeeisl)"
        self.WIDTH = 800
        self.HEIGHT = 600
        
        self.controller = Controller()
        
        # game things
        self.char = Player("res//hero.png")
        self.map = Map()
        
        self.char1 = Character("res//hero.png", 100, 100, 32, 32)
        
    def key_input(self, event):
        self.controller.getButtonStates(event)
        self.char.key_input(event)
    
    def update(self, delta):
        self.map.update()
        self.char.update(self.char1)
        self.char1.update()
    
    def render(self, screen):
        self.map.render(screen)
        self.char.render(screen)
        self.char1.render(screen)
开发者ID:gia2api,项目名称:froscon,代码行数:30,代码来源:Game.py

示例2: Tile

# 需要导入模块: from Map import Map [as 别名]
# 或者: from Map.Map import render [as 别名]
		if x == 5:
			tile = Tile('Floor', t1)
		elif x % 3 == 0:
			if y % 3 == 0:
				tile = Tile('Wall', t2)
			else:
				tile = Tile('Floor', t1)
		else:
			if y % 3 == 2:
				tile = Tile('Wall', t2)
			else:
				tile = Tile('Floor', t1)
		
		map.addOrReplaceTile(tile, x, y)
		#print("Tile of type: %s with Coords vert: %d, Hori: %d\n" % (tile.type, x, y))
map.render(screen, character)

while True:
	for event in pygame.event.get():
		if event.type == pygame.QUIT:
			pygame.quit()
			sys.exit()
		if event.type == pygame.KEYDOWN:
			if event.key == pygame.K_LEFT:
				if character.h_loc != 0 and map.tiles[character.v_loc][character.h_loc - 1].type != "Wall":
					character.h_loc -= 1
			if event.key == pygame.K_RIGHT:
				if character.h_loc != (grid_size-1) and map.tiles[character.v_loc][character.h_loc + 1].type != "Wall":
					character.h_loc += 1
			if event.key == pygame.K_UP:
				if character.v_loc != 0 and map.tiles[character.v_loc - 1][character.h_loc].type != "Wall":
开发者ID:jbrick,项目名称:Unrealistic_Engine,代码行数:33,代码来源:testapp.py

示例3: Object

# 需要导入模块: from Map import Map [as 别名]
# 或者: from Map.Map import render [as 别名]
    if key.vk == libtcod.KEY_ENTER and key.lalt:
        # Alt+Enter: toggle fullscreen
        libtcod.console_set_fullscreen(not libtcod.console_is_fullscreen())

    elif key.vk == libtcod.KEY_ESCAPE:
        return True

player = Object(con.SCREEN_WIDTH/2, con.SCREEN_HEIGHT/2, '@', libtcod.white)
npc = Object(con.SCREEN_WIDTH/2 - 5, con.SCREEN_HEIGHT/2, '@', libtcod.yellow)
Objects = [npc, player]
Mapdata = Map(133, 66)
Mapdata.load('test.txt')

while not libtcod.console_is_window_closed():

    Mapdata.render(con)    
    con.blit()
    for obj in Objects:
        con.draw(obj)
    con.blit()

    for obj in Objects:
        con.clear(obj)

    libtcod.console_flush()
    exit = handle_keys()
    if exit:
        break


开发者ID:MatrixNymph,项目名称:Prisoner,代码行数:30,代码来源:firstrl.py


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