예제 #1
0
def game_over(score, rank):
    core.play_music("game over", queue=True)
    
    # load game over screen
    goscreen = core.load_image("game_over.png", directory="gfx", auto_alpha=False)
    core.dissolve_transition( core.screen.copy().convert(), goscreen.copy().convert(), 1000 )
    
    while True:
        core.clock.tick(core.MAX_FPS)
        
        events = pygame.event.get()
        
        if core.handleEvents(events) == "quit":
            exit()
            
        for event in events:
            if event.type == KEYUP:
                core.next_screen = core.curry(hiscores_screen, score, rank)
                Input.update()
                return
        
        core.screen.blit(goscreen, (0,0))                        
        core.updateScreen()
예제 #2
0
def game_ending(ns):
    core.play_music("ending", queue=True)
    text_bg = core.load_image("gfx/bg_text.png")
    mo = core.load_image("gfx/movie_overlay.png")
    
    def _(texts):
        if not nvl.show_texts(texts):
            raise eSkipCutScene
            
    def bg(new_bg, overlay=True):
        ls = core.screen.copy().convert()
        core.screen.blit( core.load_image("gfx/" + new_bg), (0,0) )
        if overlay:
            core.screen.blit( mo, (0,0) )
        core.dissolve_transition(ls, core.screen.copy().convert(), nvl.intime)
        nvl.intime = 100
    def cls(color=(0,0,0,255)):
        ls = core.screen.copy().convert()
        core.screen.fill(color)
        core.screen.blit( mo, (0,0) )
        core.dissolve_transition(ls, core.screen.copy().convert(), nvl.intime)
        nvl.intime = 100
        
    nvl = fontmgr.oNvlScreen(x=80,y=80,width=440,height=440,background=text_bg,bg_pos=(50,50),ctc=get_ctc())
    nvl.intime = 1000
    cls()
    try:
        _(['"I was waiting for you."',
           'The gentle voice greeted me as I entered that warm place.',
           'I couldn\'t open my eyes at that time.',
           'I was just so angry at myself.',
           'So angry because I didn\'t realized it before.'])
        _(['But you could say it was just me.',
           'The selfish me.',
           'The unreliable me.',
           'The dummy me.',
           'Even though it was always in front of me I couldn\'t see it.'])
        _([u'\n\n\n\n\n\n\n\n———no.',
           'Rather, I couldn\'t accept it.'])
        _(['I was afraid of hurting myself.',
           'Of breaking the mask of big sis I always wore, even though I never acted like one.'])
        _(['\n\n\n\n\n\n\n\n\nThe stupid selfish me.',
           'The one who always, always hurt the others so to not hurt myself.',
           'The one that sealed the bright part of me deep inside my heart.'])
        _(['It was easier this way.',
           'I needn\'t care about other people problems.',
           'To tell the truth, I didn\'t even care about my owns.'])
        _([u'\n\n\n\n\n\n\n\n———but it\'s already enough.'])
        _(['Like a lie, which can be sweet at start, acting like this will just harm my heart more and more.',
           '\nBecause even if I pretend I don\'t care about the ones I like, I still get hurt when they do.',
           'I still cry when they cry.',
           'I still suffer when they suffer.'])
        _(['But I don\'t smile, for I can\'t show I\'m happy for they.',
           'I don\'t have anyone to cry with me, because I conceal all my feelings.',
           'And even when they\'re down because of me, I still scold them for being so...',
           u'\n\n\n———human.'])
        _(['"It\'s okay now."',
           'Yeah, it\'s okay now.',
           'Because I won\'t run from myself anymore.',
           'I\'ll embrace these feelings and be who I am until the very end.',
           'So I can open my eyes again and lift my gaze.'])
        nvl.intime = 1000
        bg("cg/join_hands.png")
        _(['\n\n\n\n\n\n\n\n\n\nThere\'s a beautiful world waiting for me, if only I want to enjoy it.'])
        _(['"That\'s true."',
           '"Let\'s go togheter."'])
        nvl.intime = 2000
        cls(color=(255,255,255,255))
        _(['"Yume."',
           '\nA familiar voice.',
           '\n\n"Hey, Yume!"',
           '\nA gentle voice.',
           '\n\n"Geez, stop day dreaming already."'])
        nvl.intime = 1000
        bg("cg/yume.png")
        _(['"Ah, Dai-kun?"',
           u'\nDai-kun — Daisuke Minato — is one of my classmates.',
           'We are computer science students and I\'m one of the few girls in the class.',
           'Well, not that I\'d make friends with lots of them if there were, actually.',
           u'After all, Dai-kun is one of the few — and by few I mean three — friends I have at college.'])
        _(['"Geez, you\'re so hopeless. I bet you didn\'t listen to a word I said."',
           'He has a point.',
           '\n"Sorry."',
           '"Eh?! Are you all there?"',
           '"Silly"',
           'We laughed.'])
        _(['"That\'s like the first time ever you said "sorry" and made such a "sorry" face."',
           '"Yeah. I guess I found myself once again."',
           '"Weirdo."',
           'He giggled.'])
        _(['"I was thinking..."',
           '"Hm? What is it?"',
           '"Want to go to the karaoke next friday... if you\'re free, I mean."',
           '"Of course!"',
           'My voice sounded more cheerfuly than what I wanted.'])
        _(['Daisuke took a while to understand those words, as he just kept staring at me with the most surprised face I\'ve ever seen.',
           '"Are you sure you\'re Yume?"',
           '"Eh?!"',
           '"I mean, you\'re not some alien with her body, or an android, or something, are you?"',
           '"Hm... I guess I\'m something."',
           'We both laughed.'])
        _(['"Anyways, I was thinking."',
           '\nHe looked at me with an odd inquiring look, "What is it?"',
           '"Will there be a problem if we add my sis too?"',
           '"Eh?!"',
           '"I\'m warning you, she\'s a singing godness."',
           '"Haha. I guess there won\'t be a problem, but..."',
           '"But...?"',
           '"Hm, it\'s nothing. Just forget about it."'])
        nvl.intime = 1000
        bg("cg/yume_to_daidai.png")
        _(['He came closer and gave me a kiss on my cheeks.',
           '"Please look forward to it."',
           '"I-I will..."'])
        nvl.intime = 2000
        cls()
        _([u'\n\n\n\n\n\n\nI definetly will———',
           u'\n———enjoy life to my hearts contents from now on.'])
        nvl.intime = 2000
        bg("cg/fin.png", overlay=False)
           
    except eSkipCutScene:
        pass
    
    core.next_screen = ns
    return
