Beispiel #1
0
 def updateDisplay(self, screen, step):
     if step == 'stats':
         self.displayField, r = load_image.load_image(os.path.join('MENU', "createBox.png") )
         self.calculateStats()
         self.displayField, self.displayField.copy
         self.displayStat( str(self.HP), (146,65) )
         self.displayStat( str(self.MP), (197,65) )
         self.displayStat( str(self.str), (150,102) )
         self.displayStat( str(self.itl), (202,102) )
         self.displayStat( str(self.dex), (247,102) )
         for s in self.sliders:
             if s.sliding:
                 self.displayField.blit(self.images[1], (s.getXLoc(), s.getYLoc()+(s.getValue()*10)) )
             else: self.displayField.blit(self.images[0], (s.getXLoc(), s.getYLoc()+(s.getValue()*10)) )
         if self.sliders[2].getValue() == 0:
             self.gender = 'male'
             self.displayField.blit(images.mHeroImages[8], (40 , 59))
         else:
             self.gender = 'female'
             self.displayField.blit(images.fHeroImages[8], (40 , 59))
         
         if self.sliders[3].getValue() == 0:
             self.faith = 'xtian'
             self.displayField.blit(images.mapImages[246], (40 , 134))
         else:
             self.faith = 'asatru'
             self.displayField.blit(images.mapImages[245], (40 , 134))
         screen.blit(pygame.transform.scale(self.displayField, (720, 720)), (0, 0))
         pygame.display.flip()
     elif step == 'name':
         self.displayField, r = load_image.load_image(os.path.join('MENU', "createBox2.png"))
         screen.blit(pygame.transform.scale(self.displayField, (720, 720) ), (0, 0) )
         pygame.display.flip()
Beispiel #2
0
    def __init__(self, screen, iH, menu):
        self.screen = screen
        
        self.battleField, r = load_image.load_image( os.path.join('ANIMATION', 'battlefield.bmp'), None)
        self.battleField.set_colorkey([255,0,0])
        self.background = pygame.Surface((300, 300))
        
        self.forestField, r = load_image.load_image( os.path.join('ANIMATION', 'forestField.bmp'), None)
        self.dungeonField, r = load_image.load_image( os.path.join('ANIMATION', 'dungeonField.bmp'), None)
        self.townField, r = load_image.load_image( os.path.join('ANIMATION', 'townField.bmp'), None)
        self.myMenu = menu
                
        self.enemyImgs = range(10)
        self.enemyImg = None
        self.heroImgs = range(10)
        self.heroImg = None

        self.heroImgIdx = 4
        self.enemyImgIdx = 6

        self.heroStepIdx = 0
        self.enemyStepIdx = 0
        
        self.inputHandler = iH
        
        self.buttons = [button.Button( (200, 150), 'Fight',os.getcwd()+"/FONTS/Squealer.ttf", 12),
                        button.Button( (200, 183), 'Magic',os.getcwd()+"/FONTS/Squealer.ttf", 12),
                        button.Button( (200, 216), 'Item',os.getcwd()+"/FONTS/Squealer.ttf", 12),
                        button.Button( (200, 249), 'Flee',os.getcwd()+"/FONTS/Squealer.ttf", 12)
                        
                        ]
Beispiel #3
0
 def mainLoop(self, screen):
     while True:
         for event in pygame.event.get():
             if event.type == pygame.MOUSEBUTTONDOWN:
                 (mX, mY) = pygame.mouse.get_pos()
                 for s in self.sliders:
                     if s.getXLoc()* const.scaleFactor <= mX < (s.getXLoc() + 24) * const.scaleFactor and (s.getYLoc()+(s.getValue()*10)) * const.scaleFactor <= mY < (s.getYLoc()+(s.getValue()*10) + 24 )* const.scaleFactor:
                         self.slide(s, screen)
                 # done
                 if int(floor(33*const.scaleFactor)) <= mX < int(ceil(82*const.scaleFactor)) and int(floor(237*const.scaleFactor)) <= mY < int(ceil(266*const.scaleFactor)):
                     self.displayField, r = load_image.load_image(os.path.join('MENU', "createBox2.png") )
                     self.updateDisplay(screen, 'name')
                     if android:
                         android.show_keyboard()
                     self.name = self.getInput(screen, '')
                     return self.getBall()
             elif event.type == pygame.QUIT:
                 os.sys.exit()
             elif event.type == pygame.KEYDOWN:
                 if event.key == pygame.K_RETURN:
                     self.displayField, r = load_image.load_image(os.path.join('MENU', "createBox2.png"))
                     self.updateDisplay(screen, 'name')
                     if android:
                         android.show_keyboard()
                     self.name = self.getInput(screen, '')
                     return self.getBall()
                 elif event.key == pygame.K_ESCAPE:
                     os.sys.exit()
         self.updateDisplay(screen, 'stats')
     while (pygame.event.wait().type != pygame.KEYDOWN):
         pass
Beispiel #4
0
    def __init__(self, screen, iH):
        self.textBox1 = pygame.Surface((100, 250))
        self.textBox1.fill(colors.gold)
        self.textBox2 = pygame.Surface((300, 100))
        self.textBox2.fill(colors.gold)
        self.playerkeys = 0

        #for displaying messages or menus
        self.screen = screen
        self.inputHandler = iH
        self.invItems = []

        self.frameBox1, r = load_image.load_image("hudBox1.bmp", None)
        self.frameBox2, r = load_image.load_image("hudBox2.bmp", None)
        self.outerframe, r = load_image.load_image("gamescreen600.bmp", None)

        self.scrollText = [''] * 5

        #self.game = game
        #self.gameBoard = game.gameBoard

        self.On = True

        self.popupWin = None
        self.popupLoc = None
        images.load()
Beispiel #5
0
 def __init__(self, screen, interface, ticker, iH, menu):
     Shop.__init__(self, screen, interface, 'townhall', ticker, iH, menu)
     self.storeScreen = pygame.Surface( (300,300) )
     self.inventory = []
     self.images = range(2)
     self.images[0], r = load_image.load_image( os.path.join('MENU', "cursor.png" ), -1)
     self.images[1], r = load_image.load_image( os.path.join('INT', 'inn.bmp'))
     self.storeScreen.fill( colors.black )
     self.storeScreen.blit( self.images[1], (0,0) )
     self.menuBox = pygame.Surface( ( int(ceil(124*const.scaleFactor)), int(ceil(99*const.scaleFactor)) ) )
     self.name = 'townhall'
