Пример #1
0
 def __init__(self, marathon):
     """ Initialize the Marathon Screen """
     PygameScreen.__init__(self)
     self.marathon = marathon
     self.backgroundImage = load_image(GetImagePath("Marathons/Kanto_Gym_Leaders.jpg"))
     self.congratsLabel = Label("Congratulations! You Won!")
     self.descriptionLabel = Label(marathon.description)
Пример #2
0
 def __init__(self, marathon):
     """ Initialize the Marathon Screen """
     PygameScreen.__init__(self)
     self.marathon = marathon
     self.backgroundImage = load_image(
         GetImagePath("Marathons/Kanto_Gym_Leaders.jpg"))
     self.congratsLabel = Label("Congratulations! You Won!")
     self.descriptionLabel = Label(marathon.description)
Пример #3
0
 def __init__(self, entry, width, height):
     """ Initialize the widget """
     MenuEntryWidget.__init__(self, entry, fontSize=28, width=width, height=height)
     self.entry = entry
     
     attack = self.entry.attack
     self.typeImage = TypeImage(attack.type)
     self.ppTextLabel = Label("PP", size=18)
     self.ppValuesLabel = Label("{0}/{1}".format(attack.currPowerPoints, attack.powerPoints), size=18)
 def __init__(self, menu):
     """  """
     PygameScreen.__init__(self)
     self.menu = menu
     self.commandLabels = []
     self.keyLabels = []
     for cmd in self.bindingsOrder:
         self.commandLabels.append(
             Label(self.menu.cmdStrings[cmd], bold=True))
         self.keyLabels.append(Label(self.menu.keyBindings[cmd]))
Пример #5
0
    def __init__(self, menu, currentPlayer):
        """  """
        PygameScreen.__init__(self)
        self.currentPlayer = currentPlayer
        self.menu = menu
        self.logo = Logo()

        name = "None"
        if currentPlayer is not None:
            name = currentPlayer.fullname
        self.playerLabel = Label("{0}: {1}".format("Player", name),
                                 size=24,
                                 color=(0, 0, 0))

        self.menuView = MainMenuWidget(menu)
Пример #6
0
class PokemonStatsView(MenuEntryWidget):
    """ View for a Pokemon's Stats in a Battle """
    FONT_SIZE = 24
    
    def __init__(self, width, height, pokemon=None, pokemonMenuEntry=None, showHP=True):
        """ Initialize the Pokemon Stats View """
        if pokemon is not None:
            self.pokemon = pokemon
            pokemonMenuEntry = PokemonMenuEntry(self.pokemon, None)
        else:
            self.pokemon = pokemonMenuEntry.getPokemon()
        MenuEntryWidget.__init__(self, pokemonMenuEntry, width, height, fontSize=self.FONT_SIZE)
            
        self.showHP = showHP
        self.setLevelLabel()
        self.setHealthLabel()
        self.healthBarView = HealthBarView(self.pokemon, width, height*.1)
        
    def setLevelLabel(self):
        """ Set the Level Label """
        self.levelLabel = Label("Lv. {0}".format(self.pokemon.getLevel()), size=self.FONT_SIZE)
        
    def setHealthLabel(self):
        """ Set the Health Label """
        hpString = "{0}/{1}".format(self.pokemon.getCurrHP(), self.pokemon.getStat("HP"))
        self.healthLabel = Label(hpString, size=self.FONT_SIZE)
        
    def drawSurface(self):
        """ Draw the Pokemon Stats View """
        pkmnSurface = self.mainLabel.draw()
        self.drawOnSurface(pkmnSurface, left=0, top=0)
        
        levelSurface = self.levelLabel.draw()
        self.drawOnSurface(levelSurface, right=1, top=0)
        
        healthBarSurface = self.healthBarView.draw()
        self.drawOnSurface(healthBarSurface, left=0, top=(pkmnSurface.get_height()+10.0)/self.height)
        
        if self.showHP:
            healthSurface = self.healthLabel.draw()
            self.drawOnSurface(healthSurface, right=1, 
                    top=(pkmnSurface.get_height()+healthBarSurface.get_height()+15.0)/self.height)
        
    def update(self):
        """ Update the Pokemon Stats View """
        MenuEntryWidget.update(self)
        self.setLevelLabel()
        self.setHealthLabel()
Пример #7
0
class MenuEntryWidget(SizedWidget):
    """ Represents an entry in the menu """
    def __init__(self, entry, width, height, fontSize=36):
        """ Sets the entry's text """
        SizedWidget.__init__(self, width, height)
        self.mainLabel = Label(entry.getText(), size=fontSize)
        self.entry = entry

    def update(self):
        """ Update the Entry Widget """
        self.mainLabel.setBold(self.entry.selected)
        self.mainLabel.setText(self.entry.getText())

    def drawSurface(self):
        """ Draw the Widget """
        self.drawOnSurface(self.mainLabel.draw(), centerx=.5, centery=.5)
