def game_status(self, window, screen_width: int): """ Display the game status for the main indexes :param window - Surface it wil be created on :param screen_width - Width of the surface :return: """ title = thorpy.OneLineText('Game Status') title.set_font_size(15) title.set_font_color(self.white) cfc = thorpy.Element("CFC: 8%") cfc.set_font_size(10) cfc.set_size((60, 25)) sf9 = thorpy.Element("SF9: 9%") sf9.set_font_size(10) sf9.set_size((60, 25)) methane = thorpy.Hoverable("Methane: 100%") methane.set_font_size(10) methane.set_size((100, 25)) box = thorpy.Box(elements=[title, cfc, sf9, methane]) box.surface = window box.set_topleft((screen_width - 220, self.distance_from_border)) box.set_main_color(self.status_color) box.blit() box.update()
def get_infoalert_text(*texts, start="normal"): h = get_help_text(*texts, start) e = thorpy.Element("",[h]) ## e.set_font_size(HFS) ## e.set_font_color(HFC) thorpy.store(e) e.set_main_color((200,200,200,100)) e.fit_children() return e
def createButton(title, index, painter1, painter2): # Declare Variables button = None #Clickable(thorpy) # Create button if index != Scoreboard.displayGame: # Clickable Button button = thorpy.Clickable(title) button.user_func = Scoreboard.changeGame button.user_params = {"gameID": index} button.set_painter(painter1) button.finish() button.set_font_size(17) button.set_font_color_hover((255, 255, 255)) else: # Non-clickable Button button = thorpy.Element(title) button.set_painter(painter2) button.finish() button.set_font_size(17) # Return return button
def run(): import thorpy application = thorpy.Application((600, 600), "ThorPy test") ##thorpy.theme.set_theme("human") #### SIMPLE ELEMENTS #### ghost = thorpy.Ghost() ghost.finish() element = thorpy.Element("Element") element.finish() thorpy.makeup.add_basic_help( element, "Element instance:\nMost simple graphical element.") clickable = thorpy.Clickable("Clickable") clickable.finish() clickable.add_basic_help( "Clickable instance:\nCan be hovered and pressed.") draggable = thorpy.Draggable("Draggable") draggable.finish() thorpy.makeup.add_basic_help(draggable, "Draggable instance:\nYou can drag it.") #### SIMPLE Setters #### checker_check = thorpy.Checker("Checker") checker_check.finish() thorpy.makeup.add_basic_help( checker_check, "Checker instance:\nHere it is of type 'checkbox'.") checker_radio = thorpy.Checker("Radio", typ="radio") checker_radio.finish() thorpy.makeup.add_basic_help( checker_radio, "Checker instance:\nHere it is of type 'radio'.") browser = thorpy.Browser("../../", text="Browser") browser.finish() browser.set_prison() browserlauncher = thorpy.BrowserLauncher(browser, name_txt="Browser", file_txt="Nothing selected", launcher_txt="...") browserlauncher.finish() browserlauncher.scale_to_title() thorpy.makeup.add_basic_help( browserlauncher, "Browser instance:\nA way for user to find a file or" + "\na folder on the computer.") dropdownlist = thorpy.DropDownListLauncher( name_txt="DropDownListLauncher", file_txt="Nothing selected", titles=[str(i) for i in range(1, 9)]) dropdownlist.finish() dropdownlist.scale_to_title() thorpy.makeup.add_basic_help(dropdownlist, "DropDownList:\nDisplay a list of choices.") slider = thorpy.SliderX(120, (5, 12), "Slider: ", typ=float, initial_value=8.4) slider.finish() thorpy.makeup.add_basic_help( slider, "SliderX:\nA way for user to select a value." + "\nCan select any type of number (int, float, ..).") slider.set_center inserter = thorpy.Inserter(name="Inserter: ", value="Write here.") inserter.finish() thorpy.makeup.add_basic_help( inserter, "Inserter:\nA way for user to insert a value.") text_title = thorpy.make_text("Test Example", 25, (0, 0, 255)) central_box = thorpy.Box("", [ ghost, element, clickable, draggable, checker_check, checker_radio, dropdownlist, browserlauncher, slider, inserter ]) central_box.finish() central_box.center() central_box.add_lift() central_box.set_main_color((200, 200, 255, 120)) background = thorpy.Background(color=(200, 200, 200), elements=[text_title, central_box]) background.finish() thorpy.store(background) menu = thorpy.Menu(background) menu.play() application.quit()
def __init__(self): ## if not parameters.canonic_vessels: ## get_all_parts() self.vessel = parameters.player.vessel.get_copy() self.ovessel = parameters.player.vessel self.screen = thorpy.get_screen() # light_pos = V3(0,1000,-1000) light_m = V3(20,20,20) light_M = V3(200,200,200) self.light = light.Light(light_pos, light_m, light_M) # self.e_bckgr = thorpy.Background.make((255,255,255)) self.vessel.set_pos(parameters.GARAGE_POS) reaction = thorpy.ConstantReaction(thorpy.THORPY_EVENT, self.refresh_display, {"id":thorpy.constants.EVENT_TIME}) self.e_bckgr.add_reaction(reaction) reaction = thorpy.Reaction(pygame.MOUSEMOTION, self.mousemotion) self.e_bckgr.add_reaction(reaction) # self.viewport = pygame.Surface((400,400)) self.viewport_color = (200,200,200) self.viewport_rect = pygame.Rect((0,0),self.viewport.get_size()) self.viewport_rect.right = parameters.W - 20 self.viewport_rect.centery = parameters.H//2 self.cam = camera.Camera(self.viewport, fov=512, d=2, objs=[]) # # # self.e_ok = thorpy.make_button("Go to next race", func=thorpy.functions.quit_menu_func) self.e_ok.set_main_color((0,255,0)) self.e_ok.set_font_size(thorpy.style.FONT_SIZE+3) self.e_ok.scale_to_title() # # def refresh_repair(): damages = str(round(100.*(1. - self.ovessel.life/self.ovessel.max_life))) self.e_damage.set_text("Vessel damages: " + damages + "%") self.e_money.set_text("Money: "+str(parameters.player.money)+" $") def choice_repair(): cost = (self.ovessel.max_life - self.ovessel.life)*300 if cost <= parameters.player.money: if thorpy.launch_binary_choice("Are you sure? This will cost "+\ str(cost)+"$"): self.ovessel.life = self.ovessel.max_life parameters.player.money -= cost refresh_repair() elif thorpy.launch_binary_choice("Repairing costs "+str(cost)+\ " $. You don't have enough money.\n"+\ "Do you want to use all your money for"+\ " repairing as much as possible?"): #(after_repair - self.ovessel.life)*300 = money #==> after_repair = money/300 + self.ovessel.life repaired = int(parameters.player.money/300. + self.ovessel.life) parameters.player.money -= (repaired - self.ovessel.life)*300 self.ovessel.life = repaired refresh_repair() self.e_bckgr.blit() self.refresh_display() pygame.display.flip() self.e_repair = thorpy.make_button("Repair vessel",choice_repair) # damages = str(round(100.*(1. - self.ovessel.life/self.ovessel.max_life))) self.e_damage = thorpy.make_text("Vessel damages: " + damages + "%") self.e_ranking = thorpy.make_button("See rankings", launch_rankings, {"garage":self}) ## self.e_ranking = get_rankings_box() def quit_forever(): if thorpy.launch_binary_choice("Are you sure ?"): thorpy.functions.quit_func() else: self.e_bckgr.unblit_and_reblit() self.e_menu = thorpy.make_button("Stop career and die (forever)", func=quit_forever) self.e_menu.set_main_color((255,0,0)) self.e_menu.set_font_size(thorpy.style.FONT_SIZE-2) self.e_menu.scale_to_title() # vw,vh = self.viewport_rect.size self.e_viewport_frame = thorpy.Element() painter = thorpy.painterstyle.ClassicFrame((vw+3,vh+3), color=self.viewport_color, pressed=True) self.e_viewport_frame.set_painter(painter) self.e_viewport_frame.finish() self.e_viewport_frame.set_center(self.viewport_rect.center) # import hud fuel = str(round(100*self.ovessel.engine.fuel/self.ovessel.engine.max_fuel)) self.e_fuel = hud.LifeBar("Fuel: "+fuel+" %",text_color=(255,0,0),size=(100,30)) self.e_fuel.set_life(self.ovessel.engine.fuel/self.ovessel.engine.max_fuel) def refresh_refuel(): life = self.ovessel.engine.fuel / self.ovessel.engine.max_fuel self.e_fuel.set_life(life) self.e_fuel.set_text("Fuel: "+str(round(life*100))+" %") self.e_money.set_text("Money: "+str(parameters.player.money)+" $") def choice_refuel(): cost = (self.ovessel.engine.max_fuel - self.ovessel.engine.fuel)//2 if cost <= parameters.player.money: if thorpy.launch_binary_choice("Are you sure? This will cost "+\ str(cost)+"$"): self.ovessel.engine.fuel = self.ovessel.engine.max_fuel parameters.player.money -= cost refresh_refuel() ## self.e_fuel.set_life(1.) ## self.e_fuel.set_life_text("Fuel: 100 %") ## parameters.player.money -= cost ## self.e_money.set_text("Money: "+str(parameters.player.money)+" $") ## self.ovessel.engine.fuel = self.ovessel.engine.max_fuel elif thorpy.launch_binary_choice("Refueling costs "+str(cost)+" $. You don't have enough money.\n"+\ "Do you want to spend all your money to refuel as much as possible?"): #cost = (newfuel - fuel)//2 ==> 2*cost + fuel = newfuel self.ovessel.engine.fuel += 2*parameters.player.money parameters.player.money = 0 refresh_refuel() ## thorpy.launch_blocking_alert("Refueling costs "+str(cost)+" $. You don't have enough money.") self.e_bckgr.blit() self.refresh_display() pygame.display.flip() self.e_refuel = thorpy.make_button("Refuel",choice_refuel) self.e_money = thorpy.make_text("Money: "+str(parameters.player.money)+" $", thorpy.style.TITLE_FONT_SIZE,(255,0,0)) self.e_money.stick_to("screen","top","top") self.e_money.move((0,30)) # self.e_box = thorpy.Box.make([self.e_damage,self.e_repair, thorpy.Line.make(100,"h"),self.e_fuel, self.e_refuel, thorpy.Line.make(100,"h"), self.e_ranking,self.e_ok]) self.e_bckgr.add_elements([self.e_box,self.e_menu]) thorpy.store(self.e_bckgr, x = 200) self.e_skills = get_vessel_element(parameters.player.vessel) self.e_bckgr.add_elements([self.e_viewport_frame,self.e_money, self.e_skills]) self.e_menu.move((0,30)) self.e_skills.stick_to(self.e_viewport_frame, "left", "right") self.i = 0
def buy_part(parent): background = thorpy.load_image("background_garage.jpg") background = thorpy.get_resized_image(background, (parameters.W,parameters.H), type_=max) thorpy.get_screen().blit(background,(0,0)) pygame.display.flip() title = thorpy.make_text("Vessel merchant", thorpy.style.TITLE_FONT_SIZE+4, (255,0,0)) hbar = thorpy.Line.make(200, "h") intro = "Hello, "+str(parameters.player.name)+"."+\ "\nHere is what I have to sell today:" intro = thorpy.make_text(intro, thorpy.style.TITLE_FONT_SIZE, thorpy.style.TITLE_FONT_COLOR) # money = thorpy.Element(thorpy.pack_text(200,"Your money: "+str(parameters.player.money)+" $.")) money.set_painter(thorpy.functions.obtain_valid_painter(thorpy.painterstyle.DEF_PAINTER, pressed=True)) money.finish() money.scale_to_title() # info = thorpy.Element(thorpy.pack_text(200,"Remember that any part you buy will replace your current one.")) info.set_painter(thorpy.functions.obtain_valid_painter(thorpy.painterstyle.DEF_PAINTER, pressed=True)) info.finish() info.scale_to_title() money_info = thorpy.Ghost.make([info, money]) thorpy.store(money_info, mode="h") money_info.fit_children() # part1, skills1, price1 = get_random_element() part2, skills2, price2 = get_random_element() choices = thorpy.Ghost.make(elements=[part1,part2]) thorpy.store(choices, mode="h") choices.fit_children() cancel = thorpy.make_button("No, thanks", thorpy.functions.quit_menu_func) # def buy(part, cost): if cost > parameters.player.money: thorpy.launch_blocking_alert("Not enough money", "You don't have enough money to buy this part.",transp=False) box.unblit_and_reblit() else: parameters.player.money -= cost name = part.pop(0) if name == "wings": parts = [getattr(parameters.player.vessel, "lwing"), getattr(parameters.player.vessel, "rwing")] else: parts = [getattr(parameters.player.vessel, name)] for part_obj in parts: for skillname, factor in part: if skillname == "agility": skillname = "turn" elif skillname == "power": parameters.player.vessel.engine_force *= (1.+factor) elif skillname == "max_fuel": parameters.player.vessel.engine.max_fuel *= (1.+factor) elif skillname == "mass": parameters.player.vessel.engine_force *= parameters.player.vessel.mass parameters.player.vessel.mass *= (1.+factor) parameters.player.vessel.engine_force /= parameters.player.vessel.mass parameters.player.vessel.max_life = int(parameters.player.vessel.mass * parameters.LIFE_FACTOR) else: current_value = getattr(parameters.player.vessel, skillname) new_value = current_value + factor*current_value/6. setattr(parameters.player.vessel, skillname, new_value) thorpy.functions.quit_menu_func() part1.e_ok.user_func = buy part1.e_ok.user_params = {"part":skills1, "cost":price1} part2.e_ok.user_func = buy part2.e_ok.user_params = {"part":skills2, "cost":price2} # box = thorpy.Box.make([title,hbar,intro,money_info,choices,cancel]) box.center() thorpy.launch_blocking(box)
import thorpy #Declaration of the application in which the menu is going to live. application = thorpy.Application(size=(500, 500), caption='ThorPy stupid Example') #Setting the graphical theme. By default, it is 'classic' (windows98-like). thorpy.theme.set_theme('human') #Declaration of some elements... useless1 = thorpy.Element("This button is useless.\nAnd you can't click it.") text = "This button also is useless.\nBut you can click it anyway." useless2 = thorpy.Clickable(text) draggable = thorpy.Draggable("Drag me!") box1 = thorpy.make_ok_box([useless1, useless2, draggable]) options1 = thorpy.make_button("Some useless things...") thorpy.set_launcher(options1, box1) inserter = thorpy.Inserter(name="Tip text: ", value="This is a default text.", size=(150, 20)) file_browser = thorpy.Browser(path="C:/Users/", text="Please have a look.") browser_launcher = thorpy.BrowserLauncher(browser=file_browser, const_text="Choose a file: ", var_text="")
def run(): application = thorpy.Application((800, 600), "ThorPy Overview") element = thorpy.Element("Element") thorpy.makeup.add_basic_help(element, "Element:\nMost simple graphical element.") clickable = thorpy.Clickable("Clickable") thorpy.makeup.add_basic_help(clickable, "Clickable:\nCan be hovered and pressed.") draggable = thorpy.Draggable("Draggable") thorpy.makeup.add_basic_help(draggable, "Draggable:\nYou can drag it.") checker_check = thorpy.Checker("Checker") checker_radio = thorpy.Checker("Radio", type_="radio") browser = thorpy.Browser("../../", text="Browser") browserlauncher = thorpy.BrowserLauncher.make(browser, const_text="Choose file:", var_text="") browserlauncher.max_chars = 20 #limit size of browser launcher dropdownlist = thorpy.DropDownListLauncher( const_text="Choose number:", var_text="", titles=[str(i) * i for i in range(1, 9)]) dropdownlist.scale_to_title() dropdownlist.max_chars = 20 #limit size of drop down list slider = thorpy.SliderX(80, (5, 12), "Slider: ", type_=float, initial_value=8.4) inserter = thorpy.Inserter(name="Inserter: ", value="Write here.") quit = thorpy.make_button("Quit", func=thorpy.functions.quit_menu_func) title_element = thorpy.make_text("Overview example", 22, (255, 255, 0)) elements = [ element, clickable, draggable, checker_check, checker_radio, dropdownlist, browserlauncher, slider, inserter, quit ] central_box = thorpy.Box(elements=elements) central_box.fit_children(margins=(30, 30)) #we want big margins central_box.center() #center on screen central_box.add_lift() #add a lift (useless since box fits children) central_box.set_main_color( (220, 220, 220, 180)) #set box color and opacity background = thorpy.Background.make(image=thorpy.style.EXAMPLE_IMG, elements=[title_element, central_box]) thorpy.store(background) menu = thorpy.Menu(background) menu.play() application.quit()
#ThorPy storage tutorial : manual placing import thorpy, random application = thorpy.Application(size=(400, 400), caption="Storage") elements = [thorpy.make_button("button" + str(i)) for i in range(13)] for e in elements: w, h = e.get_rect().size w, h = w * (1 + random.random() / 2.), h * (1 + random.random() / 2.) e.set_size((w, h)) elements[6] = thorpy.Element(text="") elements[6].set_size((100, 100)) elements[0].set_topleft((10, 300)) elements[1].set_topleft(elements[0].get_rect().bottomright) elements[2].set_center((100, 200)) elements[3].stick_to(elements[2], target_side="bottom", self_side="top") elements[4].stick_to(elements[2], target_side="right", self_side="left") background = thorpy.Background(color=(200, 200, 255), elements=elements) thorpy.store(background, elements[6:12], x=380, align="right") elements[5].center(element=elements[6]) elements[5].rank = elements[6].rank + 0.1 #be sure number 5 is blitted after 6 background.sort_children_by_rank() #tell background to sort its children elements[12].set_location((0.1, 0.2)) #relative placing of number 12 menu = thorpy.Menu(background) menu.play() application.quit()
def show_players_infos(self): w = self.game.me.screen.get_width() // 2 objs = ["village", "windmill", "tower"] unit_types = set([u.str_type for u in self.game.units]) boxes = [] o_e = [] for pn in [0, 1]: p = self.game.players[pn] title = thorpy.make_text(p.name, 15, p.color_rgb) line = thorpy.Line(w, "h") p = self.game.players[pn] els = [] for typ in objs: for o in self.game.get_objects_of_team(p.team, typ): ## img = self.game.me.extract_img(o.cell) if typ == "village": img = self.game.village.imgs_z_t[0][0] elif typ == "windmill": img = self.game.windmill.imgs_z_t[0][0] elif typ == "tower": img = p.race.tower.imgs_z_t[0][0] els.append(thorpy.Image(img)) o_e.append((els[-1], o)) thorpy.grid_store(10, pygame.Rect(0, 0, 100, 100), els) g_buildings = thorpy.make_group(els, mode=None) # els = [] for typ in unit_types: for u in self.game.units: if u.str_type == typ and u.race.team == p.team: img = u.imgs_z_t[0][u.get_current_frame()] els.append(thorpy.Image(img)) o_e.append((els[-1], u)) thorpy.grid_store(10, pygame.Rect(0, 0, 100, 100), els) g_units = thorpy.make_group(els, mode=None) # money_img = thorpy.Image(self.e_gold_img.get_image()) money_txt = thorpy.make_text(str(p.money)) income = self.game.compute_player_income(p) income_txt = thorpy.make_text(" (income: " + str(income) + ")") g_money = thorpy.make_group([money_img, money_txt, income_txt]) g = thorpy.Element( elements=[title, line, g_units, g_buildings, g_money]) thorpy.store(g) g.fit_children() boxes.append(g) e = thorpy.Box(boxes) e.center() def refresh(): for element, obj in o_e: img = obj.imgs_z_t[0][obj.get_current_frame()] ## fire = self.game.get_object("fire", obj.cell.coord) ## if fire: ## img_fire = fire.imgs_z_t[0][fire.get_current_frame()] ## r = img_fire.get_rect() ## w,h = img.get_size() ## r.center = w//2, h//2 ## r.bottom = h ## img.blit(img_fire, r) element.set_image(img) self.game.me.func_reac_time() self.game.t += 1 e.blit() pygame.display.flip() thorpy.add_time_reaction(e, refresh) def click(): if not e.get_fus_rect().collidepoint(pygame.mouse.get_pos()): thorpy.functions.quit_menu_func() thorpy.add_click_reaction(e, click) m = thorpy.Menu(e, fps=self.game.me.fps) m.play()
import thorpy application = thorpy.Application((800, 600), "ThorPy Overview") text = thorpy.make_text("Some text", 12, (0, 0, 255)) line = thorpy.Line(200, "h") #horizontal line of width = 200px element = thorpy.Element("Element") thorpy.makeup.add_basic_help(element, "Element:\nMost simple graphical element.") clickable = thorpy.Clickable("Clickable") thorpy.makeup.add_basic_help(clickable, "Clickable:\nCan be hovered and pressed.") draggable = thorpy.Draggable("Draggable") thorpy.makeup.add_basic_help(draggable, "Draggable:\nYou can drag it.") checker_check = thorpy.Checker("Checker") checker_radio = thorpy.Checker("Radio", type_="radio") browser = thorpy.Browser("../../", text="Browser") browserlauncher = thorpy.BrowserLauncher(browser, const_text="Choose file:", var_text="") browserlauncher.max_chars = 15 #limit size of browser launcher dropdownlist = thorpy.DropDownListLauncher( const_text="Choose:",
def __init__(self, title, ok_text, ranking, results=False, choosevessel=False): refresh_ranking() # light_pos = V3(0, 1000, -1000) light_m = V3(20, 20, 20) light_M = V3(200, 200, 200) self.light = light.Light(light_pos, light_m, light_M) self.viewport = pygame.Surface((400, int(parameters.H * 0.6))) self.viewport_color = (200, 200, 200) self.viewport.fill(self.viewport_color) self.viewport_rect = pygame.Rect((0, 0), self.viewport.get_size()) self.viewport_rect.centerx = parameters.W // 2 + 100 self.viewport_rect.centery = parameters.H // 2 self.cam = camera.Camera(self.viewport, fov=512, d=2, objs=[]) self.screen = thorpy.get_screen() self.displayed_vessel = None self.i = 0 # if results: ranking[0].points += 1 ranking[0].money += 300 + (parameters.NPLAYERS - ranking[0].ranking) * 100 ranking[2].points -= 1 ranking[2].money += 100 ranking[1].money += 200 if ranking[2].points < 0: ranking[2].points = 0 # self.trophy = None if choosevessel: self.e_players = [] def other_vessel(): self.vessels[0] = create_vessel(parameters.HERO_COLOR) self.vessels[0].set_pos(V3(0, -1 * 4.5, 20)) self.vessels[0].move(V3(0, 4, 0)) self.displayed_vessel = self.vessels[0] #replace self.ve new_ve = get_vessel_element(self.vessels[0]) self.e_bckgr.replace_element(self.ve, new_ve) thorpy.functions.refresh_current_menu() self.ve = new_ve self.e_bckgr.unblit_and_reblit() b = thorpy.make_button("Generate another vessel", other_vessel) c = thorpy.make_button("Done", thorpy.functions.quit_menu_func) self.e_players.append(b) self.e_players.append(c) from main import create_vessel self.vessels = [create_vessel(parameters.HERO_COLOR)] self.displayed_vessel = self.vessels[0].get_copy() self.ve = get_vessel_element(self.vessels[0]) self.e_players.append(self.ve) else: if results: self.e_players = [ p.get_element(str(i + 1) + ") ") for i, p in enumerate(ranking) ] else: self.e_players = [ p.get_element() for i, p in enumerate(ranking) ] self.vessels = [p.vessel.get_copy() for p in ranking] if results: import core3d from light import Material self.trophy = core3d.Object3D("trophy1.stl") self.trophy.set_color(Material((255, 215, 0))) ## self.trophy.set_color((255,255,0)) self.trophy.set_pos(V3(5., -0 * 4.5 - 0.2, 15)) self.trophy.rotate_around_center_z(90.) self.trophy.rotate_around_center_x(-65.) self.trophy.move(V3(0, 4, 0)) self.background = thorpy.load_image("background1.jpg") self.background = thorpy.get_resized_image( self.background, (parameters.W, parameters.H // 2), type_=max) self.e_bckgr = thorpy.Background.make(image=self.background, elements=self.e_players) # vw, vh = self.viewport_rect.size self.e_viewport_frame = thorpy.Element() painter = thorpy.painterstyle.ClassicFrame((vw + 3, vh + 3), color=self.viewport_color, pressed=True) self.e_viewport_frame.set_painter(painter) self.e_viewport_frame.finish() self.e_viewport_frame.set_center(self.viewport_rect.center) # reaction = thorpy.ConstantReaction(thorpy.THORPY_EVENT, self.refresh_display, {"id": thorpy.constants.EVENT_TIME}) self.e_bckgr.add_reaction(reaction) if not choosevessel: for i, v in enumerate(self.vessels): pos = self.e_players[i].get_fus_rect().center v.set_pos(V3(0, -i * 4.5, 20)) v.move(V3(0, 4, 0)) else: self.vessels[0].set_pos(V3(0, -1 * 4.5, 20)) self.vessels[0].move(V3(0, 4, 0)) # self.displayed_vessel.set_pos(V3(0, -1 * 4.5, 20)) self.displayed_vessel.move(V3(0, 4, 0)) # thorpy.store(self.e_bckgr, gap=40) for e in self.e_players: e.stick_to(self.viewport_rect, "left", "right", align=False) e.move((-5, 0)) self.e_title = get_etitle(title) if not choosevessel: self.e_ok = get_eok(ok_text) self.e_bckgr.add_elements( [self.e_viewport_frame, self.e_title, self.e_ok]) else: self.e_bckgr.add_elements([self.e_viewport_frame, self.e_title]) self.goback = False def return_garage(): self.derotate() self.goback = True thorpy.functions.quit_menu_func() if not results and not choosevessel: self.e_back = thorpy.make_button("Return to garage", return_garage) self.e_back.stick_to(self.e_ok, "left", "right") self.e_back.move((-20, 0)) self.e_bckgr.add_elements([self.e_back]) if not results: reaction = thorpy.Reaction(pygame.MOUSEMOTION, self.mousemotion) self.e_bckgr.add_reaction(reaction) m = thorpy.Menu(self.e_bckgr) m.play()