Beispiel #6
0
 def __init__(self, screen, interface, ticker, iH, menu):
     Shop.__init__(self, screen, interface, 'townhall', ticker, iH, menu)
     self.storeScreen = pygame.Surface((300, 300))
     self.inventory = []
     self.images = range(2)
     self.images[0], r = load_image.load_image(
         os.path.join('MENU', "cursor.png"), -1)
     self.images[1], r = load_image.load_image(
         os.path.join('INT', 'inn.bmp'))
     self.storeScreen.fill(colors.black)
     self.storeScreen.blit(self.images[1], (0, 0))
     self.menuBox = pygame.Surface((int(ceil(124 * const.scaleFactor)),
                                    int(ceil(99 * const.scaleFactor))))
     self.name = 'townhall'
Beispiel #7
0
 def __init__(self, screen, interface, type, ticker, iH, menu):
     
     Shop.__init__(self, screen, interface, type, ticker, iH, menu)
     self.images[1], r = load_image.load_image( os.path.join('INT', 'magicshop.bmp'))
     self.storeScreen.blit( self.images[1], (0,0) )
     self.mPrices = prices.magicPrices
     self.name = 'magicshop'
Beispiel #8
0
 def __init__(self, screen, interface, type, ticker, iH, menu):
     
     Shop.__init__(self, screen, interface, type, ticker, iH, menu)
     self.images[1], r = load_image.load_image( os.path.join('INT', 'armory.bmp'))
     self.storeScreen.blit( self.images[1], (0,0) )
     self.stockedAt = None
     self.name = 'armory'
Beispiel #9
0
 def drawBattleScreen(self,
                      game,
                      enemy=None,
                      enemyX=50,
                      enemyY=100,
                      heroX=250,
                      heroY=100):
     if enemy is not None:
         self.battleField, r = load_image.load_image(
             os.path.join('ANIMATION', 'battlefield.bmp'), -1)
         if game.myMap.type == 'dungeon':
             self.background.blit(self.dungeonField, (0, 0))
         elif game.myMap.type == 'dungeon':
             self.background.blit(self.forestField, (0, 0))
         elif game.myMap.type == 'village':
             self.background.blit(self.townField, (0, 0))
         self.battleField.blit(self.enemyAvatar, (enemyX, enemyY))
         self.battleField.blit(self.heroAvatar, (heroX, heroY))
         self.battleField.blit(
             self.boxStat(enemy.getHP(), enemy.maxHP, colors.red,
                          colors.black, (150, 30)), (10, 85))
         self.background.blit(self.battleField, (0, 0))
     #self.screen.blit( pygame.transform.scale(self.battleField, (720, 720) ), (0, 0) )
     game.Display.displayOneFrame(game.myInterface, game.FX,
                                  self.background, game, False, True)
     pygame.display.flip()
Beispiel #10
0
    def updateDisplay(self, screen, step):
        if step == 'stats':
            self.displayField, r = load_image.load_image(
                os.path.join('MENU', "createBox.png"))
            self.calculateStats()
            self.displayField, self.displayField.copy
            self.displayStat(str(self.HP), (146, 65))
            self.displayStat(str(self.MP), (197, 65))
            self.displayStat(str(self.str), (150, 102))
            self.displayStat(str(self.itl), (202, 102))
            self.displayStat(str(self.dex), (247, 102))
            for s in self.sliders:
                if s.sliding:
                    self.displayField.blit(self.images[1],
                                           (s.getXLoc(), s.getYLoc() +
                                            (s.getValue() * 10)))
                else:
                    self.displayField.blit(self.images[0],
                                           (s.getXLoc(), s.getYLoc() +
                                            (s.getValue() * 10)))
            if self.sliders[2].getValue() == 0:
                self.gender = 'male'
                self.displayField.blit(images.mHeroImages[8], (40, 59))
            else:
                self.gender = 'female'
                self.displayField.blit(images.fHeroImages[8], (40, 59))

            if self.sliders[3].getValue() == 0:
                self.faith = 'xtian'
                self.displayField.blit(images.mapImages[246], (40, 134))
            else:
                self.faith = 'asatru'
                self.displayField.blit(images.mapImages[245], (40, 134))
            screen.blit(pygame.transform.scale(self.displayField, (720, 720)),
                        (0, 0))
            pygame.display.flip()
        elif step == 'name':
            self.displayField, r = load_image.load_image(
                os.path.join('MENU', "createBox2.png"))
            screen.blit(pygame.transform.scale(self.displayField, (720, 720)),
                        (0, 0))
            pygame.display.flip()
Beispiel #11
0
 def __init__(self):
     self.displayField, r = load_image.load_image(os.path.join('MENU', "createBox.png"))
     self.baseHP = randrange(25, 35)
     self.baseMP = randrange(15, 25)
     self.bStr = randrange(6, 10)
     self.bItl = randrange(8, 10)
     self.bDex = randrange(8, 10)
     self.sliders = [slider.Slider(216, 145),  # Warrior/Wizard
                     slider.Slider(172, 145),  # Lawful/neutral/chaotic
                     slider.Slider(101, 61, 0, 1),  # Male/female
                     slider.Slider(81, 134, 0, 1)  # Faith
                     ]
     self.gender = 'male'
     self.faith = 'xtian'
     self.faithLevel = 5
     self.images = range(3)
     self.images[0], r = load_image.load_image( os.path.join('MENU', "cursor.png" ), -1)
     self.images[1], r = load_image.load_image( os.path.join('MENU', 'cursor_l.png'), -1)
     
     images.load()