Пример #8
0
class MenuEntryWidget(SizedWidget):
    """ Represents an entry in the menu """
    
    def __init__(self, entry, width, height, fontSize=36):
        """ Sets the entry's text """
        SizedWidget.__init__(self, width, height)
        self.mainLabel = Label(entry.getText(), size=fontSize)
        self.entry = entry
        
    def update(self):
        """ Update the Entry Widget """
        self.mainLabel.setBold(self.entry.selected)
        self.mainLabel.setText(self.entry.getText())
        
    def drawSurface(self):
        """ Draw the Widget """
        self.drawOnSurface(self.mainLabel.draw(), centerx=.5, centery=.5)
Пример #9
0
class AttackMenuEntryWidget(MenuEntryWidget):
    """ Represents the widget for an Attack Menu Entry """
    
    def __init__(self, entry, width, height):
        """ Initialize the widget """
        MenuEntryWidget.__init__(self, entry, fontSize=28, width=width, height=height)
        self.entry = entry
        
        attack = self.entry.attack
        self.typeImage = TypeImage(attack.type)
        self.ppTextLabel = Label("PP", size=18)
        self.ppValuesLabel = Label("{0}/{1}".format(attack.currPowerPoints, attack.powerPoints), size=18)
        
    def drawSurface(self):
        """ Draw the Widget """
        self.drawOnSurface(self.mainLabel.draw(), centerx=.5, centery=.3)
        self.drawOnSurface(self.typeImage.draw(), centerx=.3, centery=.65)
        self.drawOnSurface(self.ppTextLabel.draw(), left=.5, centery=.65)
        self.drawOnSurface(self.ppValuesLabel.draw(), right=.8, centery=.65)
        
Пример #10
0
class MarathonScreen(PygameScreen):
    """ Screen for a Pokemon Marathon """
    
    def __init__(self, marathon):
        """ Initialize the Marathon Screen """
        PygameScreen.__init__(self)
        self.marathon = marathon
        self.backgroundImage = load_image(GetImagePath("Marathons/Kanto_Gym_Leaders.jpg"))
        self.congratsLabel = Label("Congratulations! You Won!")
        self.descriptionLabel = Label(marathon.description)
        
    def drawSurface(self):
        """ Draw the screen """
        self.drawOnSurface(self.backgroundImage, left=0, top=0)
        if self.marathon.beaten():
            labelSurface = self.congratsLabel.draw()
        else:
            labelSurface = self.descriptionLabel.draw()
        self.drawOnSurface(labelSurface, left=.05, centery=.1)
                    
    def update(self):
        """ Do Nothing """
Пример #11
0
 def __init__(self, menu, currentPlayer):
     """  """
     PygameScreen.__init__(self)
     self.currentPlayer = currentPlayer
     self.menu = menu
     self.logo = Logo()
     
     name = "None"
     if currentPlayer is not None:
         name = currentPlayer.fullname
     self.playerLabel = Label("{0}: {1}".format("Player", name), size=24, color=(0, 0, 0))
     
     self.menuView = MainMenuWidget(menu)
Пример #12
0
class MarathonScreen(PygameScreen):
    """ Screen for a Pokemon Marathon """
    def __init__(self, marathon):
        """ Initialize the Marathon Screen """
        PygameScreen.__init__(self)
        self.marathon = marathon
        self.backgroundImage = load_image(
            GetImagePath("Marathons/Kanto_Gym_Leaders.jpg"))
        self.congratsLabel = Label("Congratulations! You Won!")
        self.descriptionLabel = Label(marathon.description)

    def drawSurface(self):
        """ Draw the screen """
        self.drawOnSurface(self.backgroundImage, left=0, top=0)
        if self.marathon.beaten():
            labelSurface = self.congratsLabel.draw()
        else:
            labelSurface = self.descriptionLabel.draw()
        self.drawOnSurface(labelSurface, left=.05, centery=.1)

    def update(self):
        """ Do Nothing """
Пример #13
0
class MainMenuScreen(PygameScreen):
    """ Represents the Main Menu screen """
    
    def __init__(self, menu, currentPlayer):
        """  """
        PygameScreen.__init__(self)
        self.currentPlayer = currentPlayer
        self.menu = menu
        self.logo = Logo()
        
        name = "None"
        if currentPlayer is not None:
            name = currentPlayer.fullname
        self.playerLabel = Label("{0}: {1}".format("Player", name), size=24, color=(0, 0, 0))
        
        self.menuView = MainMenuWidget(menu)
        
    def drawSurface(self):
        """ Draws the screen to the provided window """
        self.drawMap()
        self.drawOnSurface(self.playerLabel.draw(), right=1, top=0)
        self.drawLogo()
        self.drawMenu()
        
    def drawMap(self):
        """ Draws the map to the window """
        mapSurface = map.draw()
        self.drawOnSurface(mapSurface, left=0, top=0)
        
    def drawLogo(self):
        """ Draws the Logo to the window """
        logoSurface = self.logo.draw()
        self.drawOnSurface(logoSurface, centerx=.5, centery=.25)
        
    def drawMenu(self):
        """ Draws the Menu to the window """
        menuSurface = self.menuView.draw()
        self.drawOnSurface(menuSurface, centerx=.5, centery=11.0/16)
        