예제 #3
0
def level_clear_screen(mc, killed_bugs, ltime, lives, lost_lives, score):
    core.play_music("stage clear", queue=True)
    last_screen = core.screen.copy().convert()
    ls = last_screen.copy().convert()
    bg = core.load_image("stage_clear.png", directory="gfx")
        
    stars = core.load_image("rank_star.png", directory="gfx")
    stars = [ core.im_crop(stars, pygame.Rect(0,0,55,51)),
              core.im_crop(stars, pygame.Rect(55,0,55,51)) ]
    
    ltime = int(ltime)
    used_feathers, wasted_feathers, waste_penalty = getFeatherStats(mc)
    rank = getRank(mc, lost_lives, lives, ltime, killed_bugs)
     
    state = 0
    
    skilled_bugs = oStatsDisp(0, (465,155), useNumbers=True, xalign=1.0, width=100, formatValue=format_level_time)
    stime = oStatsDisp(0, (465,190), useNumbers=True, xalign=1.0, width=100, formatValue=format_level_time)
    slives = oStatsDisp(0, (465,225), useNumbers=True, xalign=1.0, width=100, formatValue=format_level_time)
    sfeathers = oStatsDisp(0, (465,260), useNumbers=True, xalign=1.0, width=100, formatValue=format_level_time)
    stotal = oStatsDisp(score, (235,370), useNumbers=True, xalign=1.0, width=330, formatValue=format_score)
    last_total = score
    
    forceUpdate = True
    vel = .3
    vel2 = 100
    
    while True:
        lag = core.clock.tick(core.MAX_FPS)
        if lag <= 0:
            lag = 1
            
        dirty_rects = []
        
        if core.handleEvents() == "quit":
            exit()
            
        vel = 0.2
        if Input.up(K_RETURN):
            if state < 8:
                vel = sys.maxint
            else:
                core.dissolve_transition(core.screen.copy().convert(), ls, 1000)
                return stotal.value, rank
        
        core.screen.blit(ls, (0,0))
        core.screen.blit(bg, (0,0))
        # points
        if state == 0:
            skilled_bugs.update( skilled_bugs.value + vel*lag )
            if skilled_bugs.value >= killed_bugs:
                skilled_bugs.value = killed_bugs
                state += 1
        elif state == 1:
            stime.update( stime.value + vel*lag )
            if stime.value >= ltime:
                stime.value = ltime
                state += 1
        elif state == 2:
            slives.update( slives.value + vel*lag )
            if slives.value >= lives:
                slives.value = lives
                state += 1
        elif state == 3:
            sfeathers.update( sfeathers.value + vel*lag )
            if sfeathers.value >= wasted_feathers:
                sfeathers.value = wasted_feathers
                state += 1
        elif state == 4:
            stotal.update( stotal.value + vel2*lag )
            if stotal.value >= last_total + killed_bugs*10:
                stotal.value = last_total + killed_bugs*10
                last_total = stotal.value
                state += 1
        elif state == 5:
            stotal.update( stotal.value + vel2*lag )
            if stotal.value >= last_total + ltime*100:
                stotal.value = last_total + ltime*100
                last_total = stotal.value
                state += 1
        elif state == 6:
            stotal.update( stotal.value + vel2*lag )
            if stotal.value >= last_total + lives*1000:
                stotal.value = last_total + lives*1000
                last_total = stotal.value
                state += 1
        elif state == 7:
            stotal.update( stotal.value - vel2*lag )
            if stotal.value <= last_total - waste_penalty:
                stotal.value = last_total - waste_penalty
                last_total = stotal.value
                state += 1
        
        # draw
        dirty_rects.extend( skilled_bugs.draw(core.screen) )
        if state > 0:
            dirty_rects.extend( stime.draw(core.screen) )
        if state > 1:
            dirty_rects.extend( slives.draw(core.screen) )
        if state > 2:
            dirty_rects.extend( sfeathers.draw(core.screen) )
        if state > 3:
            dirty_rects.extend( stotal.draw(core.screen) )
        if state > 7:
            def draw_rank_star(pos, rank_need):
                if rank >= rank_need:
                    return core.screen.blit(stars[1], pos)
                else:
                    return core.screen.blit(stars[0], pos)
            
            dirty_rects.append( draw_rank_star((405,430), 3) )
            dirty_rects.append( draw_rank_star((460,430), 2) )
            dirty_rects.append( draw_rank_star((515,430), 1) )
            
        if last_screen is not None:
            core.dissolve_transition(last_screen, core.screen.copy().convert(), 1000)
            last_screen = None
            
        if forceUpdate:
            dirty_rects = None
        forceUpdate = False
        core.updateScreen(dirty_rects)