Beispiel #12
0
 def mainLoop(self, screen):
     while True:
         for event in pygame.event.get():
             if event.type == pygame.MOUSEBUTTONDOWN:
                 (mX, mY) = pygame.mouse.get_pos()
                 for s in self.sliders:
                     if s.getXLoc() * const.scaleFactor <= mX < (s.getXLoc(
                     ) + 24) * const.scaleFactor and (
                             s.getYLoc() +
                         (s.getValue() * 10)) * const.scaleFactor <= mY < (
                             s.getYLoc() +
                             (s.getValue() * 10) + 24) * const.scaleFactor:
                         self.slide(s, screen)
                 # done
                 if int(floor(33 * const.scaleFactor)) <= mX < int(
                         ceil(82 * const.scaleFactor)) and int(
                             floor(237 * const.scaleFactor)) <= mY < int(
                                 ceil(266 * const.scaleFactor)):
                     self.displayField, r = load_image.load_image(
                         os.path.join('MENU', "createBox2.png"))
                     self.updateDisplay(screen, 'name')
                     if android:
                         android.show_keyboard()
                     self.name = self.getInput(screen, '')
                     return self.getBall()
             elif event.type == pygame.QUIT:
                 os.sys.exit()
             elif event.type == pygame.KEYDOWN:
                 if event.key == pygame.K_RETURN:
                     self.displayField, r = load_image.load_image(
                         os.path.join('MENU', "createBox2.png"))
                     self.updateDisplay(screen, 'name')
                     if android:
                         android.show_keyboard()
                     self.name = self.getInput(screen, '')
                     return self.getBall()
                 elif event.key == pygame.K_ESCAPE:
                     os.sys.exit()
         self.updateDisplay(screen, 'stats')
     while (pygame.event.wait().type != pygame.KEYDOWN):
         pass
Beispiel #13
0
    def update( self, game=None ):
        stats = game.myHero.getPlayerStats()
        (cHP, mHP, cMP, mMP, sth, dex, itl, scr, kys, cEX, nEX, psn) = stats
        (armor, weapon) = (game.myHero.getArmorEquipped(),
                           game.myHero.getWeaponEquipped())
        self.textBox1 = pygame.Surface((100, 75))
        self.textBox1.fill(colors.gold)
        self.frameBox1, r = load_image.load_image("hudBox1.bmp", None)
        #draw stats
        self.boxStat(cHP, mHP, colors.dkred, colors.red, (29, 53))
        self.boxStat(cMP, mMP, colors.dkblue, colors.blue, (29, 73))
        self.boxStat(cEX, nEX, colors.green, colors.dkgreen, (29, 93))
        if game.myHero.isPoisoned:
            self.frameBox1.blit(images.mapImages[122], (30, 111))
        elif game.myHero.isDamned:
            self.frameBox1.blit(images.mapImages[123], (30, 111))
        # ticker
        self.drawClock(106, 159, game.Ticker)
        #show equipped armor and weapon
        weaponCopy = pygame.Surface((30, 30))
        #weaponCopy.blit(images.mapImages[weapon.getImg()], (0, 0))
        self.writeText(weaponCopy, (17, 17), 'L' + str(weapon.getLevel()),
            colors.white, colors.black, 10)
        self.frameBox1.blit(weaponCopy, (30, 180))

        armorLocList = [(90, 180), (30, 220), (90, 220)]
        for A in range(len(armor)):
            if armor[A] is None:
                pass
            else:
                armorCopy = images.mapImages[armor[A].getImg()]
                self.writeText(armorCopy, (20, 20), 'L' + str(
                    armor[A].getLevel()), colors.white, colors.black, 10)
                self.frameBox1.blit(armorCopy, armorLocList[A])
        # gold
        goldBox = pygame.Surface((30, 30))
        goldBox.blit(images.mapImages[const.GOLD], (0, 0))
        self.writeText(goldBox, (5, 17), '$' + str(
            game.myHero.getGold()), colors.white, colors.black, 10)
        self.frameBox1.blit(goldBox, (30, 260))
        # keys
        keyBox = pygame.Surface((30, 30))
        keyBox.blit(images.mapImages[const.KEY], (-5, 0))
        self.writeText(keyBox, (13, 17), 'x' + str(kys),
            colors.white, colors.black, 10)
        self.frameBox1.blit(keyBox, (90, 260))

        if self.popupWin is not None:
            self.frameBox1.blit(self.popupWin, self.popupLoc)
        self.screen.blit(self.outerframe, (0,0) )
        self.screen.blit(self.frameBox1, (const.blocksize * 10 + 75, 75))
        self.screen.blit(self.frameBox2, (75, const.blocksize * 10 + 75))
        self.screen.blit(game.gameBoard, (75, 75))
Beispiel #14
0
 def drawBattleScreen(self, game, enemy=None, enemyX = 50, enemyY = 100, heroX = 250, heroY = 100):
     if enemy is not None:
         self.battleField, r = load_image.load_image(os.path.join('ANIMATION', 'battlefield.bmp'), -1)
         if game.myMap.type == 'dungeon': self.background.blit(self.dungeonField, (0,0) )
         elif game.myMap.type == 'dungeon': self.background.blit(self.forestField, (0,0) )
         elif game.myMap.type == 'village': self.background.blit(self.townField, (0,0) )
         self.battleField.blit( self.enemyAvatar, (enemyX, enemyY) )
         self.battleField.blit( self.heroAvatar, (heroX, heroY) )
         self.battleField.blit( self.boxStat(enemy.getHP(), enemy.maxHP, colors.red, colors.black, (150, 30) ), (10, 85) )
         self.background.blit(self.battleField, (0,0) )
     #self.screen.blit( pygame.transform.scale(self.battleField, (720, 720) ), (0, 0) )
     game.Display.displayOneFrame(game.myInterface, game.FX, self.background, game, False, True)
     pygame.display.flip()
Beispiel #15
0
    def __init__(self, screen, iH, menu):
        self.screen = screen

        self.battleField, r = load_image.load_image(
            os.path.join('ANIMATION', 'battlefield.bmp'), None)
        self.battleField.set_colorkey([255, 0, 0])
        self.background = pygame.Surface((300, 300))

        self.forestField, r = load_image.load_image(
            os.path.join('ANIMATION', 'forestField.bmp'), None)
        self.dungeonField, r = load_image.load_image(
            os.path.join('ANIMATION', 'dungeonField.bmp'), None)
        self.townField, r = load_image.load_image(
            os.path.join('ANIMATION', 'townField.bmp'), None)
        self.myMenu = menu

        self.enemyImgs = range(10)
        self.enemyImg = None
        self.heroImgs = range(10)
        self.heroImg = None

        self.heroImgIdx = 4
        self.enemyImgIdx = 6

        self.heroStepIdx = 0
        self.enemyStepIdx = 0

        self.inputHandler = iH

        self.buttons = [
            button.Button((200, 150), 'Fight',
                          os.getcwd() + "/FONTS/Squealer.ttf", 12),
            button.Button((200, 183), 'Magic',
                          os.getcwd() + "/FONTS/Squealer.ttf", 12),
            button.Button((200, 216), 'Item',
                          os.getcwd() + "/FONTS/Squealer.ttf", 12),
            button.Button((200, 249), 'Flee',
                          os.getcwd() + "/FONTS/Squealer.ttf", 12)
        ]
