示例#1
0
def launch_intro_text2():
    S = parameters.W
    screen = thorpy.get_screen()
    title_text = "The beginning (2)"
    title = thorpy.make_text(title_text, thorpy.style.TITLE_FONT_SIZE, TCOLOR)
    end_text = "... My only hope now is to become the greatest racer.."
    end_text = thorpy.pack_text(400, end_text)
    end = thorpy.make_text(end_text, thorpy.style.TITLE_FONT_SIZE, TCOLOR)
    letter = thorpy.make_text(thorpy.pack_text(int(0.7 * S), INTRO2))
    w = letter.get_fus_rect().w + 10
    boxletter = thorpy.Box.make([letter], (w, S // 2))
    boxletter.refresh_lift()
    thorpy.style.BOX_RADIUS += 10
    background = thorpy.load_image("PaulinaRiva.png")
    background = thorpy.get_resized_image(background,
                                          (parameters.W, parameters.H // 2),
                                          type_=max)
    ##    background = thorpy.Background.make(image=background)
    thorpy.get_screen().blit(background, (0, 0))
    pygame.display.flip()
    box = thorpy.make_ok_box([title, boxletter, end], "Ok")
    box.e_ok.user_func = thorpy.functions.quit_menu_func
    box.e_ok.user_params = {}
    boxletter.set_main_color((200, 200, 200, 50))
    box.set_main_color((200, 200, 255, 100))
    box.center()
    thorpy.style.BOX_RADIUS -= 10
    launch(box)
示例#2
0
def launch_end():
    S = parameters.W
    screen = thorpy.get_screen()
    title_text = "The End"
    title = thorpy.make_text(title_text, thorpy.style.TITLE_FONT_SIZE, TCOLOR)
    text = "You are the first of the Intergalatic Ranking."
    end_text = "... You are free now."
    end_text = thorpy.pack_text(400, end_text)
    end = thorpy.make_text(end_text, thorpy.style.TITLE_FONT_SIZE, TCOLOR)
    letter = thorpy.make_text(thorpy.pack_text(int(0.7 * S), text))
    w = letter.get_fus_rect().w + 10
    boxletter = thorpy.Box.make([letter], (w, S // 2))
    boxletter.refresh_lift()
    thorpy.style.BOX_RADIUS += 10
    background = thorpy.load_image("PaulinaRiva.png")
    background = thorpy.get_resized_image(background,
                                          (parameters.W, parameters.H // 2),
                                          type_=max)
    ##    background = thorpy.Background.make(image=background)
    thorpy.get_screen().blit(background, (0, 0))
    pygame.display.flip()
    box = thorpy.make_ok_box([title, boxletter, end], "Ok")
    box.e_ok.user_func = thorpy.functions.quit_menu_func
    box.e_ok.user_params = {}
    boxletter.set_main_color((200, 200, 200, 50))
    box.set_main_color((200, 200, 255, 100))
    box.center()
    thorpy.style.BOX_RADIUS -= 10
    launch(box)
示例#3
0
def make_instruction(text):
    splits = text.split(":")
    title, corpus = splits[0], "".join(splits[1:])
    corpus = thorpy.pack_text(int(0.6*parameters.S), corpus)
    etitle = thorpy.make_text(title, font_color=(255,0,0))
    ecorpus = thorpy.Element.make(corpus)
    return thorpy.make_group([etitle, ecorpus])
示例#4
0
def get_intro_text():
    image = thorpy.load_image("message_in_a_bottle_by_solid_pawn.png")
    image = pygame.transform.scale(image, (parameters.S,parameters.S))
    title_text = "Dear friend,\nA few years ago, I found a message in a bottle near the sea...\n"
    title = thorpy.make_text(title_text, thorpy.style.TITLE_FONT_SIZE, gui.TCOLOR)
    text = "At that time, I was working hard on that famous Topological Astronomy Problem and I began to inattentively read the message..."+\
            "But to my great surprise, it appeared that the author of the letter, a certain Gottfried Perigeo,"+\
            " was trying to complete a mad - though so brave! - travel around the world, following West-East axis, almost one century ago.\n\n"+\
            "    Except the fact that the poor explorer sent a desperate SOS message that was obviously received hundred year too late,"+\
            " my interest was peaked by the singular axis he was travelling. Here the story joins the Topological Astronomy Problem.\n\n"+\
            "    Indeed, my dear friend, I was - and I'm still - one of the rare physicists to believe that the world has the topology of a torus"+\
            " (explain uneducated people that it's like donut). Despite several celestial hints, most of my colleagues give no credit in this theory, and invest"+\
            "all their energy in proving that our planet is spherical. The situation was the same during Perigeo's life ; since the famous"+\
            "explorer Girato Settentrio completed the South-North around the world travel, it was clear that Gottfried Perigeo thought the planet"+\
            "is a torus , otherwise the travel he initiated was a suicide, because of the absolute extreme difficulty of the West-East round trip, if it exists.\n\n"+\
            "    I know you trust in my science, my friend, and I have to admit you are one of the few ones. Here is my demand:\n"+\
            "Take all my money. Buy ship, hire mens, prepare a big exploration trip. Find Perigeo's shipwreck, pursue his travel, and finish what he began. Bring back with you a keepsake of Perigeo. He deserves it.\n"+\
            "\n        You cannot let him in here."
    end_text = "Prove the world that our planet is toroidal!"
    end = thorpy.make_text(end_text, thorpy.style.TITLE_FONT_SIZE, gui.TCOLOR)
    letter = thorpy.make_text(thorpy.pack_text(int(0.7*parameters.S),text))
    w = letter.get_fus_rect().w + 10
    boxletter = thorpy.Box.make([letter],(w,parameters.S//2))
    boxletter.set_main_color((200,200,255,50))
    boxletter.refresh_lift()
    thorpy.style.BOX_RADIUS += 10
    box = thorpy.make_ok_box([title,boxletter,end],"Accept")
    box.e_ok.user_func = thorpy.functions.quit_menu_func
    box.e_ok.user_params = {}
    box.set_main_color((200,200,255,80))
    box.center()
    background = thorpy.Background(image=image,elements=[box])
    thorpy.style.BOX_RADIUS -= 10
    return background
示例#5
0
def read_treasure(treas):
    title = thorpy.make_text(treas.title,
                             font_size=thorpy.style.FONT_SIZE + 3,
                             font_color=TCOLOR)
    line = thorpy.Line.make(100, "h")
    text = thorpy.make_text(thorpy.pack_text(100, treas.text))
    elements = [title, line, text]

    class Choice:
        ok = False

    def func_cancel():
        Choice.ok = True
        thorpy.functions.quit_menu_func()

    box = thorpy.make_ok_cancel_box(elements, "No, let it there",
                                    "Yes, take it")
    box.e_ok.user_func = thorpy.functions.quit_menu_func
    box.e_ok.user_params = {}
    box.e_cancel.user_func = func_cancel
    box.e_cancel.user_params = {}
    box.center()
    ##    box.add_reaction(thorpy.ConstantReaction(pygame.KEYDOWN,
    ##                                             thorpy.functions.quit_menu_func,
    ##                                             {"key":pygame.K_SPACE}))
    m = thorpy.Menu([box])
    m.play()
    return Choice.ok
示例#6
0
def launch_credits():
    text = "This game was written by Yann Thorimbert for the 2017 PyWeek24 challenge.\n\n"+\
            "The library Thorpy (www.thorpy.org), which makes use of Pygame, was used fot the"+\
            " GUI and some effects like smog, shadows or explosions.\n\n"+\
            "The filenames of the different sounds and images are named after their original author." +\
            "\n\nFeel free to contact the author at [email protected]."
    text = thorpy.pack_text(parameters.W // 2, text)
    e = thorpy.make_textbox("Credits", text)
    e.center()
    launch(e)
示例#7
0
def launch_end_text(score):
    screen = thorpy.get_screen()
    title_text = "The End - Score : " + str(score) + " days"
    title = thorpy.make_text(title_text, thorpy.style.TITLE_FONT_SIZE, gui.TCOLOR)
    text = "Your expedition was a success. After that long trip, you are back to civilization. "+\
            " Perigeo's compass and seals were undoubtedly recognizable, and their memory will now be teached at school."
    end_text = "Regarding yourself and your crew, you will be recorded in the centuries to come as the first to complete a round aroud the world.\n"+\
    " Which has been proven to be a torus."
    end_text = thorpy.pack_text(400,end_text)
    end = thorpy.make_text(end_text, thorpy.style.TITLE_FONT_SIZE, gui.TCOLOR)
    letter = thorpy.make_text(thorpy.pack_text(int(0.7*parameters.S),text))
    w = letter.get_fus_rect().w + 10
    boxletter = thorpy.Box.make([letter],(w,parameters.S//2))
    boxletter.refresh_lift()
    thorpy.style.BOX_RADIUS += 10
    box = thorpy.make_ok_box([title,boxletter,end],"Quit")
    box.e_ok.user_func = thorpy.functions.quit_menu_func
    box.e_ok.user_params = {}
    box.set_main_color((200,200,255))
    box.center()
    thorpy.style.BOX_RADIUS -= 10
    launch(box)
示例#8
0
def launch_perigeo_text():
    screen = thorpy.get_screen()
    title_text = "Dear visitor,\nI apologize for the welcome, which could have been warmer...\n"
    title = thorpy.make_text(title_text, thorpy.style.TITLE_FONT_SIZE, gui.TCOLOR)
    text = "But the crew's death does not help. I tried my best to prove that the world is toroidal."+\
    " According to the theory, my ship has gone beyond the half-perimeter, and we still did not recognize any of the landscapes"+\
    " that some of us saw as members of former Settentrio's expeditions. As a result, I am convinced of the toroidal nature of the world."+\
    " As a proof of my presence so far on the East - well, it is actually the West side of the world now - let my bones on the wild. But..."
    end_text = "... bring my compass and my seal back to civilization, and show them that I was right.\n          Gottfried Perigeo"
    end_text = thorpy.pack_text(400,end_text)
    end = thorpy.make_text(end_text, thorpy.style.TITLE_FONT_SIZE, gui.TCOLOR)
    letter = thorpy.make_text(thorpy.pack_text(int(0.7*parameters.S),text))
    w = letter.get_fus_rect().w + 10
    boxletter = thorpy.Box.make([letter],(w,parameters.S//2))
    boxletter.refresh_lift()
    thorpy.style.BOX_RADIUS += 10
    box = thorpy.make_ok_box([title,boxletter,end],"Accept")
    box.e_ok.user_func = thorpy.functions.quit_menu_func
    box.e_ok.user_params = {}
    box.set_main_color((200,200,255))
    box.center()
    thorpy.style.BOX_RADIUS -= 10
    launch(box)
示例#9
0
def get_journal(game):
    journal_title = thorpy.make_text("Journal",
                                     font_size=thorpy.style.FONT_SIZE + 3,
                                     font_color=TCOLOR)
    line = thorpy.Line.make(100, "h")
    elements = []
    #entries
    for name, day, coord, h, t, text in game.journal.entries:
        e_name = thorpy.make_text(name, font_color=(0, 0, 255))
        infos = thorpy.make_text(" ".join([
            "| Day",
            str(day), ", coord=", coord, ", alt=",
            str(round(h)), ", temp=",
            str(round(t))
        ]),
                                 font_color=(50, 50, 150))
        ##            e_title = thorpy.Element.make(elements=[e_name,infos])
        ##            thorpy.store(e_title, mode="h")
        e_title = thorpy.make_group([e_name, infos])
        e_title.fit_children()
        elements.append(e_title)
        elements.append(thorpy.make_text("    " + thorpy.pack_text(400, text)))
    subbox = thorpy.Element.make(elements=elements, size=(500, 300))
    thorpy.store(subbox, elements, x=3, y=0, align="left", gap=3)

    #
    def add_entry():
        add_journal_entry(game)
        thorpy.functions.quit_menu_func()

    ok = thorpy.make_button("Ok", func=thorpy.functions.quit_menu_func)
    add = thorpy.make_button("Add entry", func=add_entry)
    ok_add = thorpy.make_group([ok, add])
    #
    box = thorpy.Element.make(elements=[journal_title, subbox, ok_add])
    box.set_main_color((200, 200, 200, 100))
    thorpy.store(box)
    box.fit_children()
    box.set_size((None, int(1.3 * subbox.get_fus_rect().h)))
    #
    subbox.set_prison()
    subbox.refresh_lift()
    ##    box.add_reaction(thorpy.ConstantReaction(pygame.KEYDOWN,
    ##                                             thorpy.functions.quit_menu_func,
    ##                                             {"key":pygame.K_SPACE}))
    box.center()
    m = thorpy.Menu([box])
    m.play()
示例#10
0
 def __init__(self, i, ships=None, action=None, text=None, duration=100):
     if i is None:
         if not p.game.scenario.events:
             prev = 0
         else:
              prev = p.game.scenario.events[-1].i
         i = prev + duration + 10
     p.game.scenario.events.append(self)
     self.i = i
     self.ships = ships
     if not ships:
         self.ships = []
     self.action = action
     if text:
         self.text = thorpy.pack_text(p.W, text, thorpy.make_text(" ", 30))
     else:
         self.text = None
     self.duration = duration
示例#11
0
def get_random_element():
    parts = {"tail":["agility","friction","mass"],
             "nose":["agility","friction","mass"],
             "cockpit":["agility","friction","mass"],
             "wings":["agility","friction","mass"],
             "engine":["power","max_fuel"]}
    bfactor = {"agility":1.,"friction":-1.,"mass":-1.,"power":1.,"max_fuel":1.}
    print("Choices", list(parts.keys()))
    part = random.choice(list(parts.keys()))
##    part_arg = part[0].lower() + part[1:]
##    part_arg = getattr(parameters.player.vessel, part_arg)
    MAX_BONUS = 0.3
    bonus = [-MAX_BONUS + random.random()*2.*MAX_BONUS for skill in parts[part]]
    for i,skill in enumerate(parts[part]):
        bonus[i] *= bfactor[skill]
    text = ""
    skills = [part]
    price = sum(bonus)
    for i,b in enumerate(bonus):
        increase = "Lower "
        skill = parts[part][i]
        skills.append((skill,b))
        if b > 0:
            increase = "Increase "
        else:
            b *= -1.
        text += increase + "your overall " + skill.replace("_"," ") + " by " + \
                str(round(b*100)) + " %.\n\n"
    ok_text = "buy"
    cost = "cost: "
    if price < 0:
        text += "You can earn money by exchanging your current " + part + " against this less performant one."
        ok_text = "exchange"
        cost = "gain: "
    text = thorpy.pack_text(300,text)
    price_int = int(price*parameters.PRICE)
    price = " ("+cost+str(abs(price_int)) + " $)"
    box = thorpy.make_textbox("New "+part+":",text,ok_text=ok_text+price)
    print("hu0",box)
    if "gain" in cost:
        box.e_ok.set_main_color((0,255,0))
    else:
        box.e_ok.set_main_color((255,0,0))
    return box, skills, price_int
示例#12
0
def play_carreer(nmissions, starting_mission):
    import missions
    showtext = True
    i = starting_mission
    while i < nmissions:
        if i == 0:
            success = missions.tuto1(True)
            if not success:
                thorpy.launch_blocking_alert("You failed.", "Try again.")
            else:
                i += 1
        elif i == 1:
            success = missions.tuto2(True)
            if not success:
                thorpy.launch_blocking_alert("You failed.", "Try again.")
            else:
                i += 1
        elif i < nmissions-1:
            n = random.randint(1,3)
            t = random.randint(2000,6000)
            sp = 0.45 + random.random()*0.3*i/nmissions
            ep = 0.5 + random.random()*0.3*i/nmissions
            if ep > 0.7:
                sp = 0.5
            thorpy.launch_blocking_alert("Mission "+str(i-1)+"/"+str(nmissions-2), "Click when you are ready.")
            success = missions.lambda_mission(ep, sp, t, n)
            if not success:
                thorpy.launch_blocking_alert("You failed", "Try again.")
            else:
                i += 1
        else:
            thorpy.launch_blocking_alert("Final mission", "Click when you are ready.")
            success = missions.final_mission(showtext)
            if not success:
                showtext = False
                thorpy.launch_blocking_alert("You failed.", "Try again.")
            else:
                i += 1

    txt = thorpy.pack_text(W//2, "Congratulations, you defeated the mothership. This is the end of your fight.")
    thorpy.launch_blocking_alert("The End.", txt)

    menus.launch_credits()
示例#13
0
def get_controllable_choice(title,
                            imgs,
                            names,
                            skills,
                            description,
                            oktext="Hire",
                            star=None):
    img1, img2 = imgs
    name1, name2 = names
    s1, s2 = skills
    description = thorpy.pack_text(300, description)

    class Choice:
        value = None

    def choose1():
        Choice.value = 0
        thorpy.functions.quit_menu_func()

    def choose2():
        Choice.value = 1
        thorpy.functions.quit_menu_func()

    #

    #
    e1 = get_object(img1, oktext, choose1, name1, skills[0], star)
    e2 = get_object(img2, oktext, choose2, name2, skills[1], star)
    #
    edescr = thorpy.make_text(description)
    etitle = thorpy.make_text(title,
                              font_size=thorpy.style.FONT_SIZE + 3,
                              font_color=gui.TCOLOR)
    box = thorpy.Box.make([etitle, edescr, e1, e2])
    box.center()
    #
    m = thorpy.Menu([box])
    m.play()
    return Choice.value
示例#14
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)
示例#15
0
def get_cannibalism(game):
    title = thorpy.make_text("Cannibalism",
                             font_size=thorpy.style.FONT_SIZE + 3,
                             font_color=TCOLOR)
    descr = thorpy.make_text("Who should be eaten by the others?")

    class Choice:
        choice = None

    def choice1():
        if thorpy.launch_binary_choice("Are you sure?"):
            Choice.choice = "a"
            thorpy.functions.quit_menu_func()
        else:
            box.unblit_and_reblit()

    def choice2():
        Choice.choice = "c"
        thorpy.functions.quit_menu_func()

    def choice3():
        Choice.choice = "h"
        thorpy.functions.quit_menu_func()


##    a = thorpy.make_button()
##    choices = [a, c, h, ("cancel",None)]

    a = thorpy.pack_text(150,
                         "You won't be able to know your position anymore.")
    c = thorpy.pack_text(150, "Sailing will become very difficult. ")
    h = thorpy.pack_text(
        150, "Your chances of sucess while hunting will be very low.")
    choices = [(a, choice1), (c, choice2), (h, choice3), ("cancel", None)]
    ##    thorpy.launch_blocking_choices("Blocking choices box!\n", choices,
    ##                                    parent=game.element) #for auto unblit
    ##    launcher = thorpy.launch_choices("LOL", choices)
    ##    launcher.launch()

    ea = thorpy.make_button("Astronomer", choice1)
    ea.set_main_color((0, 0, 255))
    at = thorpy.make_text(a, font_size=thorpy.style.FONT_SIZE - 2)
    ab = thorpy.make_group([ea, at], "v")
    #
    ec = thorpy.make_button("Captain", choice2)
    ec.set_main_color((255, 0, 0))
    ct = thorpy.make_text(c, font_size=thorpy.style.FONT_SIZE - 2)
    cb = thorpy.make_group([ec, ct], "v")
    #
    eh = thorpy.make_button("Hunter", choice3)
    eh.set_main_color((0, 255, 0))
    ht = thorpy.make_text(h, font_size=thorpy.style.FONT_SIZE - 2)
    hb = thorpy.make_group([eh, ht], "v")
    #
    cancel = thorpy.make_button("Cancel")
    cancel.set_as_menu_exiter()
    #
    bar1, bar2 = thorpy.Line.make(100, "h"), thorpy.Line.make(100, "h")
    #
    crew = []
    if game.a.life > 0:
        crew.append(ab)
    if game.h.life > 0:
        crew.append(hb)
    if game.c.life > 0:
        crew.append(cb)
    elements = [title, descr, bar1] + crew + [bar2, cancel]
    ##    box = thorpy.Element.make(elements=elements)
    ##    thorpy.store(box,mode="h")
    box = thorpy.Box.make(elements)
    box.center()
    m = thorpy.Menu([box])
    m.play()
    return Choice.choice
示例#16
0
 def launch_credits():
     text = "Author: Yann Thorimbert ([email protected])\n"+\
             "Libraries used: NumPy, Pygame, ThorPy (www.thorpy.org)\n\n"+\
             "If you are interested in the procedural world generation technique used in this game, please do not hesitate to contact the author."
     text = thorpy.pack_text(int(0.8 * parameters.S), text)
     thorpy.launch_blocking_alert(text)
示例#17
0
 def refresh(self):
     ##mon.append("a")
     for e in self.events:
         e.refresh()
     self.add_random_ship()
     pos = pygame.mouse.get_pos()
     self.process_key_pressed()
     #refresh ships logics
     for ship in self.ships:
         ship.ia()
         ship.refresh()
     ###mon.append("b")
     # refresh bullets
     for bullet in self.bullets:
         bullet.refresh()
     # refresh rockets
     for rocket in self.rockets:
         rocket.refresh()
     ###mon.append("c")
     # process smoke
     g.smoke_gen.kill_old_elements()
     g.fire_gen.kill_old_elements()
     ###mon.append("d")
     if p.NSMOKE > 1:
         g.smoke_gen.update_physics(V2())
         g.fire_gen.update_physics(V2())
     ###mon.append("e")
     # process debris
     for d in shipm.fn_debris.values():
         d.kill_old_elements(self.screen.get_rect())
         d.update_physics(dt=0.1)
     ###mon.append("f")
     # refresh screen
     self.e_background.blit()
     for s in self.ships:
         if s.shadow:
             self.screen.blit(s.shadow, V2(s.rect.topleft)+p.SHADOW_POS)
         self.screen.blit(s.img, s.rect)
     ###mon.append("g")
     if p.NSMOKE > 1:
         g.smoke_gen.draw(self.screen)
         g.fire_gen.draw(self.screen)
     ###mon.append("h")
     # draw weapons
     for bullet in self.bullets:
         bullet.draw()
     for rocket in self.rockets:
         rocket.draw()
     if self.laser > 0:
         self.laser -= 1
         self.draw_laser()
     ###mon.append("i")
     #draw debris
     for d in shipm.fn_debris.values():
         d.draw(self.screen)
     ###mon.append("j")
     self.hud.refresh_and_draw()
     self.refresh_and_draw_alerts()
     pygame.display.flip()
     self.i += 1
     ###mon.append("k")
     self.remaining_time = (self.tot_time - self.i) / self.tot_time
     if self.remaining_time < 0:
         if self.hero.life > 0:
             self.success = True
             txt = thorpy.pack_text(W//2, "Congratulations. The time is elapsed and you survived.")
             thorpy.launch_blocking_alert("Stage completed!", txt)
             thorpy.functions.quit_menu_func()
         else:
             txt = thorpy.pack_text(W//2, "You failed at the last minute...")
             thorpy.launch_blocking_alert("Try again!", txt)
             thorpy.functions.quit_menu_func()