def quit_button(): mouse = pg.mouse.get_pos() if 650 <= mouse[0] <= 650 + 140 and 30 <= mouse[1] <= 30 + 40: pg.draw.rect(screen, COLOR_LIGHT_SELECTED, [652, 32, 137, 37]) pg.draw.rect(screen, BLACK, [650, 30, 140, 40], 3) text_speech(screen, "RobotoSlab-Black.ttf", 25, "QUIT", BLACK, 715, 48, True) else: pg.draw.rect(screen, COLOR_LIGHT_UNSELECTED, [650, 30, 140, 40]) pg.draw.rect(screen, BLACK, [650, 30, 140, 40], 3) text_speech(screen, "RobotoSlab-Black.ttf", 25, "QUIT", BLACK, 715, 48, True)
def quit_button_start(): mouse = pg.mouse.get_pos() if 275 <= mouse[0] <= 275 + 225 and 440 <= mouse[1] <= 440 + 65: pg.draw.rect(screen, BLACK, (275, 440, 240, 65), 3) pg.draw.rect(screen, COLOR_LIGHT_SELECTED, (277, 442, 236, 61)) text_speech(screen, "RobotoSlab-Black.ttf", 30, "Quit Game", BLACK, width / 2.025, height / 1.27, True) else: pg.draw.rect(screen, BLACK, (275, 440, 240, 65), 3) pg.draw.rect(screen, COLOR_LIGHT_UNSELECTED, (277, 442, 236, 61)) text_speech(screen, "RobotoSlab-Black.ttf", 30, "Quit Game", BLACK, width / 2.025, height / 1.27, True)
def choose_city_button(): mouse = pg.mouse.get_pos() if 285 <= mouse[0] <= 285 + 240 and 400 <= mouse[1] <= 400 + 100: pg.draw.rect(screen, BLACK, (285, 400, 225, 70), 3) pg.draw.rect(screen, COLOR_LIGHT_SELECTED, (287, 402, 221, 66)) text_speech(screen, "RobotoSlab-Black.ttf", 30, "Choose city!", BLACK, 400, 435, True) else: pg.draw.rect(screen, BLACK, (285, 400, 225, 70), 3) pg.draw.rect(screen, COLOR_LIGHT_UNSELECTED, (287, 402, 221, 66)) text_speech(screen, "RobotoSlab-Black.ttf", 30, "Choose city!", BLACK, 400, 435, True)
def instructions_button(): mouse = pg.mouse.get_pos() if 275 <= mouse[0] <= 275 + 240 and 360 <= mouse[1] <= 360 + 65: pg.draw.rect(screen, BLACK, (275, 360, 240, 65), 3) pg.draw.rect(screen, COLOR_LIGHT_SELECTED, (277, 362, 236, 61)) text_speech(screen, "RobotoSlab-Black.ttf", 30, "How To Play", BLACK, width / 2.025, height / 1.54, True) else: pg.draw.rect(screen, BLACK, (275, 360, 240, 65), 3) pg.draw.rect(screen, COLOR_LIGHT_UNSELECTED, (277, 362, 236, 61)) text_speech(screen, "RobotoSlab-Black.ttf", 30, "How To Play", BLACK, width / 2.025, height / 1.54, True)
def battle_time_button(): mouse = pg.mouse.get_pos() if 275 <= mouse[0] <= 275 + 240 and 245 <= mouse[1] <= 225 + 100: pg.draw.rect(screen, BLACK, (285, 245, 225, 70), 3) pg.draw.rect(screen, COLOR_LIGHT_SELECTED, (287, 247, 221, 66)) text_speech(screen, "RobotoSlab-Black.ttf", 30, "Battle time!", BLACK, width / 2.02, height / 2.15, True) else: pg.draw.rect(screen, BLACK, (285, 245, 225, 70), 3) pg.draw.rect(screen, COLOR_LIGHT_UNSELECTED, (287, 247, 221, 66)) text_speech(screen, "RobotoSlab-Black.ttf", 30, "Battle time!", BLACK, width / 2.02, height / 2.15, True)
def start_game_button(): mouse = pg.mouse.get_pos() if 275 <= mouse[0] <= 275 + 225 and 280 <= mouse[1] <= 280 + 65: pg.draw.rect(screen, BLACK, (275, 280, 240, 65), 3) pg.draw.rect(screen, COLOR_LIGHT_SELECTED, (277, 282, 236, 61)) text_speech(screen, "RobotoSlab-Black.ttf", 30, "Start Game", BLACK, width / 2.025, height / 1.93, True) else: pg.draw.rect(screen, BLACK, (275, 280, 240, 65), 3) pg.draw.rect(screen, COLOR_LIGHT_UNSELECTED, (277, 282, 236, 61)) text_speech(screen, "RobotoSlab-Black.ttf", 30, "Start Game", BLACK, width / 2.025, height / 1.93, True)
def back_button(): mouse = pg.mouse.get_pos() if 30 <= mouse[0] <= 30 + 140 and 540 <= mouse[1] <= 540 + 40: pg.draw.rect(screen, COLOR_LIGHT_SELECTED, [32, 542, 137, 37]) pg.draw.rect(screen, BLACK, [30, 540, 140, 40], 3) text_speech(screen, "RobotoSlab-Black.ttf", 25, "BACK", BLACK, 97, 558, True) else: pg.draw.rect(screen, COLOR_LIGHT_UNSELECTED, [32, 542, 137, 37]) pg.draw.rect(screen, BLACK, [30, 540, 140, 40], 3) text_speech(screen, "RobotoSlab-Black.ttf", 25, "BACK", BLACK, 97, 558, True)
def render(self, screen): screen.blit(background, (0, 0)) # aggressive_ada(520, 300, 640, 300) # glada_gunnar(8, 30, 122, 45) choose_city_button() battle_time_button() quit_button() text_speech( screen, "RobotoSlab-Medium.ttf", 25, "Press battle to get a random mood score, or choose a city!", BLACK, 400, 200, True) pg.display.update()
def quiz_button(): mouse = pg.mouse.get_pos() if 563 <= mouse[0] <= 563 + 150 and 430 <= mouse[1] <= 430 + 50: pg.draw.rect(screen, LIGHT_GREEN_SELECTED, [565, 432, 147, 47]) pg.draw.rect(screen, BLACK, [563, 430, 150, 50], 3) text_speech(screen, "RobotoSlab-Black.ttf", 25, "Quiz", BLACK, 638, 453, True) sound_ambient_hover_quizz_btn() else: pg.draw.rect(screen, LIGHT_GREEN_UNSELECTED, [565, 432, 147, 47]) pg.draw.rect(screen, BLACK, [563, 430, 150, 50], 3) text_speech(screen, "RobotoSlab-Black.ttf", 25, "Quiz", BLACK, 638, 453, True)
def special_attack_button(): mouse = pg.mouse.get_pos() if 390 <= mouse[0] <= 390 + 150 and 460 <= mouse[1] <= 460 + 50: pg.draw.rect(screen, LIGHT_BLUE_SELECTED, [392, 432, 147, 47]) pg.draw.rect(screen, BLACK, [390, 430, 150, 50], 3) text_speech(screen, "RobotoSlab-Black.ttf", 25, "Special", BLACK, 465, 453, True) sound_ambient_hover_over_special_attack_btn() else: pg.draw.rect(screen, LIGHT_BLUE_UNSELECTED, [392, 432, 147, 47]) pg.draw.rect(screen, BLACK, [390, 430, 150, 50], 3) text_speech(screen, "RobotoSlab-Black.ttf", 25, "Special", BLACK, 465, 453, True)
def block_button(): mouse = pg.mouse.get_pos() if 222 <= mouse[0] <= 222 + 150 and 430 <= mouse[1] <= 430 + 50: pg.draw.rect(screen, LIGHT_YELLOW_SELECTED, [224, 432, 147, 47]) pg.draw.rect(screen, BLACK, [222, 430, 150, 50], 3) text_speech(screen, "RobotoSlab-Black.ttf", 25, "Block", BLACK, 297, 453, True) sound_ambient_hover_over_attack_btn() else: pg.draw.rect(screen, LIGHT_YELLOW_UNSELECTED, [224, 432, 147, 47]) pg.draw.rect(screen, BLACK, [222, 430, 150, 50], 3) text_speech(screen, "RobotoSlab-Black.ttf", 25, "Block", BLACK, 297, 453, True)
def attack_button(): mouse = pg.mouse.get_pos() if 57 <= mouse[0] <= 57 + 150 and 430 <= mouse[1] <= 430 + 50: pg.draw.rect(screen, LIGHT_RED_SELECTED, [59, 432, 147, 47]) pg.draw.rect(screen, BLACK, [57, 430, 150, 50], 3) text_speech(screen, "RobotoSlab-Black.ttf", 25, "Attack", BLACK, 132, 453, True) sound_ambient_hover_over_attack_btn() else: pg.draw.rect(screen, LIGHT_RED_UNSELECTED, [59, 432, 147, 47]) pg.draw.rect(screen, BLACK, [57, 430, 150, 50], 3) text_speech(screen, "RobotoSlab-Black.ttf", 25, "Attack", BLACK, 132, 453, True)
def show_city_score(city, city2): clock = pg.time.Clock() waiting = True time = 5 while waiting: dt = clock.tick(1) / 1000 time -= dt print(time) if time <= 0: waiting = False screen.blit(background, (0, 0)) text_speech( screen, "RobotoSlab-Medium.ttf", 30, f"Gunnar got {calc_mood_score(mood=gunnar.mood, city=city, live=False)} added to its health!", BLACK, 389, 150, True) text_speech(screen, "RobotoSlab-Medium.ttf", 30, f"Gunnar got his moodscore from {city}", BLACK, 389, 180, True) text_speech( screen, "RobotoSlab-Medium.ttf", 30, f"Ada got {calc_mood_score(mood=ada.mood, city=city2, live=False)} added to its health!", BLACK, 389, 300, True) text_speech(screen, "RobotoSlab-Medium.ttf", 30, f"Ada got her moodscore from {city2}", BLACK, 389, 330, True) pg.display.update()
def render(self, screen): screen.fill(WHITE) screen.blit(background_win, (0, 0)) ada_win_pic = pg.image.load("images/Pink_dragon_08.png") ada_win_pic = pg.transform.scale(ada_win_pic, (350, 350)) screen.blit(ada_win_pic, (205, 285)) winning_crown_ada_moving() gunnar_lose = pg.transform.scale(gunnar.image, (200, 200)) screen.blit(gunnar_lose, (25, 355)) tear_drop = pg.image.load("images/tear-png-20.png") tear_drop = pg.transform.scale(tear_drop, (25, 25)) screen.blit(tear_drop, (90, 430)) screen.blit(logo, (215, -55)) text_speech(screen, "RobotoSlab-Medium.ttf", 30, "Better luck next time,", YELLOW_LIGHT, 386, 150, True) text_speech(screen, "RobotoSlab-Medium.ttf", 30, f"{ada.name} won!", YELLOW_LIGHT, 385, 200, True) quit_button()
def render(self, screen): screen.fill(WHITE) screen.blit(background_win, (0, 0)) x_off, y_off = periodic_movement(1, 5) #CL gunnar_bigger = pg.transform.scale(gunnar.image, (350, 350)) screen.blit(gunnar_bigger, (220, 235 + y_off)) winning_crown_hasse_moving() pink_dragon_sad = pg.image.load("images/Pink_dragon_05.png") pink_dragon_sad = pg.transform.scale(pink_dragon_sad, (204, 235)) screen.blit(pink_dragon_sad, (25, 340)) screen.blit(logo, (213, -55)) tear_drop = pg.image.load("images/tear-png-20.png") tear_drop = pg.transform.scale(tear_drop, (25, 25)) screen.blit(tear_drop, (120, 410)) text_speech(screen, "RobotoSlab-Medium.ttf", 30, "Congratulations,", YELLOW_LIGHT, 389, 150, True) text_speech(screen, "RobotoSlab-Medium.ttf", 30, f"{gunnar.name} won!", YELLOW_LIGHT, 388, 200, True) quit_button()
def aggressive_ada(x, y, a, b): screen.blit(ada.image, (x, y)) text_speech(screen, "RobotoSlab-Medium.ttf", 15, f"{ada.name}", ada.color, a, b, True) text_speech(screen, "RobotoSlab-Medium.ttf", 15, f"Attack: {ada.attack} Mood: {ada.mood}", WHITE, 630, 575, True) bg_bar1 = pg.Rect(50, 530, 2 * ada.max_health, 50) hp_bar1 = pg.Rect(50, 530, 200 * (ada.health * 0.01), 50) if ada.health > 0: pg.draw.rect(screen, (255, 0, 0), bg_bar1) pg.draw.rect(screen, (0, 255, 0), hp_bar1) text_speech(screen, "RobotoSlab-Medium.ttf", 15, f"HP: {ada.health}/{ada.max_health}", BLACK, 125, 555, True)
def glada_gunnar(x, y, a, b): screen.blit(gunnar.image, (x, y)) text_speech(screen, "RobotoSlab-Medium.ttf", 15, f"{gunnar.name}", gunnar.color, a, b, True) text_speech(screen, "RobotoSlab-Medium.ttf", 15, f" Attack: {gunnar.attack}, Mood: {gunnar.mood}", WHITE, 170, 20, True) bg_bar1 = pg.Rect(200, 50, 2 * gunnar.max_health, 50) hp_bar1 = pg.Rect(200, 50, 200 * (gunnar.health * 0.01), 50) if gunnar.health > 0: pg.draw.rect(screen, (255, 0, 0), bg_bar1) pg.draw.rect(screen, (0, 255, 0), hp_bar1) text_speech(screen, "RobotoSlab-Medium.ttf", 15, f"HP: {gunnar.health}/{gunnar.max_health}", BLACK, 275, 75, True)