Beispiel #16
0
    def __init__(self):
        self.displayField, r = load_image.load_image(
            os.path.join('MENU', "createBox.png"))
        self.baseHP = randrange(25, 35)
        self.baseMP = randrange(15, 25)
        self.bStr = randrange(6, 10)
        self.bItl = randrange(8, 10)
        self.bDex = randrange(8, 10)
        self.sliders = [
            slider.Slider(216, 145),  # Warrior/Wizard
            slider.Slider(172, 145),  # Lawful/neutral/chaotic
            slider.Slider(101, 61, 0, 1),  # Male/female
            slider.Slider(81, 134, 0, 1)  # Faith
        ]
        self.gender = 'male'
        self.faith = 'xtian'
        self.faithLevel = 5
        self.images = range(3)
        self.images[0], r = load_image.load_image(
            os.path.join('MENU', "cursor.png"), -1)
        self.images[1], r = load_image.load_image(
            os.path.join('MENU', 'cursor_l.png'), -1)

        images.load()
Beispiel #17
0
 def __init__(self, screen, interface, type, ticker, iH, menu):
     self.storeScreen = pygame.Surface( (300,300) )
     self.inventory = []
     self.screen = screen
     self.myInterface = interface
     self.myMenu = menu
     self.images = range(2)
     self.images[0], r = load_image.load_image( os.path.join('MENU', "cursor.png" ), -1)
     self.type = type
     self.ticker = ticker
     self.storeScreen.fill( colors.black )
     self.inputHandler = iH
     self.items = range(3)
     self.prices = range(3)
     self.menuBox = pygame.Surface( ( int(ceil(124*const.scaleFactor)), int(ceil(99*const.scaleFactor)) ) )
     self.locations = [(165, 190+0),
                       (165, 190+30),
                       (165, 190+60),
                       (165, 190+90)]
     self.buttons = []
Beispiel #18
0
 def __init__(self, screen, iH, Display, iFace, FX, SFX):
     self.images = images.mapImages
     self.statsBox, r = load_image.load_image(os.path.join("MENU", "statsBox.png"))
     self.iMenuBox, r = load_image.load_image(os.path.join("MENU", "invMenu.png"))
     self.hMenuBox, r = load_image.load_image(os.path.join("MENU", "hMenu.png"))
     self.helpBox, r = load_image.load_image(os.path.join("MENU", "helpBox.png"))
     self.storyBox, r = load_image.load_image(os.path.join("MENU", "storyBox.png"))
     self.equipBox, r = load_image.load_image(os.path.join("MENU", "equipBox.png"))
     self.screen = screen
     self.title = ""
     self.cursorPos = (0, 0)
     self.inputHandler = iH
     self.Display = Display
     self.interface = iFace
     self.FX = FX
     self.SFX = SFX
Beispiel #19
0
    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
Beispiel #20
0
    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
Beispiel #21
0
    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)
Beispiel #22
0
def load(path=''):

    mapSpriteSheet = spritesheet('mastersheet.bmp')
    for i in range(128):
        mapImages[i] = mapSpriteSheet.image_at( ( (i*const.blocksize)%240, 
                                                  (i/8)*const.blocksize, 
                                                  const.blocksize, 
                                                  const.blocksize), 
                                               1 )
        
    for i in range(128, 256):
        #print (i*const.blocksize)%240 + 240
        mapImages[i] = mapSpriteSheet.image_at( ( (i*const.blocksize)%240 + 240, 
                                                  ( (i-128) /8)*const.blocksize, 
                                                  const.blocksize, 
                                                  const.blocksize), 
                                               1 )
    siteImgs = ['itemSh.bmp', 'mShop.bmp', 'bSmith.bmp', 'armry.bmp', 'tavrn.bmp','townhall.bmp','house1.bmp', 'tower1.bmp']
    for i in range(256, 264):
        mapImages[i], r = load_image.load_image( os.path.join('EXT', siteImgs[i-256]), 1 )
    for i in range(18):
        accessories[i] = pygame.Surface((15,10))
        accessories[i].set_colorkey([255,128,128], pygame.RLEACCEL)
        accessories[i].blit( mapImages[242 + (i/6) ], ( ((i%6)/3)*-15, (i%3)*-10) )
    mHeroSpriteSheet = spritesheet( os.path.join('CHAR', 'mherosheet.bmp'))
    for i in range(18):
        mHeroImages[i] = mHeroSpriteSheet.image_at( ((i*const.blocksize)%270, 
                                                     (i/9)*const.blocksize, 
                                                     const.blocksize, 
                                                     const.blocksize), -1 )
    fHeroSpriteSheet = spritesheet( os.path.join('CHAR', 'fherosheet.bmp'))
    for i in range(18):
        fHeroImages[i] = fHeroSpriteSheet.image_at( ((i*const.blocksize)%270, 
                                                     (i/9)*const.blocksize, 
                                                     const.blocksize, 
                                                     const.blocksize), -1 )
 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 )
