def on_draw(player: arcade.Window): arcade.start_render() arcade.draw_text("Buffs", 20, 570, arcade.color.BLACK, 50) arcade.draw_text("Item Count:", 20, 520, arcade.color.BLACK, 30) arcade.draw_text(str(len(player.buff_list)), 250, 520, arcade.color.BLACK, 30) arcade.draw_text("Q - Sort", 30, 30, arcade.color.BLACK, 60) arcade.draw_text("E - Search", 370, 30, arcade.color.BLACK, 60) arcade.draw_xywh_rectangle_outline(10, 405, 450, 70, arcade.color.GRAY, 3) arcade.draw_xywh_rectangle_outline(5, 290, 460, 90, arcade.color.BLACK, 5) arcade.draw_xywh_rectangle_outline(10, 193, 450, 70, arcade.color.GRAY, 3) if player.get_pointer() - 1 != -1: arcade.draw_text( "{}: {}".format(player.buff_list[player.get_pointer() - 1].name, player.buff_list[player.get_pointer() - 1].effect), 20, 425, arcade.color.BLACK, 20) arcade.draw_text( "{}: {}".format(player.buff_list[player.get_pointer()].name, player.buff_list[player.get_pointer()].effect), 20, 320, arcade.color.BLACK, 20) if player.get_pointer() + 1 != len(player.buff_list): arcade.draw_text( "{}: {}".format(player.buff_list[player.get_pointer() + 1].name, player.buff_list[player.get_pointer() + 1].effect), 20, 213, arcade.color.BLACK, 20) arcade.draw_triangle_filled(475, 335, 495, 315, 495, 355, arcade.color.BLACK) arcade.draw_xywh_rectangle_outline(500, 210, 250, 250, arcade.color.BLACK, 10) arcade.draw_texture_rectangle( 625, 335, 240, 240, player.buff_list[player.get_pointer()].texture) arcade.draw_text( "Amount: {}".format(str( player.buff_list[player.get_pointer()].amount)), 465, 150, arcade.color.BLACK, 50) if player.search_menu: arcade.draw_xywh_rectangle_filled(100, 100, 568, 440, arcade.color.BLACK) arcade.draw_xywh_rectangle_filled(110, 110, 548, 420, arcade.color.WHITE) arcade.draw_text("Enter Pokemon Number:", 140, 450, arcade.color.BLACK, 35) arcade.draw_text(" " + player.search_number, 140, 200, arcade.color.BLACK, 220) if player.sort_menu: arcade.draw_xywh_rectangle_filled(100, 100, 568, 440, arcade.color.BLACK) arcade.draw_xywh_rectangle_filled(110, 110, 548, 420, arcade.color.WHITE) arcade.draw_text("Do you want to sort", 115, 380, arcade.color.BLACK, 50) arcade.draw_text("the bag?", 175, 310, arcade.color.BLACK, 50)
def on_draw(player: arcade.Window): arcade.start_render() arcade.draw_text("Potion", 20, 570, arcade.color.BLACK, 50) arcade.draw_text("Q - Sort", 30, 30, arcade.color.BLACK, 60) arcade.draw_xywh_rectangle_outline(10, 405, 450, 70, arcade.color.GRAY, 3) arcade.draw_xywh_rectangle_outline(5, 290, 460, 90, arcade.color.BLACK, 5) arcade.draw_xywh_rectangle_outline(10, 193, 450, 70, arcade.color.GRAY, 3) if player.get_pointer() - 1 != -1: arcade.draw_text( "{}: {}".format(player.heal_list[player.get_pointer() - 1].name, player.heal_list[player.get_pointer() - 1].effect), 20, 425, arcade.color.BLACK, 20) arcade.draw_text( "{}: {}".format(player.heal_list[player.get_pointer()].name, player.heal_list[player.get_pointer()].effect), 20, 320, arcade.color.BLACK, 30) if player.get_pointer() + 1 != len(player.heal_list): arcade.draw_text( "{}: {}".format(player.heal_list[player.get_pointer() + 1].name, player.heal_list[player.get_pointer() + 1].effect), 20, 213, arcade.color.BLACK, 20) arcade.draw_triangle_filled(475, 335, 495, 315, 495, 355, arcade.color.BLACK) arcade.draw_xywh_rectangle_outline(500, 210, 250, 250, arcade.color.BLACK, 10) arcade.draw_texture_rectangle( 625, 335, 240, 240, player.heal_list[player.get_pointer()].texture) arcade.draw_text( "Amount: {}".format(str( player.heal_list[player.get_pointer()].amount)), 465, 150, arcade.color.BLACK, 50) if player.sort_menu: arcade.draw_xywh_rectangle_filled(100, 100, 568, 440, arcade.color.BLACK) arcade.draw_xywh_rectangle_filled(110, 110, 548, 420, arcade.color.WHITE) arcade.draw_text("Do you want to sort", 115, 380, arcade.color.BLACK, 50) arcade.draw_text("by hp healed?", 175, 310, arcade.color.BLACK, 50)
def search_logic(player: arcade.Window, key): if key == arcade.key.W: if player.get_pointer() != 0: player.edit_pointer(player.get_pointer() - 1) elif key == arcade.key.S: if player.get_pointer() != len(player.buff_list) - 1: player.edit_pointer(player.get_pointer() + 1) if key == arcade.key.E or player.search_menu: player.search_menu = True player.sort_menu = False if key == arcade.key.KEY_0: if len(player.search_number) < 2: player.search_number += "0" elif key == arcade.key.KEY_1: if len(player.search_number) < 2: player.search_number += "1" elif key == arcade.key.KEY_2: if len(player.search_number) < 2: player.search_number += "2" elif key == arcade.key.KEY_3: if len(player.search_number) < 2: player.search_number += "3" elif key == arcade.key.KEY_4: if len(player.search_number) < 2: player.search_number += "4" elif key == arcade.key.KEY_5: if len(player.search_number) < 2: player.search_number += "5" elif key == arcade.key.KEY_6: if len(player.search_number) < 2: player.search_number += "6" elif key == arcade.key.KEY_7: if len(player.search_number) < 2: player.search_number += "7" elif key == arcade.key.KEY_8: if len(player.search_number) < 2: player.search_number += "8" elif key == arcade.key.KEY_9: if len(player.search_number) < 2: player.search_number += "9" elif key == arcade.key.BACKSPACE: player.search_number = player.search_number[:-1] if key == arcade.key.L and player.search_number != "": found = binary_search(int(player.search_number), player.buff_list) if found != -1: player.edit_pointer(found) player.search_menu = False player.search_number = "" elif key == arcade.key.K: player.search_menu = False player.search_number = "" if key == arcade.key.Q or player.sort_menu: player.sort_menu = True player.search_menu = False if key == arcade.key.L: player.buff_list = merge_sort(player.buff_list) player.sort_menu = False elif key == arcade.key.K: player.sort_menu = False if key == arcade.key.K: player.cur_screen = "bag"