Example #1
0
def ShowMap():
    """Рисует карту."""
    curmap = GameMap[CurMap]
    Lowlevel.PrepareMap()
    for x in xrange(curmap.LocalMapLeft,
                    curmap.LocalMapLeft + Const.LOCAL_MAP_WIDTH + 1):
        for y in xrange(curmap.LocalMapTop,
                        curmap.LocalMapTop + Const.LOCAL_MAP_HEIGHT + 1):
            Lowlevel.ShowCell(curmap.Cells[x][y], x, y)
    # Хак.
    Monsters.ShowMonsters()
    Hero.ShowHero(Hero.CurHero)
    Lowlevel.main()
Example #2
0
def  ShowMap():
	"""Рисует карту."""
	curmap = GameMap[CurMap]
	Lowlevel.PrepareMap()
	for x in xrange(
	    curmap.LocalMapLeft,
	    curmap.LocalMapLeft + Const.LOCAL_MAP_WIDTH + 1):
		for y in xrange(curmap.LocalMapTop,
		                curmap.LocalMapTop + Const.LOCAL_MAP_HEIGHT + 1):
			Lowlevel.ShowCell(curmap.Cells[x][y], x, y)
	# Хак.
	Monsters.ShowMonsters()
	Hero.ShowHero(Hero.CurHero)
	Lowlevel.main()
Example #3
0
def SetHeroVisible(HeroNum):
    hero = Heroes[HeroNum]
    curmap = Map.GameMap[Map.CurMap]
    for x in xrange(hero.x - hero.VisLong, hero.x + hero.VisLong + 1):
        for y in xrange(hero.y - hero.VisLong, hero.y + hero.VisLong + 1):
            curmap.Cells[x][y].IsVisible = True
            Lowlevel.ShowCell(curmap.Cells[x][y], x, y)
Example #4
0
def MoveHero(dx, dy):
    hero = Hero.Heroes[Hero.CurHero]
    curmap = Map.GameMap[Map.CurMap]
    if not Map.FreeTile(curmap.Cells[hero.x + dx][hero.y + dy].Tile):
        return
    x, y = hero.x, hero.y
    hero.x += dx
    hero.y += dy
    Hero.SetHeroVisible(Hero.CurHero)
    Hero.CleaningUp(x, y)
    Monsters.ShowMonsters()
    Hero.ShowHero(Hero.CurHero)
    if (abs(hero.x - curmap.LocalMapLeft) < Map.SCROLL_DELTA) or \
       (abs(hero.y - curmap.LocalMapTop) < Map.SCROLL_DELTA) or \
       (abs(hero.x - (curmap.LocalMapLeft + Const.LOCAL_MAP_WIDTH)) < Map.SCROLL_DELTA) or \
       (abs(hero.y - (curmap.LocalMapTop + Const.LOCAL_MAP_HEIGHT)) < Map.SCROLL_DELTA):
        Map.ScrollMap()
    Lowlevel.ShowHeroInfo(Hero.CurHero)
Example #5
0
def CleaningUp(x, y):
    Lowlevel.CleaningUp(x, y)
Example #6
0
def ShowHero(HeroNum):
    hero = Heroes[HeroNum]
    x, y = (Const.WINDOW_LEFT + hero.x, Const.WINDOW_TOP + hero.y)
    Lowlevel.ChangeTileSourceWithSavingPrevious(x, y,
                                                './resource/img/hero.png')
Example #7
0
def ShowGame():
    Lowlevel.ShowHeroInfo(Hero.CurHero)
    Map.ShowMap()
Example #8
0
def main():
    Lowlevel.VideoInitialize()
    Map.MapGeneration(1)
    Monsters.GenerateMonsters(Map.CurMap)
    Hero.InitHeroes()
    Game.ShowGame()
Example #9
0
def ShowMonsters():
	"""Сканирует список монстров, определяет, какие из живых созданий находятся
	  в видимой части окна, и выводит их на экран."""
	for mns in Monsters:
		if (mns.HP > 0) and Map.VisiblePoint(mns.x, mns.y):
			Lowlevel.ShowMonster(mns)