Beispiel #24
0
def load(path=''):

    mapSpriteSheet = spritesheet('mastersheet.bmp')
    for i in range(128):
        mapImages[i] = mapSpriteSheet.image_at(
            ((i * const.blocksize) % 240,
             (i / 8) * const.blocksize, const.blocksize, const.blocksize), 1)

    for i in range(128, 256):
        #print (i*const.blocksize)%240 + 240
        mapImages[i] = mapSpriteSheet.image_at(
            ((i * const.blocksize) % 240 + 240,
             ((i - 128) / 8) * const.blocksize, const.blocksize,
             const.blocksize), 1)
    siteImgs = [
        'itemSh.bmp', 'mShop.bmp', 'bSmith.bmp', 'armry.bmp', 'tavrn.bmp',
        'townhall.bmp', 'house1.bmp', 'tower1.bmp'
    ]
    for i in range(256, 264):
        mapImages[i], r = load_image.load_image(
            os.path.join('EXT', siteImgs[i - 256]), 1)
    for i in range(18):
        accessories[i] = pygame.Surface((15, 10))
        accessories[i].set_colorkey([255, 128, 128], pygame.RLEACCEL)
        accessories[i].blit(mapImages[242 + (i / 6)],
                            (((i % 6) / 3) * -15, (i % 3) * -10))
    mHeroSpriteSheet = spritesheet(os.path.join('CHAR', 'mherosheet.bmp'))
    for i in range(18):
        mHeroImages[i] = mHeroSpriteSheet.image_at(
            ((i * const.blocksize) % 270,
             (i / 9) * const.blocksize, const.blocksize, const.blocksize), -1)
    fHeroSpriteSheet = spritesheet(os.path.join('CHAR', 'fherosheet.bmp'))
    for i in range(18):
        fHeroImages[i] = fHeroSpriteSheet.image_at(
            ((i * const.blocksize) % 270,
             (i / 9) * const.blocksize, const.blocksize, const.blocksize), -1)
Beispiel #25
0
myWorldBall = None

selection = 0
options = ['Begin New Game', 'Load Saved Game', 'Credits', 'Exit']
buttons = []

if pygame.font:
    font = pygame.font.Font("./FONTS/chancery.ttf", 60)
y = 350
for o in options:
    line = font.render(o, 1, colors.white, colors.black)
    buttons.append(button.Button(((
        screen.get_width() / 2) - (line.get_width() / 2), y), o))
    y += 75

ifaceImg, r = load_image.load_image(os.path.join('MENU', 'interface_m.png'),
                                    None)
logo, r = load_image.load_image('logo.png', None)


def endScreen(game, msg):
    spi = os.getcwd()+"/FONTS/SpinalTfanboy.ttf"
    dev = os.getcwd()+"/FONTS/devinne.ttf"
    got = os.getcwd()+"/FONTS/gothic.ttf"
    dScreen = pygame.Surface((screen.get_width(), screen.get_width()))
    dScreen.fill(colors.black)
    msgText = text.Text(msg, os.getcwd()+"/FONTS/Squealer.ttf", 18,
                        colors.white, colors.gold)
    dScreen.blit(text.Text("Game Over", spi, 72, colors.red, colors.black),
                 (50, 0))
    font = pygame.font.Font("./FONTS/devinne.ttf", 18)
    if game.myHero.level < 4:
Beispiel #26
0
    def updateDisplay(self):
        gridField.fill(colors.black)
        for i in range(self.topX, self.topX + 40):
            for j in range(self.topY, self.topY + 40):
                if myMap.getEntry(i, j) in range(24, 86):
                    gridField.blit(mapImages[myMap.defaultBkgd],
                                   ((i - self.topX) * blocksize,
                                    (j - self.topY) * blocksize))
                gridField.blit(mapImages[myMap.getEntry(i, j)],
                               ((i - self.topX) * blocksize,
                                (j - self.topY) * blocksize))
                if (i, j) == myMap.heroStart:
                    gridField.blit(mapImages[const.HEROSTART],
                                   ((i - self.topX) * blocksize,
                                    (j - self.topY) * blocksize))
                if myMap.shops is not None:
                    for s in myMap.shops:
                        if myMap.shops[s][0] == 'itemshop':
                            (sX, sY) = s
                            gridField.blit(mapImages[128],
                                           (sX * blocksize - blocksize,
                                            sY * blocksize - (2 * blocksize)))
                        if myMap.shops[s][0] == 'magicshop':
                            (sX, sY) = s
                            gridField.blit(mapImages[129],
                                           (sX * blocksize - blocksize,
                                            sY * blocksize - (2 * blocksize)))
                        if myMap.shops[s][0] == 'blacksmith':
                            (sX, sY) = s
                            gridField.blit(mapImages[130],
                                           (sX * blocksize - blocksize,
                                            sY * blocksize - (2 * blocksize)))
                        if myMap.shops[s][0] == 'armory':
                            (sX, sY) = s
                            gridField.blit(mapImages[131],
                                           (sX * blocksize - blocksize,
                                            sY * blocksize - (2 * blocksize)))
                        if myMap.shops[s][0] == 'tavern':
                            (sX, sY) = s
                            gridField.blit(mapImages[132],
                                           (sX * blocksize - blocksize,
                                            sY * blocksize - (3 * blocksize)))
        for n in myMap.NPCs:
            (x, y) = n[0]
            gridField.blit(self.npcImg, ((x - self.topX) * blocksize,
                                         (y - self.topY) * blocksize))
        (x, y) = self.cursorPos
        x = x - self.topX * blocksize
        y = y - self.topY * blocksize
        if self.drawMode:
            self.cursorColor = colors.yellow
        else:
            self.cursorColor = colors.white
        if self.selectBoxPoints is not None:
            pygame.draw.lines(gridField, colors.red, True,
                              self.selectBoxPoints, 1)

        boxPoints = ((x, y), (x, y + blocksize),
                     (x + blocksize, y + blocksize), (x + blocksize, y))
        pygame.draw.lines(gridField, self.cursorColor, True, boxPoints, 1)
        self.sideImg, sideRect = load_image.load_image('sidebar.bmp')
        if self.placeNPC:
            self.sideImg.blit(self.npcImg, (50, 50))
        else:
            self.sideImg.blit(mapImages[self.currentTile], (50, 50))
        self.sideImg.blit(mapImages[myMap.defaultBkgd], (50, 130))
        if self.mouseAction == 'draw':
            self.sideImg.blit(images.editorImages[5], (50, 80))
        else:
            self.sideImg.blit(images.editorImages[6], (50, 80))
        self.sideImg.blit(self.npcImg, (50, 170))
        for i in range(8):
            for j in range(4):
                self.sideImg.blit(mapImages[self.offset + j + (4 * i)],
                                  (50 + j * blocksize, 200 + (i * blocksize)))

        toolBox = pygame.Surface((90, 90))
        toolBox.blit(images.editorImages[0], (15, 0))
        toolBox.blit(images.editorImages[1], (45, 0))
        toolBox.blit(images.editorImages[2], (0, 30))
        toolBox.blit(images.editorImages[3], (30, 30))
        toolBox.blit(images.editorImages[4], (60, 30))
        toolBox.blit(images.editorImages[5], (15, 60))
        toolBox.blit(images.editorImages[6], (45, 60))
        self.sideImg.blit(toolBox, (50, 500))
        (x, y) = self.cursorPos
        entryBox = pygame.Surface((150, 30))
        entryBox.fill(colors.black)
        if pygame.font:
            font = pygame.font.SysFont("arial", 20)
            entry = font.render(
                str(
                    myMap.getEntry((x + self.topX) / blocksize,
                                   (y + self.topY) / blocksize)) + ' ' + 'x:' +
                str(x) + ' y:' + str(y), 1, colors.white, colors.black)
            entryBox.blit(entry, (0, 0))
            self.sideImg.blit(entryBox, (80, 50))
        if self.drawMode:
            msgBox = pygame.Surface((186, 60))
            msgBox.fill(colors.grey)
            if pygame.font:
                font = pygame.font.SysFont("arial", 24)
                msgText = font.render('draw', 1, colors.red, colors.yellow)
                msgBox.blit(msgText, (10, 10))
            self.sideImg.blit(msgBox, (50, 100))
            #pygame.display.flip()
        screen.blit(self.sideImg, (1200, 0))