Пример #14
0
class MainMenuScreen(PygameScreen):
    """ Represents the Main Menu screen """
    def __init__(self, menu, currentPlayer):
        """  """
        PygameScreen.__init__(self)
        self.currentPlayer = currentPlayer
        self.menu = menu
        self.logo = Logo()

        name = "None"
        if currentPlayer is not None:
            name = currentPlayer.fullname
        self.playerLabel = Label("{0}: {1}".format("Player", name),
                                 size=24,
                                 color=(0, 0, 0))

        self.menuView = MainMenuWidget(menu)

    def drawSurface(self):
        """ Draws the screen to the provided window """
        self.drawMap()
        self.drawOnSurface(self.playerLabel.draw(), right=1, top=0)
        self.drawLogo()
        self.drawMenu()

    def drawMap(self):
        """ Draws the map to the window """
        mapSurface = map.draw()
        self.drawOnSurface(mapSurface, left=0, top=0)

    def drawLogo(self):
        """ Draws the Logo to the window """
        logoSurface = self.logo.draw()
        self.drawOnSurface(logoSurface, centerx=.5, centery=.25)

    def drawMenu(self):
        """ Draws the Menu to the window """
        menuSurface = self.menuView.draw()
        self.drawOnSurface(menuSurface, centerx=.5, centery=11.0 / 16)
Пример #15
0
 def setHealthLabel(self):
     """ Set the Health Label """
     hpString = "{0}/{1}".format(self.pokemon.getCurrHP(), self.pokemon.getStat("HP"))
     self.healthLabel = Label(hpString, size=self.FONT_SIZE)
Пример #16
0
class PokemonStatsView(MenuEntryWidget):
    """ View for a Pokemon's Stats in a Battle """
    FONT_SIZE = 24

    def __init__(self,
                 width,
                 height,
                 pokemon=None,
                 pokemonMenuEntry=None,
                 showHP=True):
        """ Initialize the Pokemon Stats View """
        if pokemon is not None:
            self.pokemon = pokemon
            pokemonMenuEntry = PokemonMenuEntry(self.pokemon, None)
        else:
            self.pokemon = pokemonMenuEntry.getPokemon()
        MenuEntryWidget.__init__(self,
                                 pokemonMenuEntry,
                                 width,
                                 height,
                                 fontSize=self.FONT_SIZE)

        self.showHP = showHP
        self.setLevelLabel()
        self.setHealthLabel()
        self.healthBarView = HealthBarView(self.pokemon, width, height * .1)

    def setLevelLabel(self):
        """ Set the Level Label """
        self.levelLabel = Label("Lv. {0}".format(self.pokemon.getLevel()),
                                size=self.FONT_SIZE)

    def setHealthLabel(self):
        """ Set the Health Label """
        hpString = "{0}/{1}".format(self.pokemon.getCurrHP(),
                                    self.pokemon.getStat("HP"))
        self.healthLabel = Label(hpString, size=self.FONT_SIZE)

    def drawSurface(self):
        """ Draw the Pokemon Stats View """
        pkmnSurface = self.mainLabel.draw()
        self.drawOnSurface(pkmnSurface, left=0, top=0)

        levelSurface = self.levelLabel.draw()
        self.drawOnSurface(levelSurface, right=1, top=0)

        healthBarSurface = self.healthBarView.draw()
        self.drawOnSurface(healthBarSurface,
                           left=0,
                           top=(pkmnSurface.get_height() + 10.0) / self.height)

        if self.showHP:
            healthSurface = self.healthLabel.draw()
            self.drawOnSurface(healthSurface,
                               right=1,
                               top=(pkmnSurface.get_height() +
                                    healthBarSurface.get_height() + 15.0) /
                               self.height)

    def update(self):
        """ Update the Pokemon Stats View """
        MenuEntryWidget.update(self)
        self.setLevelLabel()
        self.setHealthLabel()
Пример #17
0
 def setLevelLabel(self):
     """ Set the Level Label """
     self.levelLabel = Label("Lv. {0}".format(self.pokemon.getLevel()), size=self.FONT_SIZE)
Пример #18
0
 def setHealthLabel(self):
     """ Set the Health Label """
     hpString = "{0}/{1}".format(self.pokemon.getCurrHP(),
                                 self.pokemon.getStat("HP"))
     self.healthLabel = Label(hpString, size=self.FONT_SIZE)
Пример #19
0
 def __init__(self, entry, width, height, fontSize=36):
     """ Sets the entry's text """
     SizedWidget.__init__(self, width, height)
     self.mainLabel = Label(entry.getText(), size=fontSize)
     self.entry = entry
Пример #20
0
 def setLevelLabel(self):
     """ Set the Level Label """
     self.levelLabel = Label("Lv. {0}".format(self.pokemon.getLevel()),
                             size=self.FONT_SIZE)
Пример #21
0
 def __init__(self, entry, width, height, fontSize=36):
     """ Sets the entry's text """
     SizedWidget.__init__(self, width, height)
     self.mainLabel = Label(entry.getText(), size=fontSize)
     self.entry = entry