def menuScreen(state):
    '''
    The menuScreen function takes in the paramater 'state' and returns the 
    next selected state that the user wishes to play. It is responsible for
    displaying the buttons to the screen and navigating between the states.
    This functon returns the next selected state.
    '''
    gameDisplay.fill(black)
    gameDisplay.blit(background, (500, 300))
    displayText("BeastKeeper", '../fonts/Antonio-Bold.ttf', 200,
                display_width / 2, (display_height / 5), white, 0)

    # Creating the buttons
    my_state = button("My Beasts", '../fonts/Antonio-Regular.ttf', button_size,
                      white, green, hovergreen, display_width / 5,
                      display_height - button_size, 50, "myBeast")
    other_state = button("Other Beasts", '../fonts/Antonio-Regular.ttf',
                         button_size, white, blue, hoverblue,
                         display_width / 2, display_height - button_size, 50,
                         "otherBeast")
    quit_state = button("Quit", '../fonts/Antonio-Regular.ttf', button_size,
                        white, red, hoverred, (4 * display_width) / 5,
                        display_height - button_size, 50, "quit")

    # Returning the state selected
    if my_state != state:
        return my_state
    elif quit_state != state:
        return quit_state
    elif other_state != state:
        return other_state
Esempio n. 2
0
def menuScreen(state):
    # The menuScreen function takes in the paramater 'state' and returns the
    # next selected state that the user wishes to play. It is responsible for
    # displaying the buttons to the screen and navigating between the states.
    gameDisplay.blit(background, (0, 0))
    displayText("COMMAND-O-LINE", '../fonts/Antonio-Bold.ttf', 200,
                display_width / 2, (display_height / 5), white, 0)

    # creating the buttons
    play_state = button("Play game", '../fonts/Antonio-Regular.ttf',
                        button_size, white, green, hovergreen,
                        display_width / 5, display_height - button_size, 50,
                        "play")
    tutorial_state = button("Tutorial", '../fonts/Antonio-Regular.ttf',
                            button_size, white, blue, hoverblue,
                            display_width / 2, display_height - button_size,
                            50, "tutorial")
    quit_state = button("Quit game", '../fonts/Antonio-Regular.ttf',
                        button_size, white, red, hoverred,
                        (4 * display_width) / 5, display_height - button_size,
                        50, "quit")

    # updating the screen
    menuGroup.update()
    menuGroup.draw(gameDisplay)

    # returning the state selected
    if play_state != state:
        return play_state
    elif quit_state != state:
        return quit_state
    elif tutorial_state != state:
        return tutorial_state
def profileScreen(mySet, owned):
    '''
	The profileScreen function manages the states of this page.
	This is done by creating buttons that allow the user see the profile of the next or previous beast.
	This function also has a return button that lets the user go back to the menu.
	This function takes in two arguments.
	mySet: This is the set of beats currently in use.
	owned: This is a boolean value that says if the set is owned or not.
	This function returns the ID of the adopted beast in order to add it to the owned beast set.
	'''
    # Setting local variables
    current = 0
    adopt_state = None
    play = True
    while play:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                return True
        # Creating the buttons
        return_state = button("Return", '../fonts/Antonio-Regular.ttf',
                              button_size, white, red, hoverred,
                              display_width / 2,
                              display_height - button_size - 100, 50, True)
        left_state = button("Previous", '../fonts/Antonio-Regular.ttf',
                            button_size, white, red, hoverred,
                            display_width / 18,
                            display_height - button_size - 100, 50, True)
        right_state = button("Next", '../fonts/Antonio-Regular.ttf',
                             button_size, white, red, hoverred,
                             display_width / 5,
                             display_height - button_size - 100, 50, True)
        pygame.display.update()
        # Returning the state selected
        if return_state != None:
            play = False
        elif left_state != None:
            current -= 1
            if current < 0:
                current = 0
        elif right_state != None:
            current += 1
            if current > len(mySet) - 1:
                current = len(mySet) - 1
        displayProfile(mySet, current, owned)
        if not owned:
            adopt_state = adoption(mySet)
            if adopt_state:
                play = False
        else:
            appointment(mySet, current)
    if adopt_state:
        return mySet[current].ident