Beispiel #27
0
 def __init__(self, filename):
     try:
         self.sheet, r = load_image.load_image(filename, 1)
     except pygame.error, message:
         print 'Unable to load spritesheet image:', filename
         raise SystemExit, message
Beispiel #28
0
    def updateDisplay(self, type='all'):
        if type in ['all', 'field']:
            gridField.fill(colors.black)
            for i in range(self.topX, self.topX + 40):
                for j in range(self.topY, self.topY + 40):
                    fTile = self.myMap.getTileFG(i, j)
                    bTile = self.myMap.getTileBG(i, j)
                    if fTile in const.SOLIDS:
                        if bTile is not None:
                            gridField.blit(mapImages[bTile],
                                           ((i - self.topX) * blocksize,
                                            (j - self.topY) * blocksize))
                        else:
                            gridField.blit(mapImages[self.myMap.defaultBkgd],
                                           ((i - self.topX) * blocksize,
                                            (j - self.topY) * blocksize))
                    gridField.blit(mapImages[fTile],
                                   ((i - self.topX) * blocksize,
                                    (j - self.topY) * blocksize))
                    if fTile in range(const.TABLE1, const.TABLE3 + 1):
                        try:
                            gridField.blit(
                                accImages[self.myMap.grid[i][j].accessory],
                                ((i - self.topX) * blocksize + 10,
                                 (j - self.topY) * blocksize + 5))
                        except AttributeError:
                            pass
                        except TypeError:
                            pass
                    if (i, j) == self.myMap.heroStart:
                        gridField.blit(mapImages[const.HEROSTART],
                                       ((i - self.topX) * blocksize,
                                        (j - self.topY) * blocksize))
                    if self.myMap.shops is not None:
                        for s in self.myMap.shops:
                            (sX, sY) = s
                            (imgN,
                             ht) = mapScr.siteImgDict[self.myMap.shops[s][0]]
                            gridField.blit(
                                mapImages[imgN],
                                (sX * blocksize - blocksize -
                                 (self.topX * blocksize), sY * blocksize -
                                 (ht * blocksize) - (self.topY * blocksize)))
            for n in self.myMap.NPCs:
                (x, y) = n[0]
                try:
                    gridField.blit(self.npcImg[n[1]],
                                   ((x - self.topX) * blocksize,
                                    (y - self.topY) * blocksize))
                except KeyError:
                    gridField.blit(self.npcImg['duke'],
                                   ((x - self.topX) * blocksize,
                                    (y - self.topY) * blocksize))
            (x, y) = self.cursorPos
            x = x - self.topX * blocksize
            y = y - self.topY * blocksize
            if self.drawMode:
                self.cursorColor = colors.yellow
            else:
                self.cursorColor = colors.white
            if self.selectBoxPoints is not None:
                pygame.draw.lines(gridField, colors.red, True,
                                  self.selectBoxPoints, 1)

            boxPoints = ((x, y), (x, y + blocksize),
                         (x + blocksize, y + blocksize), (x + blocksize, y))
            pygame.draw.lines(gridField, self.cursorColor, True, boxPoints, 1)
        if type in ['all', 'bar']:
            self.sideImg, sideRect = load_image.load_image('sidebar.bmp')

            if self.placeNPC: self.sideImg.blit(self.npcImg['duke'], (50, 50))
            else: self.sideImg.blit(mapImages[self.currentTile], (50, 50))

            if pygame.font:
                font = pygame.font.SysFont("arial", 12)

            self.sideImg.blit(mapImages[self.myMap.defaultBkgd], (50, 130))
            self.sideImg.blit(
                font.render(self.drawLayer, 1, colors.white, colors.black),
                (80, 130))

            if self.mouseAction == 'draw':
                self.sideImg.blit(self.editorImages[5], (50, 80))
            else:
                self.sideImg.blit(self.editorImages[6], (50, 80))
            self.sideImg.blit(self.npcImg['duke'], (50, 170))
            for i in range(8):
                for j in range(4):
                    self.sideImg.blit(mapImages[self.offset + j + (4 * i)],
                                      (50 + j * blocksize, 200 +
                                       (i * blocksize)))

            toolBox = pygame.Surface((90, 90))
            toolBox.blit(self.editorImages[0], (15, 0))
            toolBox.blit(self.editorImages[1], (45, 0))
            toolBox.blit(self.editorImages[2], (0, 30))
            toolBox.blit(self.editorImages[3], (30, 30))
            toolBox.blit(self.editorImages[4], (60, 30))
            toolBox.blit(self.editorImages[5], (15, 60))
            toolBox.blit(self.editorImages[6], (45, 60))
            self.sideImg.blit(toolBox, (50, 500))
            (x, y) = self.cursorPos
            entryBox = pygame.Surface((150, 30))
            entryBox.fill(colors.black)
            entry = font.render(
                str(
                    self.myMap.getEntry(
                        (x + self.topX) / blocksize,
                        (y + self.topY) / blocksize)) + ' ' + 'x:' + str(x) +
                '(' + str(x / blocksize) + ')' + ' y:' + str(y) + '(' +
                str(y / blocksize) + ')', 1, colors.white, colors.black)
            entryBox.blit(entry, (0, 0))
            self.sideImg.blit(entryBox, (50, 450))
            if self.drawMode:
                msgBox = pygame.Surface((186, 60))
                msgBox.fill(colors.grey)
                if pygame.font:
                    font = pygame.font.SysFont("arial", 24)
                    msgText = font.render('draw', 1, colors.red, colors.yellow)
                    msgBox.blit(msgText, (10, 10))
                self.sideImg.blit(msgBox, (50, 100))
                #pygame.display.flip()
            screen.blit(self.sideImg, (1200, 0))
 def updateDisplay(self, type='all'):
     if type in ['all', 'field']:
         gridField.fill(colors.black)
         for i in range(self.topX, self.topX+40):
             for j in range(self.topY, self.topY+40):
                 fTile = self.myMap.getTileFG(i, j)
                 bTile = self.myMap.getTileBG(i, j)
                 if fTile in const.SOLIDS:
                     if bTile is not None:
                         gridField.blit( mapImages[bTile], ( (i-self.topX)*blocksize,(j-self.topY)*blocksize) )
                     else: gridField.blit( mapImages[self.myMap.defaultBkgd], ( (i-self.topX)*blocksize,(j-self.topY)*blocksize) )
                 gridField.blit( mapImages[fTile], ( (i-self.topX)*blocksize,(j-self.topY)*blocksize) )
                 if fTile in range(const.TABLE1, const.TABLE3+1):
                     try:
                         gridField.blit( accImages[self.myMap.grid[i][j].accessory], ( (i-self.topX)*blocksize+10,
                                                                                       (j-self.topY)*blocksize+5) )
                     except AttributeError:
                         pass
                     except TypeError:
                         pass
                 if (i,j) == self.myMap.heroStart:
                     gridField.blit( mapImages[const.HEROSTART], ( (i-self.topX)*blocksize,(j-self.topY)*blocksize) )
                 if self.myMap.shops is not None:
                     for s in self.myMap.shops:
                         (sX, sY) = s
                         (imgN, ht) = mapScr.siteImgDict[ self.myMap.shops[s][0] ]
                         gridField.blit( mapImages[ imgN ], (sX*blocksize - blocksize - (self.topX * blocksize), sY*blocksize - ( ht*blocksize) - (self.topY * blocksize) ) )
         for n in self.myMap.NPCs:
             (x,y) = n[0]
             try:
                 gridField.blit(self.npcImg[ n[1] ], ((x-self.topX)*blocksize, (y-self.topY)*blocksize) )
             except KeyError:
                 gridField.blit(self.npcImg[ 'duke' ], ((x-self.topX)*blocksize, (y-self.topY)*blocksize) )
         (x,y) = self.cursorPos
         x = x - self.topX*blocksize
         y = y - self.topY*blocksize
         if self.drawMode:
             self.cursorColor = colors.yellow
         else:
             self.cursorColor = colors.white
         if self.selectBoxPoints is not None:
             pygame.draw.lines( gridField, colors.red, True, self.selectBoxPoints, 1 )
 
         boxPoints = ( (x,y), (x,y+blocksize), (x+blocksize,y+blocksize), (x+blocksize,y) )
         pygame.draw.lines( gridField, self.cursorColor, True, boxPoints, 1 )
     if type in ['all', 'bar']:
         self.sideImg, sideRect = load_image.load_image('sidebar.bmp')
         
         if self.placeNPC: self.sideImg.blit(self.npcImg['duke'],(50,50))
         else: self.sideImg.blit(mapImages[self.currentTile],(50,50))
         
         if pygame.font:
             font = pygame.font.SysFont("arial",12)
         
         self.sideImg.blit(mapImages[self.myMap.defaultBkgd],(50,130))
         self.sideImg.blit( font.render(self.drawLayer, 1, colors.white, colors.black ), (80,130) )
         
         if self.mouseAction == 'draw':
             self.sideImg.blit(self.editorImages[5], (50,80) )
         else: self.sideImg.blit(self.editorImages[6], (50,80) )
         self.sideImg.blit(self.npcImg['duke'], (50,170) )
         for i in range(8):
             for j in range(4):
                 self.sideImg.blit(mapImages[self.offset + j + (4*i)], (50+j*blocksize, 200+(i*blocksize)))
         
         toolBox = pygame.Surface( (90, 90) )
         toolBox.blit( self.editorImages[0], (15,0) )
         toolBox.blit( self.editorImages[1], (45,0) )
         toolBox.blit( self.editorImages[2], (0,30) )
         toolBox.blit( self.editorImages[3], (30,30) )
         toolBox.blit( self.editorImages[4], (60,30) )
         toolBox.blit( self.editorImages[5], (15,60) )
         toolBox.blit( self.editorImages[6], (45,60) )
         self.sideImg.blit(toolBox, (50,500) )
         (x,y) = self.cursorPos
         entryBox = pygame.Surface((150,30))
         entryBox.fill(colors.black)
         entry = font.render(str(self.myMap.getEntry( (x+self.topX)/blocksize, (y+self.topY)/blocksize))+' '+'x:'+str(x)+'('+str(x/blocksize)+')'+' y:'+str(y)+'('+str(y/blocksize)+')',1, colors.white, colors.black )
         entryBox.blit(entry,(0,0))
         self.sideImg.blit(entryBox,(50,450))
         if self.drawMode:
             msgBox = pygame.Surface( ( 186, 60 ) )
             msgBox.fill( colors.grey )
             if pygame.font:
                 font = pygame.font.SysFont("arial", 24)
                 msgText = font.render( 'draw', 1, colors.red, colors.yellow )
                 msgBox.blit(msgText, (10,10) )
             self.sideImg.blit( msgBox, (50,100) )
             #pygame.display.flip()
         screen.blit(self.sideImg, (1200,0) )