예제 #4
0
def game_intro():
    core.play_music("intro", queue=True)
    text_bg = core.load_image("gfx/bg_text.png")
    mo = core.load_image("gfx/movie_overlay.png")
    
    def _(texts):
        if not nvl.show_texts(texts):
            raise eSkipCutScene
            
    def bg(new_bg):
        ls = core.screen.copy().convert()
        core.screen.blit( core.load_image("gfx/" + new_bg), (0,0) )
        core.screen.blit( mo, (0,0) )
        core.dissolve_transition(ls, core.screen.copy().convert(), nvl.intime)
        nvl.intime = 100
    def cls(color=(0,0,0,255)):
        ls = core.screen.copy().convert()
        core.screen.fill(color)
        core.screen.blit( mo, (0,0) )
        core.dissolve_transition(ls, core.screen.copy().convert(), nvl.intime)
        nvl.intime = 100
        
    nvl = fontmgr.oNvlScreen(x=80,y=80,width=440,height=440,background=text_bg,bg_pos=(50,50),ctc=get_ctc())
    bg("cg/feather.png")
    

    try:
        nvl.y = 280
        _(['A feather.'])
        nvl.y = 80
        _(['For a long time that was the only thing to fill my dreams.\n',
           'A lone feather over the tidy ocean of darkness.',
           'The pure white which seemed to defy the very place it lied, eternally.'])
        _([u'\n\n———or maybe it was the other way around.',
           'Maybe, just maybe, for the white feather was so pure the entire universe seemed ugly.\n'])
        _(['I didn\'t know.\n',
           'Even after so long I couldn\'t understand the meaning of that dream.\n',
           u'\n\n———but I could feel that feather.\n',
           'Somehow it seemed real.',
           'Even more real than reality.',
           'It was a crying soul.',
           'A maiden in distress calling for her brave prince.',
           'A faithful beauty letting out her last deep breath before being engulfed by darkness.'])
        nvl.intime = 2000
        cls()
        _(['...',
           '......',
           '.........',
           u'\n\n\n————no!',
           'Not yet!',
           'It can\'t end this way.',
           u'Just———!'])
        _(['I stretched my hands in the feather\'s direction.\n',
           '......',
           u'———but it wasn\'t there',
           'The feather wasn\' there anymore.\n',
           'It was over and for some reason I felt sad.',
           'As if my entire world didn\'t make any sense at all without that feather.'])
        _(['Why?'])
        _([u'\n\n\n\n\n————silence.'])
        _(['Why?', 'Why?', 'Why?',
           '\n\n\nIt. Was. Just. A. Feather.',
           '\n\nSo, why?'])
        _(['Because I\'m the prince?',
           'Because I couldn\'t save who I was supposed to?',
           '...',
           'I don\'t know.',
           'I just...'])
        _(['"You shouldn\'t cry."',
           '"Eh?!"',
           '"Because a prince should be brave, right?"',
           '\nIt was a gentle voice echoing in a motherly way.',
           '\n\n\nMy mind was clear now.',
           'That voice killed not just my fears, but also my thoughts.',
           'I could only open my eyes and look at the person above me.'])
        nvl.intime = 1000
        bg("cg/hikari_floating.png")
        _(['Her pink hair, wavering slightly with the wind, covered part of her face.',
           '\nThe pale complexion was concealed by a queer pastel red dress, while a red thread conected its pinky finger to mine.',
           '\n\nThe maiden floated slowly with its only wing, stretching her soft hand in my direction.'])
        _(['It wasn\'t just that she was pretty.',
           u'———she was bewitching.',
           '\n\n\nWhich explains why I couldn\'t reach her hands.',
           '\n\nOr maybe it was the depressed expression she carried.',
           'Even if it seemed she was passing through a lot of troubles, it also seemed she would broke if I just touched her.'])
        _(['"I wish I could stay longer."',
           'For the first time her eyes were cast down.'])
        _(['That brought me to reality.',
           'After all, I\'m her prince.',
           'If she needs my help I shall help her.',
           'Moreover, I shall protect her with my life if I must.'])
        _(['"The gods said there\'s a red thread which connects people."',
           '\n\n\nI heard about that from my sister.',
           'It\'s a thread of destiny, which connects two peoples by their pinkies.',
           'But this line isn\'t visible, so those people should love one another to find their soulmates.'])
        _(['...',
           '"That should mean..."'])
        _(['Do I love her?',
           '"But..."\n',
           '(I don\'t know her), I wanted to say.',
           '\nThe words just didn\'t come off.',
           '\n\n\n\n\nBecause I knew her.',
           'For some strange reason I knew her so well.',
           'And yet, I haven\'t any idea of who she was.'])
        _(['She smiled beautifully.',
           u'That beautiful smile———',
           u'\n\n\n———how can I say no to it?'])
        _(['"I know I\'ll regret it later, but..."',
           '"Is that a "yes"?"',
           '"Sort of."',
           'She giggled, "I knew you would agree. Please take this feather with you."',
           '"Eh?!"'])
        _(['"This is a debug feather.\nUnfortunately your dream still runs on Ruindows, so you\'ll have to use it a lot."',
           '"Yeah missy. But why can\'t you just stay here?"',
           'Her eyes were cast down once again.',
           'She seemed rather depressed, and that made me sad.'])
        nvl.intime = 2000 
        cls()
        _(['The girl slowly faded away.',
           'She didn\'t answered my question, but I already knew the answer.',
           '\n\n\n\n\n"I guess I can\'t just leave it at this, can I?"'])
    except eSkipCutScene:
        pass
        
    core.next_screen = main_game
    return