Esempio n. 4
0
def tutorialScreen():
    # The tutorial screen function takes in no parameters, nor does it return
    # anything. It is generally in charge of the visuals and establishing a
    # moveable character to allow the user to become familiar with the controls
    # of the game.
    tutorial = True
    while tutorial:
        # displaying baackground and characters
        gameDisplay.blit(background, (0, 0))
        gameDisplay.blit(character, ((display_width / 2) + 185, 180))
        if tutorialPlayer.shot == True:
            bullet = characters.Bullet(tutorialPlayer.rect.x, tutorialPlayer.rect.y, tutorialPlayer.facing, tutorialPlayer.location)
            bulletGroup.add(bullet)
            tutorialPlayer.canShoot = False
        updateDraw()
        tutorialText()
        tempState = button("Main Menu (m)", '../fonts/Antonio-Regular.ttf', 40, white, red, hoverred, 1875, 970, 25, False)
        if tempState != None:
            tutorial = tempState
        for event in pygame.event.get():
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_m:
                    tutorial = False
            if event.type == pygame.QUIT:
                return True ### Quit does not work...
        pygame.display.update()
        clock.tick(60)
def profileScreen(mySet, owned):
    current = 0
    adopt_state = None
    play = True
    while play:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                return True
        # creating the buttons
        return_state = button("Return", '../fonts/Antonio-Regular.ttf',
                              button_size, white, red, hoverred,
                              display_width / 2,
                              display_height - button_size - 100, 50, True)
        left_state = button("Previous", '../fonts/Antonio-Regular.ttf',
                            button_size, white, red, hoverred,
                            display_width / 18,
                            display_height - button_size - 100, 50, True)
        right_state = button("Next", '../fonts/Antonio-Regular.ttf',
                             button_size, white, red, hoverred,
                             display_width / 5,
                             display_height - button_size - 100, 50, True)
        pygame.display.update()
        # returning the state selected
        if return_state != None:
            play = False
        elif left_state != None:
            current -= 1
            if current < 0:
                current = 0
        elif right_state != None:
            current += 1
            if current > len(mySet) - 1:
                current = len(mySet) - 1
        displayProfile(mySet, current, owned)
        if not owned:
            adopt_state = adoption(mySet)
            if adopt_state:
                play = False
        else:
            appointment(mySet, current)

    if adopt_state:
        return mySet[current].ident
def appointment(mySet, current):
    appoint_state = button("Appointment", '../fonts/Antonio-Regular.ttf',
                           button_size, white, red, hoverred,
                           display_width - 175,
                           display_height - button_size - 100, 50, True)
    if appoint_state:
        previousAppoint = mySet[current].appointment
        date = input("Please enter an appointment date: ")
        mySet[current].appointment = date
        if checkAppoint(mySet, current):
            mySet[current].appointment = previousAppoint
Esempio n. 7
0
 def create_buttons(self):
     find = util.button(self, 'Find Next', self.on_find)
     find.SetDefault()
     if self.replace:
         replace = util.button(self, 'Replace', self.on_replace)
         replace_all = util.button(self, 'Replace All', self.on_replace_all)
     mark_all = util.button(self, 'Mark All', self.on_mark_all)
     cancel = util.button(self, 'Cancel', id=wx.ID_CANCEL)
     sizer = wx.BoxSizer(wx.VERTICAL)
     sizer.Add(find)
     sizer.AddSpacer(5)
     if self.replace:
         sizer.Add(replace)
         sizer.AddSpacer(5)
         sizer.Add(replace_all)
         sizer.AddSpacer(5)
     sizer.Add(mark_all)
     sizer.AddSpacer(5)
     sizer.Add(cancel)
     return sizer
def adoption(mySet):
    '''
	The adoption function makes a button appear on the profile of not owned beasts that if clicked adopts that beast.
	This function takes in one argument.
	mySet: This is the set of beats currently in use.
	This function returns the current state of the button (adopted == True, else == None).
	'''
    adopt_state = button("Adopt", '../fonts/Antonio-Regular.ttf', button_size,
                         white, red, hoverred, display_width - 175,
                         display_height - button_size - 100, 50, True)
    return adopt_state
def appointment(mySet, current):
    '''
	The appointment function creates a button on the proflie of owned beasts that if clicked allows the user to enter an appointment date in the terminal.
	This function takes in two arguments.
	mySet: This is the set of beats currently in use.
	current: This is index of the currently selected beast.
	This function does not return anything.
	'''
    # Creating button.
    appoint_state = button("Appointment", '../fonts/Antonio-Regular.ttf',
                           button_size, white, red, hoverred,
                           display_width - 175,
                           display_height - button_size - 100, 50, True)
    # Checking if button is pressed.
    if appoint_state:
        # Saving previous appointment date incase of conflict.
        previousAppoint = mySet[current].appointment
        date = input("Please enter an appointment date: ")
        mySet[current].appointment = date
        # If there is a conflict of dates then the previous appointment date is reset.
        if checkAppoint(mySet, current):
            mySet[current].appointment = previousAppoint
Esempio n. 10
0
def adoption(mySet):
    adopt_state = button("Adopt", '../fonts/Antonio-Regular.ttf', button_size,
                         white, red, hoverred, display_width - 175,
                         display_height - button_size - 100, 50, True)
    return adopt_state