def __init__(self, load=None, pos=None): pygame.sprite.Sprite.__init__(self) #call Sprite intializer self.dir = 'down' self.armorClass = 0 self.weaponClass = 0 #self.weaponEquipped = None #self.armorEquipped = [None,None,None] self.hasLantern = False self.installLoadedHero(load) if pos is not None: (self.X, self.Y) = pos if self.gender == 'male': self.images = images.mHeroImages else: self.images = images.fHeroImages self.imgIdx = 2 self.image = self.images[self.imgIdx] self.rect = (const.blocksize, const.blocksize, const.blocksize, const.blocksize) if self.weaponEquipped == None: self.gainWeapon(const.WSWORD) self.equipWeapon(self.weapons[0]) if self.spells == []: self.learnSpell(0) self.step = False self.moving = False self.stepIdx = 0 self.moveQueue = queue.Queue()
def __init__(self, mapball=None, level=0): generalmap.__init__(self) self.level = level self.BFSQueue = queue.Queue() self.newNPCs = [] if mapball is not None: self.installBall(mapball) for i in range(self.DIM): for j in range(self.DIM): if self.grid[i][j] is not None: if self.type in const.darkMaps: if (i, j) not in self.visDict: self.visDict[(i, j)] = False self.grid[i][j].visible = False else: self.visDict[(i, j)] = True self.grid[i][j].visible = True if self.heroStart is not None: self.playerXY = self.heroStart else: self.playerXY = self.getPOE() self.topMapCorner = (0, 0) self.myMiniMap = minimap.miniMap(self.grid) self.litTiles = []
def __init__(self, DIM, level, name): generalmap.__init__(self, DIM, const.VOID) self.level = level self.BFSQueue = queue.Queue() for i in range(self.DIM): self.grid += [range(self.DIM)] for j in range(self.DIM): self.grid[i][j] = tile.Tile(i, j, const.VOID, const.VOID) self.setName(name)
def __init__(self, x, y, message, imgFile, name=''): self.start = (x, y) self.X = x self.Y = y self.images = images.loadNPC(imgFile) pygame.sprite.Sprite.__init__(self) #call Sprite intializer self.imgIdx = 2 self.stepIdx = 0 self.image = self.images[self.imgIdx] self.dir = 'down' self.moving = False self.message = message self.setRect(x * const.blocksize, y * const.blocksize, const.blocksize, const.blocksize) self.movingRate = 20 self.moveQueue = queue.Queue() self.name = name
def __init__(self, cPos): self.cursorPos = cPos self.currentTile = 0 self.sideImg, sideRect = load_image.load_image('sidebar.bmp') self.npcImg = pygame.Surface((30, 30)) self.npcImg.fill(colors.red) #self.npcImg, npcR = load_image('npc.bmp') self.drawMode = False self.cursorColor = colors.white self.offset = 0 self.numImages = len(mapImages) self.topX = 0 self.topY = 0 self.visited = [] self.BFSQueue = queue.Queue() self.mouseAction = 'draw' self.selecting = False self.selectBoxPoints = None self.placeNPC = False
def __init__(self, cPos): self.cursorPos = cPos self.currentTile = 0 self.sideImg, sideRect = load_image.load_image('sidebar.bmp') self.npcImg = {} npcAvatar = pygame.Surface((const.blocksize, const.blocksize)) for n in npcScr.npcList: npcImgFilename = n + '.bmp' npcImgs = images.loadNPC(npcImgFilename) self.npcImg[n] = npcImgs[2] #self.npcImg, npcR = load_image('npc.bmp') self.drawMode = False self.cursorColor = colors.white self.offset = 0 self.numImages = len(mapImages) self.topX = 0 self.topY = 0 self.visited = [] self.BFSQueue = queue.Queue() self.mouseAction = 'draw' self.drawLayers = ['fore', 'back'] self.drawLayer = self.drawLayers[0] self.selecting = False self.selectBoxPoints = None self.placeNPC = False self.myMap = myWorld.currentMap self.editorImages = range(7) editorSpriteSheet = spritesheet.spritesheet('editorsheet.bmp') for i in range(7): self.editorImages[i] = editorSpriteSheet.image_at( (i * const.blocksize, 0, const.blocksize, const.blocksize), -1)