예제 #5
0
def main_menu():
    core.play_music("main menu")
    # load bg
    bg = core.load_image("main_menu.png", directory="gfx", auto_alpha=False)
    selected = 0
    
    def genButton(images, pos):
        button = sprite.oSprite()
        button.x = pos[0]
        button.y = pos[1]
        button.animations = {
            "active": {
                "N": [0,True,[sprite.oFrame(images[0])]]
            },
            "inactive": {
                "N": [0,True,[sprite.oFrame(images[1])]]
            }
        }
        core.render_group.add(button)
        return button
    
    selected = 0
    buttons = []
    core.render_group.clear()
    for i, button in enumerate(["new game","help","credits","exit"]):
        y = 180 + i*40
        x = 75
        buttons.append( genButton(core.game_images[button], (x,y)) )
    
    menu_screens = [
        game_intro,     # new game
        hiscores_screen,# high scores
        credits_screen, # credits
        exit_screen,    # exit
    ]
    
    forceUpdate = True
    last_screen = core.screen.copy().convert()
    
    while True:
        lag = core.clock.tick(core.MAX_FPS)
        
        if core.handleEvents() == "quit":
            exit()
                    
        if Input.up(K_UP):
            core.play_sound("cursor_move")
            selected -= 1
            if selected < 0:
                selected = len(buttons)-1
        if Input.up(K_DOWN):
            core.play_sound("cursor_move")
            selected += 1
            if selected >= len(buttons):
                selected = 0
        if Input.up(K_RETURN):
            core.next_screen = menu_screens[selected]
            core.play_sound("button_click")
            return
        
        for i, button in enumerate(buttons):
            button.changeState("active" if i == selected else "inactive")
                    
        dirty_rects = core.render_group.update(lag)
        core.screen.blit(bg, (0,0))
        core.render_group.draw(core.screen)        
        
        if last_screen is not None:
            core.dissolve_transition(last_screen, core.screen.copy().convert(), 1000)
            last_screen = None
        
        if forceUpdate:
            dirty_rects = None
        core.updateScreen(dirty_rects)