Beispiel #30
0
    def updateDisplay(self):
        gridField.fill(colors.black)
        for i in range(self.topX, self.topX + 40):
            for j in range(self.topY, self.topY + 40):
                if myMap.getEntry(i, j) in range(24, 86):
                    gridField.blit(
                        mapImages[myMap.defaultBkgd], ((i - self.topX) * blocksize, (j - self.topY) * blocksize)
                    )
                gridField.blit(
                    mapImages[myMap.getEntry(i, j)], ((i - self.topX) * blocksize, (j - self.topY) * blocksize)
                )
                if (i, j) == myMap.heroStart:
                    gridField.blit(
                        mapImages[const.HEROSTART], ((i - self.topX) * blocksize, (j - self.topY) * blocksize)
                    )
                if myMap.shops is not None:
                    for s in myMap.shops:
                        if myMap.shops[s][0] == "itemshop":
                            (sX, sY) = s
                            gridField.blit(
                                mapImages[128], (sX * blocksize - blocksize, sY * blocksize - (2 * blocksize))
                            )
                        if myMap.shops[s][0] == "magicshop":
                            (sX, sY) = s
                            gridField.blit(
                                mapImages[129], (sX * blocksize - blocksize, sY * blocksize - (2 * blocksize))
                            )
                        if myMap.shops[s][0] == "blacksmith":
                            (sX, sY) = s
                            gridField.blit(
                                mapImages[130], (sX * blocksize - blocksize, sY * blocksize - (2 * blocksize))
                            )
                        if myMap.shops[s][0] == "armory":
                            (sX, sY) = s
                            gridField.blit(
                                mapImages[131], (sX * blocksize - blocksize, sY * blocksize - (2 * blocksize))
                            )
                        if myMap.shops[s][0] == "tavern":
                            (sX, sY) = s
                            gridField.blit(
                                mapImages[132], (sX * blocksize - blocksize, sY * blocksize - (3 * blocksize))
                            )
        for n in myMap.NPCs:
            (x, y) = n[0]
            gridField.blit(self.npcImg, ((x - self.topX) * blocksize, (y - self.topY) * blocksize))
        (x, y) = self.cursorPos
        x = x - self.topX * blocksize
        y = y - self.topY * blocksize
        if self.drawMode:
            self.cursorColor = colors.yellow
        else:
            self.cursorColor = colors.white
        if self.selectBoxPoints is not None:
            pygame.draw.lines(gridField, colors.red, True, self.selectBoxPoints, 1)

        boxPoints = ((x, y), (x, y + blocksize), (x + blocksize, y + blocksize), (x + blocksize, y))
        pygame.draw.lines(gridField, self.cursorColor, True, boxPoints, 1)
        self.sideImg, sideRect = load_image.load_image("sidebar.bmp")
        if self.placeNPC:
            self.sideImg.blit(self.npcImg, (50, 50))
        else:
            self.sideImg.blit(mapImages[self.currentTile], (50, 50))
        self.sideImg.blit(mapImages[myMap.defaultBkgd], (50, 130))
        if self.mouseAction == "draw":
            self.sideImg.blit(images.editorImages[5], (50, 80))
        else:
            self.sideImg.blit(images.editorImages[6], (50, 80))
        self.sideImg.blit(self.npcImg, (50, 170))
        for i in range(8):
            for j in range(4):
                self.sideImg.blit(mapImages[self.offset + j + (4 * i)], (50 + j * blocksize, 200 + (i * blocksize)))

        toolBox = pygame.Surface((90, 90))
        toolBox.blit(images.editorImages[0], (15, 0))
        toolBox.blit(images.editorImages[1], (45, 0))
        toolBox.blit(images.editorImages[2], (0, 30))
        toolBox.blit(images.editorImages[3], (30, 30))
        toolBox.blit(images.editorImages[4], (60, 30))
        toolBox.blit(images.editorImages[5], (15, 60))
        toolBox.blit(images.editorImages[6], (45, 60))
        self.sideImg.blit(toolBox, (50, 500))
        (x, y) = self.cursorPos
        entryBox = pygame.Surface((150, 30))
        entryBox.fill(colors.black)
        if pygame.font:
            font = pygame.font.SysFont("arial", 20)
            entry = font.render(
                str(myMap.getEntry((x + self.topX) / blocksize, (y + self.topY) / blocksize))
                + " "
                + "x:"
                + str(x)
                + " y:"
                + str(y),
                1,
                colors.white,
                colors.black,
            )
            entryBox.blit(entry, (0, 0))
            self.sideImg.blit(entryBox, (80, 50))
        if self.drawMode:
            msgBox = pygame.Surface((186, 60))
            msgBox.fill(colors.grey)
            if pygame.font:
                font = pygame.font.SysFont("arial", 24)
                msgText = font.render("draw", 1, colors.red, colors.yellow)
                msgBox.blit(msgText, (10, 10))
            self.sideImg.blit(msgBox, (50, 100))
            # pygame.display.flip()
        screen.blit(self.sideImg, (1200, 0))
