本文整理汇总了Python中map.Map.getMap方法的典型用法代码示例。如果您正苦于以下问题:Python Map.getMap方法的具体用法?Python Map.getMap怎么用?Python Map.getMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类map.Map
的用法示例。
在下文中一共展示了Map.getMap方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from map import Map [as 别名]
# 或者: from map.Map import getMap [as 别名]
def __init__(self, view):
self.player1 = None
self.map = None
self.map = RpgMap.getMap()
self.map.view = view
self.map.changeMap('map_01', 3, 3)
self.player1 = Player.getPlayer1()
self.player1.init('p1', self.map.bufViewMap)
self.player1.xMax = self.map.mapWPix
self.player1.yMax = self.map.mapHPix
Rpg.map = self.map
Rpg.player1 = self.player1
示例2: Level
# 需要导入模块: from map import Map [as 别名]
# 或者: from map.Map import getMap [as 别名]
class Level(Completable, Inputable):
def __init__(self, surface, level, **kwargs):
super().__init__(**kwargs)
self._surface = surface
self.map = Map(level[0], level[1])
def start(self):
self.map.load()
self._entity_map = {}
self._position_map = {}
self._entities = {}
self._registered = {}
self._enemySpawns = {}
for x, y in self.map.getMap().keys():
self._position_map[(x, y)] = []
self._total_surface = Surface((self.map.w, self.map.h))
tid = self.addEntity(register=True,
entity=MChar(self,
self.map.getType(Tiles.Start)[0],
inputStream=self.getInputStream()))
self._camera = Viewport(tuple([s * const.res for s in const.screenSize]),
lambda: self.map.getAttr("scale"),
self.get(tid),
(150, 200, 150, 200),
self.map)
self._background = Parallax(const.backgrounds)
self.editor = Editor(self.map,
self._surface,
enabled=False,
inputStream=self.getInputStream())
self._input = Input(inputStream=self.getInputStream())
self._input.set(KEYDOWN, self.editor.toggleEnabled, K_e)
self._input.set(KEYDOWN, self.start, K_r)
# self._sound = Sound("assets\\music.ogg")
# self._sound.play(-1)
try:
self._healthBar = HealthBar(10, 10, self.get(tid))
except AssertionError:
pass
for (x, y), val in self.map.enemies.items():
block = self.map.get(x, y)
self._enemySpawns[block] = EnemySpawn(level=self,
anchor=Object(pos=(block.x, block.y)),
maxEmitted=val,
timeBetween=2)
self._countdown = CountdownTimer(const.screenSize[0] * const.res - 50, 10,
self.map.getAttr("timeLim"))
def addEntity(self, register=False, entity=None):
if not entity:
raise Exception("Entity must not be None.")
tid = entity.getId()
self._entities[tid] = entity
if register:
self._registered[tid] = entity
self._entity_map[tid] = set()
return tid
def removeEntity(self, entity):
del self._entities[entity.id]
def get(self, entityId):
return self._entities.get(entityId)
def process(self):
for entity in self._entities.values():
result = entity.tick()
if not entity.isAlive():
self._entities.pop(entity.getId())
# This should generally only apply to playable characters.
if entity in self._registered.values():
if Tiles.End in result.keys():
self.setFinished()
if not entity.isAlive():
self.setLost()
for s in self._enemySpawns.values():
s.tick()
self._camera.tick()
self._countdown.tick()
if self._countdown.isFinished():
self.setLost()
if self.editor.enabled():
self.editor.tick(self._camera)
if self.isComplete():
pass
#.........这里部分代码省略.........