Beispiel #31
0
selection = 0
options = ['Begin New Game', 'Load Saved Game', 'Credits', 'Exit']
buttons = []

if pygame.font:
    font = pygame.font.Font("./FONTS/chancery.ttf", 60)
y = 350
for o in options:
    line = font.render(o, 1, colors.white, colors.black)
    buttons.append(
        button.Button(((screen.get_width() / 2) - (line.get_width() / 2), y),
                      o))
    y += 75

ifaceImg, r = load_image.load_image(os.path.join('MENU', 'interface_m.png'),
                                    None)
logo, r = load_image.load_image('logo.png', None)


def endScreen(game, msg):
    spi = os.getcwd() + "/FONTS/SpinalTfanboy.ttf"
    dev = os.getcwd() + "/FONTS/devinne.ttf"
    got = os.getcwd() + "/FONTS/gothic.ttf"
    dScreen = pygame.Surface((screen.get_width(), screen.get_width()))
    dScreen.fill(colors.black)
    msgText = text.Text(msg,
                        os.getcwd() + "/FONTS/Squealer.ttf", 18, colors.white,
                        colors.gold)
    dScreen.blit(text.Text("Game Over", spi, 72, colors.red, colors.black),
                 (50, 0))
    font = pygame.font.Font("./FONTS/devinne.ttf", 18)