예제 #1
0
def prk(avars, asprs, screen, pt, pchr, panit, pcharinfo):

    kr = True

    chngsts = False

    ar = True

    ret = 1

    swthr = ["skyd", "skyaf", "skyn"]
    cwthr = ["skydc", "skydc", "skync"]
    wthrbk = [swthr, cwthr, cwthr]

    slake = ["laked", "lakee", "laken"]
    clake = ["lakec", "lakec", "lakecn"]
    lakebk = [slake, clake, clake]

    pgbk = ["pgbk", "pgbks", "pgbka", "pgbkw"]

    lkfrbk = ["lakebg", "lakebgs", "lakebga", "lakebgw"]

    def chsprs(chara, g):
        try:
            sprs = []
            if chara > 0:
                bs = pygame.image.load("Sprites/Characters/chara_" +
                                       str(chara) + "b.png")
                ss = pygame.image.load("Sprites/Characters/chara_" +
                                       str(chara) + "s.png")
            else:
                bs = pygame.image.load("Sprites/NPC/Nazotchi.png")
                ss = pygame.image.load("Sprites/NPC/Nazo.png")
            opal = []
            for i in range(32):
                opal.append(ss.get_at(((16 + (8 * (i % 2))), (16 + (i // 2)))))
            bs = palette.palch(bs, g, opal)
            ss = palette.palch(ss, g, opal)
            for i in range(3):
                a = pygame.Surface([16, 16])
                a.fill((0, 255, 255))
                a.blit(ss, [-(16 * (i % 2)), -(16 * (i // 2))])
                a.set_colorkey((0, 255, 255))
                a.convert()
                sprs.append(a)
            s = (bs.get_width() // 4)
            for i in range(16):
                spr = pygame.Surface([s, s]).convert()
                spr.fill((0, 255, 255))
                spr.blit(bs, [-(s * (i % 4)), -(s * (i // 4))])
                spr.set_colorkey((0, 255, 255))
                sprs.append(spr)
        except:
            sprs = chsprs(0, g)
        return (sprs)

    def outbg():
        bg = pygame.image.load("Sprites/Misc/bg/" + wthrbk[w][tm] +
                               ".png").convert()
        a = pygame.image.load("Sprites/Misc/bg/" + pgbk[s] + ".png").convert()
        b = pygame.Surface([240, 160]).convert()
        c = (0, 0, 0)
        if w != 0:
            if w == 2:
                if s == 3:
                    a.blit(snowg, [0, 0])
                else:
                    a.blit(raing, [0, 0])
        if panit < 2:
            a.blit(
                pygame.image.load("Sprites/Misc/bg/" + prkbg[s] +
                                  ".png").convert(), [0, 0])
        elif panit < 5:
            a.blit(city, [0, 12])
        else:
            a.blit(
                pygame.image.load("Sprites/Misc/bg/" + lkfrbk[s] +
                                  ".png").convert(), [0, 0])
            bg.blit(
                pygame.image.load("Sprites/Misc/bg/" + lakebk[w][tm] +
                                  ".png").convert(), [0, 0])
        if w != 0:
            if tm < 2:
                b.fill((204, 204, 204))
                c = (81, 81, 81)
            else:
                b.fill((102, 102, 102))
                c = (40, 40, 40)
            b.set_alpha(102)
            a.blit(b, [0, 0])
        elif tm > 0:
            if tm == 1:
                b.fill((255, 102, 0))
                c = (101, 40, 0)
            else:
                b.fill((0, 0, 102))
                c = (0, 0, 40)
            b.set_alpha(102)
            a.blit(b, [0, 0])
        a.set_colorkey(c)
        bg.blit(a, [0, 0])
        return (bg)

    def arrive():
        flip = False
        pflip = False
        if anifr < 48:
            if ((anifr / 12) - (anifr // 12)) < 0.5:
                spr = 11
                spry = 98 + (32 - asprs[avars[3][5]][spr].get_height())
                if pchr > 0:
                    pcs = 3
            else:
                spr = 13
                spry = 96 + (32 - asprs[avars[3][5]][spr].get_height())
                if pchr > 0:
                    pcs = 4
            sprx = (208 - (10 * (anifr // 6))) + (
                (32 - asprs[avars[3][5]][spr].get_width()) // 2)
            if pchr > 0:
                pcy = 98 + (32 - pchrs[pcs].get_height())
        else:
            if ((anifr / 12) - (anifr // 12)) < 0.5:
                spr = 3
                spry = 98 + (32 - asprs[avars[3][5]][spr].get_height())
                if pchr > 0:
                    pcs = 3
                    pcy = 98 + (32 - pchrs[pcs].get_height())
            else:
                spr = 5
                spry = 96 + (32 - asprs[avars[3][5]][spr].get_height())
                if pchr > 0:
                    pcs = 5
                    pcy = 96 + (32 - pchrs[pcs].get_height())
            sprx = 128 + ((32 - asprs[avars[3][5]][spr].get_width()) // 2)
        if pchr > 0:
            pcx = 86 + ((32 - pchrs[pcs].get_width()) // 2)
            pflip = True
        if pchr == 0:
            return spr, sprx, spry, flip
        else:
            return spr, sprx, spry, flip, pcs, pcx, pcy, pflip

    def pani():
        flip = False
        pflip = False
        if panit == 0:
            if pchr > 0 and ptlk:
                if anifr < 58:
                    if ((anifr / 12) - (anifr // 12)) < 0.5:
                        spr = 11
                        pcs = 12
                    else:
                        spr = 12
                        pcs = 11
                else:
                    spr = 5
                    pcs = 5
            else:
                if ((anifr / 12) - (anifr // 12)) < 0.5:
                    spr = 3
                    if pchr > 0:
                        pcs = 3
                else:
                    spr = 4
                    if pchr > 0:
                        pcs = 4
            sprx = 128 + ((32 - asprs[avars[3][5]][spr].get_width()) // 2)
            spry = 98 + (32 - asprs[avars[3][5]][spr].get_height())
            if pchr > 0:
                pcy = 98 + (32 - pchrs[pcs].get_height())
                pcx = 86 + ((32 - pchrs[pcs].get_width()) // 2)
                pflip = True
        elif panit == 1:
            flip = True
            if ((anifr / 12) - (anifr // 12)) < 0.5:
                spr = 16
                pcs = 17
            else:
                spr = 17
                pcs = 16
            sprx = 72 + ((32 - asprs[avars[3][5]][spr].get_width()) // 2)
            spry = 98 + (32 - asprs[avars[3][5]][spr].get_height())
            pcx = 108 + ((32 - pchrs[pcs].get_width()) // 2)
            pcy = 98 + (32 - pchrs[pcs].get_height())
        elif panit == 2:
            if anifr % 16 < 8:
                spr = 17
                pcs = 17
                spry = 83 + (32 - asprs[avars[3][5]][spr].get_height())
                pcy = 83 + (32 - pchrs[pcs].get_height())
            else:
                if anifr % 32 < 16:
                    spr = 5
                    pcs = 16
                    spry = 68 + (32 - asprs[avars[3][5]][spr].get_height())
                    pcy = 94 + (32 - pchrs[pcs].get_height())
                else:
                    spr = 16
                    pcs = 5
                    spry = 94 + (32 - asprs[avars[3][5]][spr].get_height())
                    pcy = 68 + (32 - pchrs[pcs].get_height())
            sprx = 136 + ((32 - asprs[avars[3][5]][spr].get_width()) // 2)
            pcx = 72 + ((32 - pchrs[pcs].get_width()) // 2)
            pflip = True
        elif panit == 3:
            pflip = True
            if anifr < 32:
                if anifr % 16 < 8:
                    spr = 11
                    pcs = 11
                    sprx = 132 + (
                        (32 - asprs[avars[3][5]][spr].get_width()) // 2)
                    pcx = 76 + ((32 - pchrs[pcs].get_width()) // 2)
                    screen.blit(
                        pygame.transform.flip(sndsnw[(s == 3 and w == 2)][0],
                                              1, 0), [124, 114])
                    screen.blit(sndsnw[(s == 3 and w == 2)][0], [88, 114])
                else:
                    spr = 13
                    pcs = 13
                    sprx = 128 + (
                        (32 - asprs[avars[3][5]][spr].get_width()) // 2)
                    pcx = 80 + ((32 - pchrs[pcs].get_width()) // 2)
                    screen.blit(
                        pygame.transform.flip(sndsnw[(s == 3 and w == 2)][0],
                                              1, 0), [120, 114])
                    screen.blit(sndsnw[(s == 3 and w == 2)][0], [92, 114])
                spry = 98 + (32 - asprs[avars[3][5]][spr].get_height())
                pcy = 98 + (32 - pchrs[pcs].get_height())
            elif anifr < 56:
                if anifr % 16 < 8:
                    spr = 4
                    pcs = 4
                    spry = 98 + (32 - asprs[avars[3][5]][spr].get_height())
                    pcy = 98 + (32 - pchrs[pcs].get_height())
                else:
                    spr = 5
                    pcs = 5
                    spry = 94 + (32 - asprs[avars[3][5]][spr].get_height())
                    pcy = 94 + (32 - pchrs[pcs].get_height())
                sprx = 132 + ((32 - asprs[avars[3][5]][spr].get_width()) // 2)
                pcx = 76 + ((32 - pchrs[pcs].get_width()) // 2)
                screen.blit(sndsnw[(s == 3 and w == 2)][1], [108, 106])
            else:
                spr = 9
                pcs = 9
                spry = 98 + (32 - asprs[avars[3][5]][spr].get_height())
                pcy = 98 + (32 - pchrs[pcs].get_height())
                sprx = 132 + ((32 - asprs[avars[3][5]][spr].get_width()) // 2)
                pcx = 76 + ((32 - pchrs[pcs].get_width()) // 2)
                screen.blit(sndsnw[(s == 3 and w == 2)][2], [108, 106])
        elif panit == 4:
            pflip = anifr < 32
            flip = anifr > 31
            if anifr % 32 < 8:
                spr = 5
                pcs = 5
                sprx = 56 + ((32 - asprs[avars[3][5]][spr].get_width()) //
                             2) + (104 * (anifr < 32))
                pcx = 56 + (
                    (32 - pchrs[pcs].get_width()) // 2) + (104 * (anifr > 31))
                spry = 66 + (32 - asprs[avars[3][5]][spr].get_height()) + (
                    32 * (anifr < 32))
                pcy = 66 + (32 - pchrs[pcs].get_height()) + (32 * (anifr > 31))
            elif anifr % 32 < 16:
                spr = 17 - (4 * (anifr < 32))
                pcs = 17 - (4 * (anifr > 31))
                sprx = 84 + ((32 - asprs[avars[3][5]][spr].get_width()) //
                             2) + (41 * (anifr < 32))
                pcx = 84 + (
                    (32 - pchrs[pcs].get_width()) // 2) + (41 * (anifr > 31))
                spry = 44 + (32 - asprs[avars[3][5]][spr].get_height()) + (
                    56 * (anifr < 32))
                pcy = 44 + (32 - pchrs[pcs].get_height()) + (56 * (anifr > 31))
            elif anifr % 32 < 24:
                spr = 16 - (5 * (anifr < 32))
                pcs = 16 - (5 * (anifr > 31))
                sprx = 108 + ((32 - asprs[avars[3][5]][spr].get_width()) //
                              2) - (18 * (anifr < 32))
                pcx = 108 + (
                    (32 - pchrs[pcs].get_width()) // 2) - (18 * (anifr > 31))
                spry = 62 + (32 - asprs[avars[3][5]][spr].get_height()) + (
                    38 * (anifr < 32))
                pcy = 62 + (32 - pchrs[pcs].get_height()) + (38 * (anifr > 31))
            else:
                spr = 17 - (4 * (anifr < 32))
                pcs = 17 - (4 * (anifr > 31))
                sprx = 128 + ((32 - asprs[avars[3][5]][spr].get_width()) //
                              2) - (64 * (anifr < 32))
                pcx = 128 + (
                    (32 - pchrs[pcs].get_width()) // 2) - (64 * (anifr > 31))
                spry = 90 + (32 - asprs[avars[3][5]][spr].get_height()) + (
                    10 * (anifr < 32))
                pcy = 90 + (32 - pchrs[pcs].get_height()) + (10 * (anifr > 31))
        elif panit == 5:
            pflip = True
            if anifr % 16 < 8:
                spr = [10, 6, 4, 6][s]
                pcs = [3, 3, 5, 6][s]
                if s == 1:
                    screen.blit(sweat, [156, 82])
                elif s == 3:
                    screen.blit(shiver, [71, 108])
                    screen.blit(shiver, [155, 108])
            else:
                spr = [3, 3, 5, 6][s]
                pcs = [10, 6, 4, 6][s]
                if s == 1:
                    screen.blit(sweat, [120, 82])
                elif s == 3:
                    screen.blit(shiver, [69, 108])
                    screen.blit(shiver, [157, 108])
            sprx = 122 + ((32 - pchrs[pcs].get_width()) // 2) + ((s == 3) * (
                (2 * (anifr % 16 > 7)) - 1))
            pcx = 86 + ((32 - pchrs[pcs].get_width()) // 2) + ((s == 3) * (
                (2 * (anifr % 16 < 8)) - 1))
            spry = 98 + (32 - asprs[avars[3][5]][spr].get_height())
            pcy = 98 + (32 - pchrs[pcs].get_height())
        if pchr == 0:
            return spr, sprx, spry, flip
        else:
            return spr, sprx, spry, flip, pcs, pcx, pcy, pflip

    if pt == 0:
        tpborder, btborder, borderico = borders.getborders(
            avars[3][13], 1, 3, 1)
    else:
        tpborder, btborder, borderico = borders.getborders(
            avars[3][13], 1, 4, 0)

    hn = pygame.image.load("Sprites/Misc/menu/hngs.png").convert()
    hp = pygame.image.load("Sprites/Misc/menu/hpys.png").convert()
    sk = pygame.image.load("Sprites/Misc/menu/scks.png").convert()
    sl = pygame.image.load("Sprites/Misc/menu/slps.png").convert()

    shiver = pygame.image.load("Sprites/Misc/emo/shiver.png").convert()
    sweat = pygame.image.load("Sprites/Misc/emo/sweat.png").convert()

    prkbg = ["parkbg", "parkbgs", "parkbga", "parkbgw"]

    city = pygame.image.load("Sprites/Misc/bg/walkbg.png").convert()

    balnc1 = pygame.image.load("Sprites/Misc/obj/prkbal1.png").convert()
    balnc2 = pygame.image.load("Sprites/Misc/obj/prkbal2.png").convert()

    prkpnk = pygame.image.load("Sprites/Misc/bg/prkpnk.png").convert()

    sndbox = pygame.image.load("Sprites/Misc/bg/prksand.png").convert()

    sndsnw = [[
        pygame.image.load("Sprites/Misc/obj/sandm.png").convert(),
        pygame.image.load("Sprites/Misc/obj/sandcst.png").convert(),
        pygame.image.load("Sprites/Misc/obj/sandd.png").convert()
    ],
              [
                  pygame.image.load("Sprites/Misc/obj/snowm.png").convert(),
                  pygame.image.load("Sprites/Misc/obj/snowman.png").convert(),
                  pygame.image.load("Sprites/Misc/obj/snowd.png").convert()
              ]]

    slide = pygame.image.load("Sprites/Misc/obj/slide.png").convert()

    rain = pygame.image.load("Sprites/Misc/bg/rain.png").convert()
    snow = pygame.image.load("Sprites/Misc/bg/snow.png").convert()

    raing = pygame.image.load("Sprites/Misc/bg/rpgb.png").convert()
    snowg = pygame.image.load("Sprites/Misc/bg/spgb.png").convert()

    s, tm, w = weather.chktime(avars)

    obgi = outbg()

    fnt = pygame.font.Font("Sprites/Misc/font/Tama2.ttf", 16)

    sound = sounds.imprtsnd(avars)

    clock = pygame.time.Clock()

    anifr = 0

    pygame.time.set_timer(USEREVENT + 1, int(1000 / ((5 * avars[3][3]) + 1)))

    if avars[3][3] == 0:
        avars[3][6] = time.strftime("%H:%M")

    ptlk = False

    if pt == 0:
        if int(avars[3][6][:2]) < 12 or int(avars[3][6][:2]) > 18:
            pchr = 0
        else:
            p = randint(1, 4)
            t = [0, 3600, 176400, 435600][p - 1]
            g = randint(0, 4294967295)
            while (format(g,
                          '032b')[16:28]) == (format(avars[avars[3][5]][14],
                                                     '032b')[16:28]):
                g = randint(0, 4294967295)
            a = randint(1, 8)
            c = ["no", "ma", "ku", "ku", "ma", "me", "me", "no"][a - 1]
            d = [
                choice(["ku", "ma", "me"]), "ku", "ku", "me", "ma", "me", "ma",
                "no"
            ][a - 1]
            ov = [[
                a, 1, 0, (g % 4 > 1), 0,
                randint(0, 200),
                randint(0, 200),
                randint(0, 200),
                randint(0, 200),
                randint(0, 200),
                randint(0, 200), c, c, d, g, 0, 0, 0,
                randint(1, 99),
                randint(0, 5), 0, 0, 0, 0, [], 0, 0, 0, 0, 0, 0, 0, 0, 4
            ], [], [], [0, 0, 0, 0, 0, 0]]
            ov = growth.grw(ov)
            while ov[0][1] < p:
                ov[0][1] += 1
                ov = growth.grw(ov)
            pchr = ov[0][15]
            pcharinfo = [
                "PARK", "", pchr, g, ov[0][13], ov[0][12], ov[0][11],
                [t, avars[avars[3][5]][2]], 0
            ]
    if pchr > 0:
        pchrs = chsprs(pchr, pcharinfo[3])

    while kr:
        screen.blit(obgi, [0, 0])
        if w == 2:
            if ((anifr / 12) - (anifr // 12)) < 0.5:
                y = 0
            else:
                if s < 3:
                    y = 16
                else:
                    y = 8
            if s < 3:
                screen.blit(rain, [0, y])
            else:
                screen.blit(snow, [0, y])
        if ar:
            if anifr < 48 and ((anifr / 12) - (anifr // 12)) == 0.5:
                pygame.mixer.stop()
                sound[6].play()
            elif ((anifr / 12) - (anifr // 12)) == 0.5:
                pygame.mixer.stop()
                sound[9].play()
            if pchr == 0:
                spr, sprx, spry, flip = arrive()
            else:
                spr, sprx, spry, flip, pcs, pcx, pcy, pflip = arrive()
                screen.blit(pygame.transform.flip(pchrs[pcs], pflip, 0),
                            [pcx, pcy])
            screen.blit(
                pygame.transform.flip(asprs[avars[3][5]][spr], flip, 0),
                [sprx, spry])
        else:
            if pt == 0:
                if panit == 0:
                    if pchr == 0:
                        spr, sprx, spry, flip = pani()
                    else:
                        spr, sprx, spry, flip, pcs, pcx, pcy, pflip = pani()
                        screen.blit(
                            pygame.transform.flip(pchrs[pcs], pflip, 0),
                            [pcx, pcy])
                else:
                    spr = 11 + (2 * (anifr % 8 < 4))
                    spry = 98 + (32 - asprs[avars[3][5]][spr].get_height()) - (
                        8 * (anifr % 8 < 4))
                    sprx = (368 - (32 * (anifr // 4))) + (
                        (32 - asprs[avars[3][5]][spr].get_width()) // 2)
                    flip = False
                    if anifr % 8 < 4:
                        screen.blit(sweat, [(400 - (32 * (anifr // 4))), 74])
            else:
                if panit == 1:
                    screen.blit(prkpnk, [74, 123])
                elif panit == 2:
                    if anifr % 16 < 8:
                        screen.blit(balnc1, [72, 98])
                    else:
                        screen.blit(
                            pygame.transform.flip(balnc2, (anifr % 32 < 16),
                                                  0), [72, 98])
                elif panit == 3 and (s < 3 or w < 2):
                    screen.blit(sndbox, [32, 104])
                elif panit == 4:
                    screen.blit(slide, [88, 66])
                spr, sprx, spry, flip, pcs, pcx, pcy, pflip = pani()
                screen.blit(pygame.transform.flip(pchrs[pcs], pflip, 0),
                            [pcx, pcy])
            screen.blit(
                pygame.transform.flip(asprs[avars[3][5]][spr], flip, 0),
                [sprx, spry])
        screen = borders.drawborders(screen, avars, asprs, tpborder, btborder,
                                     borderico, fnt, 0, anifr, hn, hp, sk, sl)
        for event in pygame.event.get():
            if event.type == QUIT:
                varsup.updtvrs(avars)
                kr = False
                pygame.quit()
                sys.exit()
            if event.type == MOUSEBUTTONDOWN:
                mp = event.pos
                d = (screen.get_size()[0] // 240)
                mp = ((mp[0] // d), (mp[1] // d))
                pb = event.button
                if pb == 1:
                    if 138 < mp[1] < 158:
                        if 228 < mp[0] < 240:
                            sound[4].play()
                            if pt == 0:
                                return (avars, ret)
                            else:
                                return (avars)
                        elif 212 < mp[0] < 224 and pt == 0:
                            ret = 0
                            sound[4].play()
                            return (avars, ret)
                    if 23 < mp[
                            1] < 136 and not ar and not ptlk and pt == 0 and panit == 0:
                        if pchr > 0:
                            ptlk = True
                            anifr = 33
                            f = avars[avars[3][5]][32]
                            f.append(pcharinfo)
                            avars[avars[3][5]][32] = f
                        else:
                            panit = 5
                            obgi = outbg()
                            anifr = 0
            if event.type == USEREVENT + 1:
                if avars[3][3] == 0:
                    avars[3][6] = time.strftime("%H:%M")
                else:
                    avars[3][7] += 1
                    if avars[3][7] == 60:
                        if int(avars[3][6][3:]) != 59:
                            nhour = avars[3][6][:3] + (
                                "%02d" % (int(avars[3][6][3:]) + 1))
                            avars[3][6] = nhour
                        else:
                            nhour = ("%02d" %
                                     (int(avars[3][6][:2]) + 1)) + ":00"
                            if nhour == "24:00":
                                nhour = "00:00"
                            avars[3][6] = nhour
                        avars[3][7] = 0
                if len(avars[0]) > 0:
                    avars[0][2] += 1
                if len(avars[1]) > 0:
                    avars[1][2] += 1
                if len(avars[2]) > 0:
                    avars[2][2] += 1
                chngsts = True
        if chngsts:
            avars = statusup.chngsts(avars)
            if avars[avars[3][5]][20] or not avars[avars[3][5]][21]:
                if pt == 0:
                    return (avars, ret)
                else:
                    return (avars)
            chngsts = False
        if anifr < 63:
            anifr += 1
        else:
            anifr = 0
            if panit == 5 and pt == 0:
                if avars[avars[3][5]][18] > 1:
                    avars[avars[3][5]][18] -= 1
            ar = False
        r = pygame.Surface([240, 160]).convert()
        r.blit(screen, [0, 0])
        r = pygame.transform.scale(
            r, (screen.get_size()[0], screen.get_size()[1]))
        screen.blit(r, [0, 0])
        clock.tick(16)
        pygame.display.update()
예제 #2
0
def game(avars, asprs, screen, pchr1, psps1, pchr2, psps2, pchr3, psps3,
         mfsps):

    kr = True

    chngsts = False

    scr = 0

    rpos = 2
    rdir = False

    lose = 3
    pchr = [0, 1, 2]
    last = 3

    jump = 0

    ret = 1

    tuts = True
    strt = False
    play = False
    end = 0

    swthr = ["skyd", "skyaf", "skyn"]
    cwthr = ["skydc", "skydc", "skync"]
    wthrbk = [swthr, cwthr, cwthr]

    pgbk = ["pgbk", "pgbks", "pgbka", "pgbkw"]

    def outbg():
        bg = pygame.image.load("Sprites/Misc/bg/" + wthrbk[w][tm] +
                               ".png").convert()
        a = pygame.image.load("Sprites/Misc/bg/" + pgbk[s] + ".png").convert()
        b = pygame.Surface([240, 160]).convert()
        c = (0, 0, 0)
        if w != 0:
            if w == 2:
                if s == 3:
                    a.blit(snowg, [0, 0])
                else:
                    a.blit(raing, [0, 0])
        a.blit(presout, [0, 0])
        if w != 0:
            b.fill((204, 204, 204))
            c = (81, 81, 81)
            b.set_alpha(102)
            a.blit(b, [0, 0])
        a.set_colorkey(c)
        bg.blit(a, [0, 0])
        return (bg)

    tpborder, btborder, borderico = borders.getborders(avars[3][13], 1, 3, 1)

    hn = pygame.image.load("Sprites/Misc/menu/hngs.png").convert()
    hp = pygame.image.load("Sprites/Misc/menu/hpys.png").convert()
    sk = pygame.image.load("Sprites/Misc/menu/scks.png").convert()
    sl = pygame.image.load("Sprites/Misc/menu/slps.png").convert()

    tutimg = pygame.image.load("Sprites/Misc/bg/jumpropet.png").convert()

    presin = pygame.image.load("Sprites/Misc/bg/presin.png").convert()
    presout = pygame.image.load("Sprites/Misc/bg/presout.png").convert()

    ready = pygame.image.load("Sprites/Misc/bg/ready.png").convert()
    go = pygame.image.load("Sprites/Misc/bg/go.png").convert()

    toobad = pygame.image.load("Sprites/Misc/bg/toobad.png").convert()
    good = pygame.image.load("Sprites/Misc/bg/good.png").convert()
    great = pygame.image.load("Sprites/Misc/bg/great.png").convert()
    excellent = pygame.image.load("Sprites/Misc/bg/excellent.png").convert()

    rope1 = pygame.image.load("Sprites/Misc/obj/rope1.png").convert()
    rope2 = pygame.image.load("Sprites/Misc/obj/rope2.png").convert()
    rope3 = pygame.image.load("Sprites/Misc/obj/rope3.png").convert()

    rain = pygame.image.load("Sprites/Misc/bg/rain.png").convert()
    snow = pygame.image.load("Sprites/Misc/bg/snow.png").convert()

    raing = pygame.image.load("Sprites/Misc/bg/rpgb.png").convert()
    snowg = pygame.image.load("Sprites/Misc/bg/spgb.png").convert()

    s, tm, w = weather.chktime(avars)

    obgi = outbg()

    fnt = pygame.font.Font("Sprites/Misc/font/Tama2.ttf", 16)

    clock = pygame.time.Clock()

    sound = sounds.imprtsnd(avars)

    anifr = 0

    pygame.time.set_timer(USEREVENT + 1, int(1000 / ((5 * avars[3][3]) + 1)))

    if avars[3][3] == 0:
        avars[3][6] = time.strftime("%H:%M")

    while kr:
        if tuts:
            screen.blit(tutimg, [0, 0])
        elif strt:
            screen.blit(presin, [0, 0])
            if anifr == 16:
                pygame.mixer.stop()
                sound[11].play()
            if anifr < 16:
                screen.blit(ready, [80, 40])
                mfs = 0
                spr = 3
                pcs1 = 3
                pcs2 = 3
                pcs3 = 3
            else:
                screen.blit(go, [95, 40])
                mfs = 2
                spr = 5
                pcs1 = 5
                pcs2 = 5
                pcs3 = 5
            screen.blit(mfsps[mfs], [104, 54])
            screen.blit(psps1[pcs1], [66, 106])
            screen.blit(psps2[pcs2], [94, 106])
            screen.blit(asprs[avars[3][5]][spr], [122, 106])
            screen.blit(psps3[pcs3], [150, 106])
        elif play:
            screen.blit(obgi, [0, 0])
            if w == 2:
                if ((anifr / 12) - (anifr // 12)) < 0.5:
                    y = 0
                else:
                    if s < 3:
                        y = 16
                    else:
                        y = 8
                if s < 3:
                    screen.blit(rain, [0, y])
                else:
                    screen.blit(snow, [0, y])
            if ((anifr / 6) - (anifr // 6)) == 0:
                if jump == 1:
                    jump = 2
                elif jump == 2:
                    jump = 0
                if rdir:
                    rpos += 1
                    if rpos == 2:
                        rdir = False
                        if jump == 2:
                            scr += 1
                        if scr == 12 or jump < 2:
                            anifr = 18
                        if ((scr / 4) - (scr // 4)) == 0 and scr > 0 and (
                            (scr // 4) + len(pchr)) == 4:
                            a = randint(0, (len(pchr) - 1))
                            lose = pchr[a]
                else:
                    rpos -= 1
                    if lose < 3:
                        if len(pchr) == 3:
                            last = lose
                        pchr.pop(a)
                        lose = 3
                    if rpos == 0:
                        rdir = True
                if rpos == 2 and jump < 2:
                    pygame.mixer.stop()
                    sound[12].play()
                elif rpos == 2 or jump == 2:
                    pygame.mixer.stop()
                    sound[9].play()
            if rpos == 0:
                screen.blit(rope3, [8, 98])
                mfs = 2
                if jump == 2:
                    spr = 5
                    spry = 98
                else:
                    spr = 3
                    spry = 106
                pcs1 = 3
                pcs2 = 3
                pcs3 = 3
                pcy1 = 106
                pcy2 = 106
                pcy3 = 106
            elif rpos == 1:
                if not rdir:
                    screen.blit(rope1, [8, 98])
                mfs = 0
                if jump == 2:
                    spr = 5
                    spry = 98
                else:
                    spr = 3
                    spry = 106
                pcs1 = 3
                pcs2 = 3
                pcs3 = 3
                pcy1 = 106
                pcy2 = 106
                pcy3 = 106
            else:
                mfs = 1
                if jump == 2:
                    spr = 5
                    spry = 98
                else:
                    spr = 7
                    spry = 106
                if lose == 0:
                    pcs1 = 7
                    pcy1 = 104
                else:
                    pcs1 = 5
                    pcy1 = 98
                if lose == 1:
                    pcs2 = 7
                    pcy2 = 104
                else:
                    pcs2 = 5
                    pcy2 = 98
                if lose == 2:
                    pcs3 = 7
                    pcy3 = 104
                else:
                    pcs3 = 5
                    pcy3 = 98
            screen.blit(mfsps[mfs], [172, 98])
            if 0 in pchr:
                screen.blit(psps1[pcs1], [40, pcy1])
            if 1 in pchr:
                screen.blit(psps2[pcs2], [76, pcy2])
            screen.blit(asprs[avars[3][5]][spr], [112, spry])
            if 2 in pchr:
                screen.blit(psps3[pcs3], [148, pcy3])
            if rdir and rpos == 1:
                screen.blit(rope1, [8, 98])
            elif rpos == 2:
                screen.blit(rope2, [8, 98])
        else:
            screen.blit(presin, [0, 0])
            if end == 4:
                if ((anifr / 12) - (anifr // 12)) < 0.5:
                    mfs = 1
                else:
                    mfs = 2
                if scr < 4:
                    screen.blit(toobad, [71, 40])
                    if ((anifr / 12) - (anifr // 12)) < 0.5:
                        spr = 6
                        pcs1 = 4
                        pcs2 = 4
                        pcs3 = 4
                    else:
                        spr = 7
                        pcs1 = 5
                        pcs2 = 5
                        pcs3 = 5
                else:
                    if scr < 8:
                        screen.blit(good, [94, 40])
                    elif scr < 12:
                        screen.blit(great, [85, 40])
                    else:
                        screen.blit(excellent, [51, 40])
                    if ((anifr / 12) - (anifr // 12)) < 0.5:
                        spr = 4
                        if last == 0:
                            pcs1 = 6
                            pcs2 = 4
                            pcs3 = 4
                        elif last == 1:
                            pcs1 = 4
                            pcs2 = 6
                            pcs3 = 4
                        else:
                            pcs1 = 4
                            pcs2 = 4
                            pcs3 = 6
                    else:
                        spr = 5
                        if last == 0:
                            pcs1 = 7
                            pcs2 = 5
                            pcs3 = 5
                        elif last == 1:
                            pcs1 = 5
                            pcs2 = 7
                            pcs3 = 5
                        else:
                            pcs1 = 5
                            pcs2 = 5
                            pcs3 = 7
                screen.blit(mfsps[mfs], [104, 54])
                screen.blit(psps1[pcs1], [66, 106])
                screen.blit(psps2[pcs2], [94, 106])
                screen.blit(asprs[avars[3][5]][spr], [122, 106])
                screen.blit(psps3[pcs3], [150, 106])
        screen = borders.drawborders(screen, avars, asprs, tpborder, btborder,
                                     borderico, fnt, 0, anifr, hn, hp, sk, sl)
        for event in pygame.event.get():
            if event.type == QUIT:
                varsup.updtvrs(avars)
                kr = False
                pygame.quit()
                sys.exit()
            if event.type == MOUSEBUTTONDOWN:
                mp = event.pos
                d = (screen.get_size()[0] // 240)
                mp = ((mp[0] // d), (mp[1] // d))
                pb = event.button
                if pb == 1:
                    if 138 < mp[1] < 158:
                        if 228 < mp[0] < 240:
                            pygame.mixer.stop()
                            sound[4].play()
                            return (avars, ret)
                        elif 212 < mp[0] < 224:
                            pygame.mixer.stop()
                            sound[4].play()
                            ret = 0
                            return (avars, ret)
                    if (24 < mp[1] < 136) and tuts:
                        pygame.mixer.stop()
                        sound[10].play()
                        tuts = False
                        strt = True
                        anifr = -1
                    elif play:
                        if (112 < mp[0] < 136) and (106 < mp[1] <
                                                    130) and jump == 0:
                            jump = 1
            if event.type == USEREVENT + 1:
                if avars[3][3] == 0:
                    avars[3][6] = time.strftime("%H:%M")
                else:
                    avars[3][7] += 1
                    if avars[3][7] == 60:
                        if int(avars[3][6][3:]) != 59:
                            nhour = avars[3][6][:3] + (
                                "%02d" % (int(avars[3][6][3:]) + 1))
                            avars[3][6] = nhour
                        else:
                            nhour = ("%02d" %
                                     (int(avars[3][6][:2]) + 1)) + ":00"
                            if nhour == "24:00":
                                nhour = "00:00"
                            avars[3][6] = nhour
                        avars[3][7] = 0
                if len(avars[0]) > 0:
                    avars[0][2] += 1
                if len(avars[1]) > 0:
                    avars[1][2] += 1
                if len(avars[2]) > 0:
                    avars[2][2] += 1
                chngsts = True
        if chngsts:
            avars = statusup.chngsts(avars)
            chngsts = False
        if anifr < 23:
            anifr += 1
        else:
            anifr = 0
            if strt:
                play = True
                strt = False
            elif play and (scr == 12 or (rpos == 2 and jump < 2)):
                if scr < 4:
                    pygame.mixer.stop()
                    sound[14].play()
                else:
                    pygame.mixer.stop()
                    sound[1].play()
                end = 4
                if (avars[avars[3][5]][17] + (scr // 3)) < 6:
                    avars[avars[3][5]][17] += (scr // 3)
                else:
                    avars[avars[3][5]][17] = 6
                if (avars[avars[3][5]][18] - (scr // 3)) > 1:
                    avars[avars[3][5]][18] -= (scr // 3)
                else:
                    avars[avars[3][5]][18] = 1
                b = randint(0, 5)
                avars[avars[3][5]][(5 + b)] += (scr // 6)
                play = False
            elif end == 4:
                ret = 0
                return (avars, ret)
        r = pygame.Surface([240, 160]).convert()
        r.blit(screen, [0, 0])
        r = pygame.transform.scale(
            r, (screen.get_size()[0], screen.get_size()[1]))
        screen.blit(r, [0, 0])
        clock.tick(16)
        pygame.display.update()
예제 #3
0
def door(avars, asprs, screen):
    class Txtbx(pygame.sprite.Sprite):

        bxt = []

        def __init__(self):
            super().__init__()
            box = pygame.image.load("Sprites/Misc/txtbox/box1.png").convert()

            image = pygame.Surface([8, 8]).convert()
            image.set_colorkey((0, 0, 0))
            image.blit(box, (0, 0), (0, 0, 8, 8))
            self.bxt.append(image)
            image = pygame.Surface([8, 8]).convert()
            image.set_colorkey((0, 0, 0))
            image.blit(box, (0, 0), (8, 0, 8, 8))
            self.bxt.append(image)
            image = pygame.Surface([8, 8]).convert()
            image.set_colorkey((0, 0, 0))
            image.blit(box, (0, 0), (16, 0, 8, 8))
            self.bxt.append(image)
            image = pygame.Surface([8, 8]).convert()
            image.set_colorkey((0, 0, 0))
            image.blit(box, (0, 0), (0, 8, 8, 8))
            self.bxt.append(image)
            image = pygame.Surface([8, 8]).convert()
            image.set_colorkey((0, 0, 0))
            image.blit(box, (0, 0), (8, 8, 8, 8))
            self.bxt.append(image)
            image = pygame.Surface([8, 8]).convert()
            image.set_colorkey((0, 0, 0))
            image.blit(box, (0, 0), (16, 8, 8, 8))
            self.bxt.append(image)
            image = pygame.Surface([8, 8]).convert()
            image.set_colorkey((0, 0, 0))
            image.blit(box, (0, 0), (0, 16, 8, 8))
            self.bxt.append(image)
            image = pygame.Surface([8, 8]).convert()
            image.set_colorkey((0, 0, 0))
            image.blit(box, (0, 0), (8, 16, 8, 8))
            self.bxt.append(image)
            image = pygame.Surface([8, 8]).convert()
            image.set_colorkey((0, 0, 0))
            image.blit(box, (0, 0), (16, 16, 8, 8))
            self.bxt.append(image)

            self.image = self.bxt[0]
            self.rect = self.image.get_rect()

        def update(self):
            self.image = self.bxt[tl]

    kr = True

    bx = True

    scr = 0

    clt = 0

    spclk = False

    walk = False

    dest = 0

    chngsts = False

    ret = 1

    swthr = ["skyd", "skyaf", "skyn"]
    cwthr = ["skydc", "skydc", "skync"]
    wthrbk = [swthr, cwthr, cwthr]

    jloc = [
        "PRESCHOOL", "SCHOOL", "JOB HUNT", "LABORATORY", "LIBRARY", "TAMAX TV",
        "HOSPITAL", "GOTCHI BANK", "LOGIC CLASS", "CONCERT",
        "TAILORING STUDIO", "BAKERY", "HAIR SALON", "FLOWER SHOP",
        "ARTISTRY CLASS", "HOT SPRINGS", "PRESCHOOL", "GOTCHI STATION",
        "POLICE STATION", "RESTAURANT", "KINDNESS CLASS", "COMEDY SHOW",
        "CIRCUS", "FESTIVAL", "COMIC STUDIO", "TOY FACTORY", "HUMOUR CLASS",
        "AUDITORIUM", "GALLERY", "JEWELRY SHOP", "DANCE STUDIO", "MAGIC SHOW",
        "BEAUTY CLASS", "GYM", "ADVENTURE", "DOJO", "FIRE STATION",
        "CARPENTRY SHOP", "PASSION CLASS"
    ]

    def drbx():
        tile = Txtbx()
        tile.update()
        textbox.blit(tile.image, [tx, ty])

    def drhl():
        global tx
        global tl
        tx = 0
        drbx()
        tl += 1
        while tx < 224:
            tx += 8
            drbx()
        tx = 232
        tl += 1
        drbx()

    def dral():
        global ty
        global tl
        while ty < 96:
            tl = 3
            ty += 8
            drhl()

    def walkani():
        global bkx
        global wthy
        global sprxy
        global spr
        if ((anifr / 12) - (anifr // 12)) < 0.5:
            wthy = 0
            bkx = -8
            spr = 11
            sprxy = 98 + (32 - asprs[avars[3][5]][spr].get_height())
        else:
            if s == 3:
                wthy = 8
            else:
                wthy = 16
            bkx = 0
            spr = 13
            sprxy = 96 + (32 - asprs[avars[3][5]][spr].get_height())

    def arrive():
        global wthy
        global sprx
        global spry
        global spr
        if anifr < 48:
            if ((anifr / 12) - (anifr // 12)) < 0.5:
                wthy = 0
                spr = 11
                spry = 98 + (32 - asprs[avars[3][5]][spr].get_height())
            else:
                if s == 3:
                    wthy = 8
                else:
                    wthy = 16
                spr = 13
                spry = 96 + (32 - asprs[avars[3][5]][spr].get_height())
        else:
            if ((anifr / 12) - (anifr // 12)) < 0.5:
                wthy = 0
                spr = 3
                spry = 98 + (32 - asprs[avars[3][5]][spr].get_height())
            else:
                if s == 3:
                    wthy = 8
                else:
                    wthy = 16
                spr = 5
                spry = 96 + (32 - asprs[avars[3][5]][spr].get_height())
        if 0 <= anifr < 6:
            sprx = 208 + ((32 - asprs[avars[3][5]][spr].get_width()) // 2)
        elif 6 <= anifr < 12:
            sprx = 198 + ((32 - asprs[avars[3][5]][spr].get_width()) // 2)
        elif 12 <= anifr < 18:
            sprx = 188 + ((32 - asprs[avars[3][5]][spr].get_width()) // 2)
        elif 18 <= anifr < 24:
            sprx = 178 + ((32 - asprs[avars[3][5]][spr].get_width()) // 2)
        elif 24 <= anifr < 30:
            sprx = 168 + ((32 - asprs[avars[3][5]][spr].get_width()) // 2)
        elif 30 <= anifr < 36:
            sprx = 158 + ((32 - asprs[avars[3][5]][spr].get_width()) // 2)
        elif 36 <= anifr < 42:
            sprx = 148 + ((32 - asprs[avars[3][5]][spr].get_width()) // 2)
        elif 42 <= anifr < 48:
            sprx = 138 + ((32 - asprs[avars[3][5]][spr].get_width()) // 2)
        else:
            sprx = 128 + ((32 - asprs[avars[3][5]][spr].get_width()) // 2)

    tpborder, btborder, borderico = borders.getborders(avars[3][13], 1, 3, 0)

    hn = pygame.image.load("Sprites/Misc/menu/hngs.png").convert()
    hp = pygame.image.load("Sprites/Misc/menu/hpys.png").convert()
    sk = pygame.image.load("Sprites/Misc/menu/scks.png").convert()
    sl = pygame.image.load("Sprites/Misc/menu/slps.png").convert()

    wlkbk = pygame.image.load("Sprites/Misc/bg/walkbg.png").convert()
    wlkfr = pygame.image.load("Sprites/Misc/bg/walkfg.png").convert()

    rain = pygame.image.load("Sprites/Misc/bg/rain.png").convert()
    snow = pygame.image.load("Sprites/Misc/bg/snow.png").convert()

    tamadepabk = pygame.image.load("Sprites/Misc/bg/tamadepa.png").convert()

    presbk = pygame.image.load("Sprites/Misc/bg/presen.png").convert()

    schbk = [
        pygame.image.load("Sprites/Misc/bg/schoolen.png").convert(),
        pygame.image.load("Sprites/Misc/bg/schoolens.png").convert(),
        pygame.image.load("Sprites/Misc/bg/schoolena.png").convert(),
        pygame.image.load("Sprites/Misc/bg/schoolenw.png").convert()
    ]

    datepl = pygame.image.load("Sprites/Misc/bg/dateplen.png").convert()

    eggado = pygame.image.load("Sprites/Misc/bg/eggout.png").convert()

    parents = pygame.image.load("Sprites/Misc/bg/parento.png").convert()

    if avars[avars[3][5]][31] > 3:
        jobpbk = pygame.Surface((240, 160)).convert()
        s = pygame.image.load("Sprites/Misc/bg/job_1.png").convert()
        jobpbk.blit(s, [
            -(240 * ((avars[avars[3][5]][31] - 4) % 6)),
            -(160 * ((avars[avars[3][5]][31] - 4) // 6))
        ])

    fnt = pygame.font.Font("Sprites/Misc/font/Tama2.ttf", 16)

    textbox = pygame.Surface([240, 112]).convert()
    textbox.fill((0, 255, 255))
    global tl
    global ty
    tl = 0
    ty = 0
    drhl()
    dral()
    tl = 6
    ty = 104
    drhl()

    scrli = pygame.image.load("Sprites/Misc/txtbox/scrli.png").convert()

    clock = pygame.time.Clock()

    sound = sounds.imprtsnd(avars)

    anifr = 0

    pygame.time.set_timer(USEREVENT + 1, int(1000 / ((5 * avars[3][3]) + 1)))

    if avars[3][3] == 0:
        avars[3][6] = time.strftime("%H:%M")

    while kr:
        if bx:
            screen.blit(textbox, [0, 24])
            screen.blit(scrli, [232, 128])
            if scr == 0:
                screen.blit((fnt.render("TAMADEPA", 1, (0, 0, 100))), [8, 34])
                screen.blit((fnt.render("PARK", 1, (0, 0, 100))), [8, 50])
                if avars[avars[3][5]][31] == 0 or avars[avars[3][5]][31] > 39:
                    screen.blit((fnt.render("? ? ? ? ?", 1, (102, 102, 255))),
                                [8, 66])
                else:
                    if 8 < int(avars[3][6][:2]) < 17:
                        screen.blit(
                            (fnt.render(jloc[avars[avars[3][5]][31] - 1], 1,
                                        (0, 0, 100))), [8, 66])
                    else:
                        screen.blit(
                            (fnt.render(jloc[avars[avars[3][5]][31] - 1], 1,
                                        (102, 102, 255))), [8, 66])
                if avars[avars[3][5]][2] > 691199:
                    screen.blit((fnt.render("DATE PLACE", 1, (0, 0, 100))),
                                [8, 82])
                else:
                    screen.blit((fnt.render("DATE PLACE", 1, (102, 102, 255))),
                                [8, 82])
                if avars[avars[3][5]][2] > 691199:
                    screen.blit((fnt.render("EGG ADOPTION", 1, (0, 0, 100))),
                                [8, 98])
                else:
                    screen.blit((fnt.render("EGG ADOPTION", 1,
                                            (102, 102, 255))), [8, 98])
                if (8 < int(avars[3][6][:2]) <
                        17) and (avars[avars[3][5]][1] <
                                 6) and (avars[avars[3][5]][3] > 1):
                    screen.blit((fnt.render("PARENTS", 1, (0, 0, 100))),
                                [8, 114])
                else:
                    screen.blit((fnt.render("PARENTS", 1, (102, 102, 255))),
                                [8, 114])
            elif scr == 1:
                if (avars[3][14][0] == '1') and (avars[3][14][7] == '1'):
                    screen.blit((fnt.render("MAKKAKKA TOWN", 1,
                                            (255, 102, 0))), [8, 34])
                else:
                    screen.blit((fnt.render("? ? ? ? ?", 1, (102, 102, 255))),
                                [8, 34])
                if (avars[3][14][1] == '1') and (avars[3][14][4] == '1'):
                    screen.blit((fnt.render("MAME CITY", 1, (102, 102, 204))),
                                [8, 50])
                else:
                    screen.blit((fnt.render("? ? ? ? ?", 1, (102, 102, 255))),
                                [8, 50])
                if (avars[3][14][5] == '1') and (avars[3][14][6] == '1'):
                    screen.blit((fnt.render("GURUGURU TOWN", 1,
                                            (204, 102, 102))), [8, 66])
                else:
                    screen.blit((fnt.render("? ? ? ? ?", 1, (102, 102, 255))),
                                [8, 66])
                if (avars[3][14][2] == '1') and (avars[3][14][3] == '1'):
                    screen.blit((fnt.render("PATCHI FOREST", 1,
                                            (102, 204, 102))), [8, 82])
                else:
                    screen.blit((fnt.render("? ? ? ? ?", 1, (102, 102, 255))),
                                [8, 82])
                if avars[3][14].count('0') == 0:
                    screen.blit((fnt.render("URA TAMATOWN", 1, (0, 153, 238))),
                                [8, 98])
                else:
                    screen.blit((fnt.render("? ? ? ? ?", 1, (102, 102, 255))),
                                [8, 98])
        elif walk:
            if ((anifr / 12) - (anifr // 12)) == 0.5:
                pygame.mixer.stop()
                sound[6].play()
            screen.blit(wlkwb, [0, 0])
            screen.blit(wlkbk, [0, 0])
            walkani()
            screen.blit(wlkfr, [bkx, 24])
            screen.blit(asprs[avars[3][5]][spr], [sprxy, sprxy])
            if w == 2:
                screen.blit(wprec, [0, wthy])
        else:
            if dest == 0:
                screen.blit(tamadepabk, [0, 0])
            elif dest == 2:
                screen.blit(wlkwb, [0, 0])
                screen.blit(presbk, [0, 0])
            elif dest == 3:
                screen.blit(wlkwb, [0, 0])
                screen.blit(schbk[s], [0, 0])
            elif 4 < dest < 41:
                screen.blit(jobpbk, [0, 0])
            elif dest == 41:
                screen.blit(datepl, [0, 0])
            elif dest == 42:
                screen.blit(eggado, [0, 0])
            elif dest == 43:
                screen.blit(wlkwb, [0, 0])
                screen.blit(parents, [0, 0])
            if anifr < 48 and ((anifr / 12) - (anifr // 12)) == 0.5:
                pygame.mixer.stop()
                sound[6].play()
            elif ((anifr / 12) - (anifr // 12)) == 0.5:
                pygame.mixer.stop()
                sound[9].play()
            arrive()
            screen.blit(asprs[avars[3][5]][spr], [sprx, spry])
            if w == 2 and dest not in [10, 16, 22, 28, 34, 40]:
                screen.blit(wprec, [0, wthy])
        screen = borders.drawborders(screen, avars, asprs, tpborder, btborder,
                                     borderico, fnt, 0, anifr, hn, hp, sk, sl)
        for event in pygame.event.get():
            if event.type == QUIT:
                varsup.updtvrs(avars)
                kr = False
                pygame.quit()
                sys.exit()
            if event.type == MOUSEBUTTONDOWN:
                mp = event.pos
                d = (screen.get_size()[0] // 240)
                mp = ((mp[0] // d), (mp[1] // d))
                pb = event.button + (spclk * (1 + (event.button > 2)))
                if pb in [2, 4]:
                    if 24 < mp[1] < 136:
                        sound[2].play()
                        if scr != 1:
                            scr += 1
                        else:
                            scr = 0
                        clt = 0
                elif pb == 5:
                    if 24 < mp[1] < 136:
                        sound[2].play()
                        if scr != 0:
                            scr -= 1
                        else:
                            scr = 1
                        clt = 0
                elif pb == 1:
                    clt = 0
                    if 138 < mp[1] < 158:
                        if 228 < mp[0] < 240:
                            pygame.mixer.stop()
                            sound[4].play()
                            return (avars)
                    if bx:
                        if scr == 0:
                            if (32 < mp[1] < 48) and (8 < mp[0] < 112):
                                pygame.mixer.stop()
                                sound[3].play()
                                bx = False
                                dest = 0
                                walk = True
                                s, tm, w = weather.chktime(avars)
                                wlkwb = pygame.image.load("Sprites/Misc/bg/" +
                                                          wthrbk[w][tm] +
                                                          ".png").convert()
                                if s < 3:
                                    wprec = rain
                                else:
                                    wprec = snow
                                anifr = -1
                            if (48 < mp[1] < 64) and (8 < mp[0] < 58):
                                pygame.mixer.stop()
                                sound[3].play()
                                bx = False
                                dest = 1
                                walk = True
                                s, tm, w = weather.chktime(avars)
                                wlkwb = pygame.image.load("Sprites/Misc/bg/" +
                                                          wthrbk[w][tm] +
                                                          ".png").convert()
                                if s < 3:
                                    wprec = rain
                                else:
                                    wprec = snow
                                anifr = -1
                            if (64 < mp[1] < 80) and (8 < mp[0] < 232) and (
                                    8 < int(avars[3][6][:2]) <
                                    17) and 0 < avars[avars[3][5]][31] < 40:
                                pygame.mixer.stop()
                                sound[3].play()
                                bx = False
                                dest = avars[avars[3][5]][31] + 1
                                walk = True
                                s, tm, w = weather.chktime(avars)
                                wlkwb = pygame.image.load("Sprites/Misc/bg/" +
                                                          wthrbk[w][tm] +
                                                          ".png").convert()
                                if s < 3:
                                    wprec = rain
                                else:
                                    wprec = snow
                                anifr = -1
                            if (80 < mp[1] < 96) and (8 < mp[0] < 232) and (
                                    avars[avars[3][5]][2] > 691199):
                                pygame.mixer.stop()
                                sound[3].play()
                                bx = False
                                dest = 41
                                walk = True
                                s, tm, w = weather.chktime(avars)
                                wlkwb = pygame.image.load("Sprites/Misc/bg/" +
                                                          wthrbk[w][tm] +
                                                          ".png").convert()
                                if s < 3:
                                    wprec = rain
                                else:
                                    wprec = snow
                                anifr = -1
                            if (96 < mp[1] < 112) and (8 < mp[0] < 232) and (
                                    avars[avars[3][5]][2] > 691199):
                                pygame.mixer.stop()
                                sound[3].play()
                                bx = False
                                dest = 42
                                walk = True
                                s, tm, w = weather.chktime(avars)
                                wlkwb = pygame.image.load("Sprites/Misc/bg/" +
                                                          wthrbk[w][tm] +
                                                          ".png").convert()
                                if s < 3:
                                    wprec = rain
                                else:
                                    wprec = snow
                                anifr = -1
                            if (112 < mp[1] < 128) and (8 < mp[0] < 232) and (
                                    8 < int(avars[3][6][:2]) <
                                    17) and (avars[avars[3][5]][1] < 6) and (
                                        avars[avars[3][5]][3] > 1):
                                pygame.mixer.stop()
                                sound[3].play()
                                bx = False
                                dest = 43
                                walk = True
                                s, tm, w = weather.chktime(avars)
                                wlkwb = pygame.image.load("Sprites/Misc/bg/" +
                                                          wthrbk[w][tm] +
                                                          ".png").convert()
                                if s < 3:
                                    wprec = rain
                                else:
                                    wprec = snow
                                anifr = -1
                        elif scr == 1:
                            if (32 < mp[1] < 48) and (8 < mp[0] < 232) and (
                                    avars[3][14][0]
                                    == '1') and (avars[3][14][7] == '1'):
                                pygame.mixer.stop()
                                sound[3].play()
                                bx = False
                                dest = 44
                                walk = True
                                s, tm, w = weather.chktime(avars)
                                wlkwb = pygame.image.load("Sprites/Misc/bg/" +
                                                          wthrbk[w][tm] +
                                                          ".png").convert()
                                if s < 3:
                                    wprec = rain
                                else:
                                    wprec = snow
                                anifr = -1
                            if (48 < mp[1] < 64) and (8 < mp[0] < 232) and (
                                    avars[3][14][1]
                                    == '1') and (avars[3][14][4] == '1'):
                                pygame.mixer.stop()
                                sound[3].play()
                                bx = False
                                dest = 45
                                walk = True
                                s, tm, w = weather.chktime(avars)
                                wlkwb = pygame.image.load("Sprites/Misc/bg/" +
                                                          wthrbk[w][tm] +
                                                          ".png").convert()
                                if s < 3:
                                    wprec = rain
                                else:
                                    wprec = snow
                                anifr = -1
                            if (64 < mp[1] < 80) and (8 < mp[0] < 232) and (
                                    avars[3][14][5]
                                    == '1') and (avars[3][14][6] == '1'):
                                pygame.mixer.stop()
                                sound[3].play()
                                bx = False
                                dest = 46
                                walk = True
                                s, tm, w = weather.chktime(avars)
                                wlkwb = pygame.image.load("Sprites/Misc/bg/" +
                                                          wthrbk[w][tm] +
                                                          ".png").convert()
                                if s < 3:
                                    wprec = rain
                                else:
                                    wprec = snow
                                anifr = -1
                            if (80 < mp[1] < 90) and (8 < mp[0] < 232) and (
                                    avars[3][14][2]
                                    == '1') and (avars[3][14][3] == '1'):
                                pygame.mixer.stop()
                                sound[3].play()
                                bx = False
                                dest = 47
                                walk = True
                                s, tm, w = weather.chktime(avars)
                                wlkwb = pygame.image.load("Sprites/Misc/bg/" +
                                                          wthrbk[w][tm] +
                                                          ".png").convert()
                                if s < 3:
                                    wprec = rain
                                else:
                                    wprec = snow
                                anifr = -1
                            if (96 < mp[1] < 112) and (8 < mp[0] < 232) and (
                                    avars[3][14].count('0') == 0):
                                pygame.mixer.stop()
                                sound[3].play()
                                bx = False
                                dest = 48
                                walk = True
                                s, tm, w = weather.chktime(avars)
                                wlkwb = pygame.image.load("Sprites/Misc/bg/" +
                                                          wthrbk[w][tm] +
                                                          ".png").convert()
                                if s < 3:
                                    wprec = rain
                                else:
                                    wprec = snow
                                anifr = -1
                    elif anifr > 3:
                        if 24 < mp[1] < 136:
                            pygame.mixer.stop()
                            sound[3].play()
                            anifr = 63
                            walk = False
                if pb == 3 and bx and (64 < mp[1] < 80) and (
                        8 < mp[0] < 232) and (8 < int(avars[3][6][:2]) < 17
                                              ) and avars[avars[3][5]][31] > 3:
                    pygame.mixer.stop()
                    sound[4].play()
                    avars[avars[3][5]][31] = 3
            if event.type == USEREVENT + 1:
                if avars[3][3] == 0:
                    avars[3][6] = time.strftime("%H:%M")
                else:
                    avars[3][7] += 1
                    if avars[3][7] == 60:
                        if int(avars[3][6][3:]) != 59:
                            nhour = avars[3][6][:3] + (
                                "%02d" % (int(avars[3][6][3:]) + 1))
                            avars[3][6] = nhour
                        else:
                            nhour = ("%02d" %
                                     (int(avars[3][6][:2]) + 1)) + ":00"
                            if nhour == "24:00":
                                nhour = "00:00"
                            avars[3][6] = nhour
                        avars[3][7] = 0
                if len(avars[0]) > 0:
                    avars[0][2] += 1
                if len(avars[1]) > 0:
                    avars[1][2] += 1
                if len(avars[2]) > 0:
                    avars[2][2] += 1
                chngsts = True
                if bx:
                    clt += 1
        if chngsts:
            avars = statusup.chngsts(avars)
            if avars[avars[3][5]][20] or not avars[avars[3][5]][21]:
                return (avars)
            chngsts = False
        if anifr < 63:
            anifr += 1
        else:
            anifr = 0
            if not bx:
                if dest == 0 and (not walk):
                    avars, ret = tamadepa.depa(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 1:
                    avars, ret = park.prk(avars, asprs, screen, 0, 0, 0, [])
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 2 and (not walk):
                    avars, ret = preschool.pres(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 3 and (not walk):
                    avars, ret = tamaschool.school(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 4:
                    avars, ret = jobhnt.job(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                    if avars[avars[3][5]][31] > 3:
                        jobpbk = pygame.Surface((240, 160)).convert()
                        s = pygame.image.load(
                            "Sprites/Misc/bg/job_1.png").convert()
                        jobpbk.blit(s, [
                            -(240 * ((avars[avars[3][5]][31] - 4) % 6)),
                            -(160 * ((avars[avars[3][5]][31] - 4) // 6))
                        ])
                elif dest == 5 and (not walk):
                    avars, ret = lab.game(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 6 and (not walk):
                    avars, ret = libr.game(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 7 and (not walk):
                    avars, ret = tamax.game(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 8 and (not walk):
                    avars, ret = hospital.game(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 9 and (not walk):
                    avars, ret = bank.game(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 10 and (not walk):
                    avars, ret = lclass.game(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 11 and (not walk):
                    avars, ret = concert.game(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 12 and (not walk):
                    avars, ret = fashion.game(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 13 and (not walk):
                    avars, ret = bakery.game(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 14 and (not walk):
                    avars, ret = hair.game(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 15 and (not walk):
                    avars, ret = florist.game(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 16 and (not walk):
                    avars, ret = aclass.game(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 17 and (not walk):
                    avars, ret = springs.game(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 18 and (not walk):
                    avars, ret = prest.game(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 19 and (not walk):
                    avars, ret = station.game(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 20 and (not walk):
                    avars, ret = police.game(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 21 and (not walk):
                    avars, ret = chef.game(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 22 and (not walk):
                    avars, ret = kclass.game(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 23 and (not walk):
                    avars, ret = comedy.game(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 24 and (not walk):
                    avars, ret = circus.game(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 25 and (not walk):
                    avars, ret = festival.game(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 26 and (not walk):
                    avars, ret = mangaka.game(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 27 and (not walk):
                    avars, ret = toy.game(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 28 and (not walk):
                    avars, ret = hclass.game(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 29 and (not walk):
                    avars, ret = enka.game(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 30 and (not walk):
                    avars, ret = art.game(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 31 and (not walk):
                    avars, ret = jewel.game(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 32 and (not walk):
                    avars, ret = dancer.game(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 33 and (not walk):
                    avars, ret = magic.game(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 34 and (not walk):
                    avars, ret = bclass.game(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 35 and (not walk):
                    avars, ret = builder.game(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 36 and (not walk):
                    avars, ret = adventure.game(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 37 and (not walk):
                    avars, ret = martial.game(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 38 and (not walk):
                    avars, ret = fire.game(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 39 and (not walk):
                    avars, ret = carpenter.game(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 40 and (not walk):
                    avars, ret = pclass.game(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 41 and (not walk):
                    avars, ret = date.fdt(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 42 and (not walk):
                    avars, ret = eggad.adop(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 43 and (not walk):
                    avars, ret = parent.phom(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 44:
                    avars, ret = makkaka.prk(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 45:
                    avars, ret = mamec.prk(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 46:
                    avars, ret = gurut.prk(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 47:
                    avars, ret = patchif.prk(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
                elif dest == 48:
                    avars, ret = uratama.prk(avars, asprs, screen)
                    if ret:
                        return (avars)
                    bx = True
            walk = False
        if clt > 29:
            return (avars)
        r = pygame.Surface([240, 160]).convert()
        r.blit(screen, [0, 0])
        r = pygame.transform.scale(
            r, (screen.get_size()[0], screen.get_size()[1]))
        screen.blit(r, [0, 0])
        clock.tick(16)
        pygame.display.update()
예제 #4
0
def game(avars, asprs, screen, tsprs):

    kr = True

    chngsts = False

    scr = 0

    ret = 1

    plntl = [0, 0, 0, 0, 0, 0, 0, 0]

    wtplnt = 0

    tuts = True
    strt = False
    play = False
    end = 0

    tpborder, btborder, borderico = borders.getborders(avars[3][13], 1, 3, 1)

    hn = pygame.image.load("Sprites/Misc/menu/hngs.png").convert()
    hp = pygame.image.load("Sprites/Misc/menu/hpys.png").convert()
    sk = pygame.image.load("Sprites/Misc/menu/scks.png").convert()
    sl = pygame.image.load("Sprites/Misc/menu/slps.png").convert()

    classbg = pygame.image.load("Sprites/Misc/bg/kndclass.png").convert()

    pgbk = ["pgbk", "pgbks", "pgbka", "pgbkw"]

    s, tm, w = weather.chktime(avars)

    tutimg = pygame.image.load("Sprites/Misc/bg/watert.png").convert()

    gamebg = pygame.image.load("Sprites/Misc/bg/" + pgbk[s] + ".png").convert()
    gardbg = pygame.image.load("Sprites/Misc/bg/waterbg.png").convert()

    gamebg.blit(gardbg, [0, 0])

    plnt1 = pygame.image.load("Sprites/Misc/bg/water1.png").convert()
    plnt2 = pygame.image.load("Sprites/Misc/bg/water2.png").convert()
    plnt3 = pygame.image.load("Sprites/Misc/bg/water3.png").convert()

    plnts = [plnt2, plnt3]

    plntg = pygame.image.load("Sprites/Misc/bg/water4.png").convert()

    wtcan = pygame.image.load("Sprites/Misc/obj/watercan.png").convert()

    ready = pygame.image.load("Sprites/Misc/bg/ready.png").convert()
    go = pygame.image.load("Sprites/Misc/bg/go.png").convert()

    toobad = pygame.image.load("Sprites/Misc/bg/toobad.png").convert()
    good = pygame.image.load("Sprites/Misc/bg/good.png").convert()
    great = pygame.image.load("Sprites/Misc/bg/great.png").convert()
    excellent = pygame.image.load("Sprites/Misc/bg/excellent.png").convert()

    fnt = pygame.font.Font("Sprites/Misc/font/Tama2.ttf", 16)

    clock = pygame.time.Clock()

    sound = sounds.imprtsnd(avars)

    anifr = 0

    pygame.time.set_timer(USEREVENT + 1, int(1000 / ((5 * avars[3][3]) + 1)))

    if avars[3][3] == 0:
        avars[3][6] = time.strftime("%H:%M")

    while kr:
        if tuts:
            screen.blit(tutimg, [0, 0])
        elif strt:
            screen.blit(classbg, [0, 0])
            if anifr == 16:
                pygame.mixer.stop()
                sound[11].play()
            if anifr < 16:
                screen.blit(ready, [80, 40])
                tcs = 0
                spr = 3
            else:
                screen.blit(go, [95, 40])
                tcs = 2
                spr = 5
            screen.blit(tsprs[tcs], [136, 98])
            screen.blit(asprs[avars[3][5]][spr],
                        [(72 +
                          ((32 - asprs[avars[3][5]][spr].get_width()) // 2)),
                         (98 + (32 - asprs[avars[3][5]][spr].get_height()))])
        elif play:
            screen.blit(gamebg, [0, 0])
            if end < 2:
                tcs = 0 + (anifr % 12 < 6)
                spr = 3 + (anifr % 12 < 6)
            elif end == 2:
                tcs = 1
                spr = 12
            else:
                tcs = 2 + (scr < 1152)
                spr = 5 + (scr < 1152)
            if end < 3:
                a = 0
                while a < 8:
                    if end == 0:
                        screen.blit(plnt1, [(10 + (28 * a)), 88])
                    else:
                        screen.blit(plnts[plntl[a] // 4],
                                    [(10 + (28 * a)), 88])
                    a += 1
            if end == 3:
                if scr < 1152:
                    a = 0
                    while a < 8:
                        screen.blit(plnts[plntl[a] // 5],
                                    [(10 + (28 * a)), 88])
                        a += 1
                else:
                    screen.blit(plntg, [10, 80])
            if end == 0:
                screen.blit(wtcan, [(26 + (28 * (anifr // 3))), 72])
            elif end == 2:
                screen.blit(wtcan, [(26 + (28 * wtplnt)), 72])
            screen.blit(tsprs[tcs], [205, 101])
            screen.blit(pygame.transform.flip(asprs[avars[3][5]][spr], 1, 0),
                        [(3 +
                          ((32 - asprs[avars[3][5]][spr].get_width()) // 2)),
                         (101 + (32 - asprs[avars[3][5]][spr].get_height()))])
        else:
            screen.blit(classbg, [0, 0])
            if end == 4:
                if scr < 4:
                    screen.blit(toobad, [71, 40])
                    if ((anifr / 12) - (anifr // 12)) < 0.5:
                        spr = 6
                        tcs = 1
                    else:
                        spr = 7
                        tcs = 3
                else:
                    if scr < 8:
                        screen.blit(good, [94, 40])
                    elif scr < 12:
                        screen.blit(great, [85, 40])
                    else:
                        screen.blit(excellent, [51, 40])
                    if ((anifr / 12) - (anifr // 12)) < 0.5:
                        spr = 4
                        tcs = 1
                    else:
                        spr = 5
                        tcs = 2
            screen.blit(tsprs[tcs], [136, 98])
            screen.blit(asprs[avars[3][5]][spr],
                        [(72 +
                          ((32 - asprs[avars[3][5]][spr].get_width()) // 2)),
                         (98 + (32 - asprs[avars[3][5]][spr].get_height()))])
        screen = borders.drawborders(screen, avars, asprs, tpborder, btborder,
                                     borderico, fnt, 0, anifr, hn, hp, sk, sl)
        for event in pygame.event.get():
            if event.type == QUIT:
                varsup.updtvrs(avars)
                kr = False
                pygame.quit()
                sys.exit()
            if event.type == MOUSEBUTTONDOWN:
                mp = event.pos
                d = (screen.get_size()[0] // 240)
                mp = ((mp[0] // d), (mp[1] // d))
                pb = event.button
                if pb == 1:
                    if 138 < mp[1] < 158:
                        if 228 < mp[0] < 240:
                            pygame.mixer.stop()
                            sound[4].play()
                            return (avars, ret)
                        elif 212 < mp[0] < 224:
                            pygame.mixer.stop()
                            sound[4].play()
                            ret = 0
                            return (avars, ret)
                    if (24 < mp[1] < 136) and tuts:
                        pygame.mixer.stop()
                        sound[10].play()
                        tuts = False
                        strt = True
                        anifr = -1
                    elif 88 < mp[1] < 112 and 8 < mp[
                            0] < 232 and play and end == 1:
                        end = 2
                        wtplnt = (mp[0] - 8) // 28
                        plntl[wtplnt] = 0
                        anifr = 19
            if event.type == USEREVENT + 1:
                if avars[3][3] == 0:
                    avars[3][6] = time.strftime("%H:%M")
                else:
                    avars[3][7] += 1
                    if avars[3][7] == 60:
                        if int(avars[3][6][3:]) != 59:
                            nhour = avars[3][6][:3] + (
                                "%02d" % (int(avars[3][6][3:]) + 1))
                            avars[3][6] = nhour
                        else:
                            nhour = ("%02d" %
                                     (int(avars[3][6][:2]) + 1)) + ":00"
                            if nhour == "24:00":
                                nhour = "00:00"
                            avars[3][6] = nhour
                        avars[3][7] = 0
                if len(avars[0]) > 0:
                    avars[0][2] += 1
                if len(avars[1]) > 0:
                    avars[1][2] += 1
                if len(avars[2]) > 0:
                    avars[2][2] += 1
                chngsts = True
        if chngsts:
            avars = statusup.chngsts(avars)
            chngsts = False
        if anifr < 23:
            anifr += 1
        else:
            anifr = 0
            if strt:
                play = True
                strt = False
            elif play:
                if end == 0:
                    end = 1
                    pygame.mixer.stop()
                    sound[9].play()
                elif end == 2:
                    end = 1
                elif end == 3:
                    play = False
                    end = 4
                    scr //= 96
                    if scr < 4:
                        pygame.mixer.stop()
                        sound[14].play()
                    else:
                        pygame.mixer.stop()
                        sound[1].play()
                    avars[avars[3][5]][7] += scr
            elif end == 4:
                ret = 0
                return (avars, ret)
        if play and end < 3:
            scr += 1
            if scr >= 1152:
                end = 3
                anifr = 12
                pygame.mixer.stop()
                sound[9].play()
        if play and end == 1 and anifr % 4 == 0:
            a = 0
            b = 0
            while a < 8:
                plntl[a] += choice([0, 0, 0, 1])
                b += plntl[a] > 7
                a += 1
            if b > 0:
                end = 3
                anifr = 12
                plnts.pop(0)
                plnts.append(plnt1)
                pygame.mixer.stop()
                sound[12].play()
        r = pygame.Surface([240, 160]).convert()
        r.blit(screen, [0, 0])
        r = pygame.transform.scale(
            r, (screen.get_size()[0], screen.get_size()[1]))
        screen.blit(r, [0, 0])
        clock.tick(16)
        pygame.display.update()
예제 #5
0
def wed(avars, asprs, fsprs, mate, screen):

    kr = True

    scr = 0

    chngsts = False

    def chsprs(chara, g):
        try:
            sprs = []
            if chara > 0:
                bs = pygame.image.load("Sprites/Characters/chara_" +
                                       str(chara) + "b.png")
                ss = pygame.image.load("Sprites/Characters/chara_" +
                                       str(chara) + "s.png")
            else:
                bs = pygame.image.load("Sprites/NPC/Nazotchi.png")
                ss = pygame.image.load("Sprites/NPC/Nazo.png")
            opal = []
            for i in range(32):
                opal.append(ss.get_at(((16 + (8 * (i % 2))), (16 + (i // 2)))))
            bs = palette.palch(bs, g, opal)
            ss = palette.palch(ss, g, opal)
            for i in range(3):
                a = pygame.Surface([16, 16])
                a.fill((0, 255, 255))
                a.blit(ss, [-(16 * (i % 2)), -(16 * (i // 2))])
                a.set_colorkey((0, 255, 255))
                a.convert()
                sprs.append(a)
            s = (bs.get_width() // 4)
            for i in range(16):
                spr = pygame.Surface([s, s]).convert()
                spr.fill((0, 255, 255))
                spr.blit(bs, [-(s * (i % 4)), -(s * (i // 4))])
                spr.set_colorkey((0, 255, 255))
                sprs.append(spr)
        except:
            sprs = chsprs(0, g)
        return (sprs)

    def nchild():
        negg = []
        l = [
            choice([avars[avars[3][5]][12], avars[avars[3][5]][13]]),
            choice([mate[4], mate[5]])
        ]
        if ((mate[6] != avars[avars[3][5]][0]) and
            (mate[6] != avars[avars[3][5]][11])) or (mate[6] in [
                'no', 'ma', 'me', 'ku'
            ]):
            if "no" in l:
                if l.count("no") == 2:
                    negg.append(8)
                else:
                    negg.append(1)
                negg.append(l.pop(l.index("no")))
                negg.append(l[0])
            elif "ma" in l:
                if l.count("ma") == 2:
                    negg.append(5)
                    negg.append(l.pop(l.index("ma")))
                else:
                    if "me" in l:
                        negg.append(7)
                        negg.append(l.pop(l.index("me")))
                    else:
                        negg.append(2)
                        negg.append(l.pop(l.index("ma")))
                negg.append(l[0])
            elif "me" in l:
                if l.count("me") == 2:
                    negg.append(6)
                    negg.append(l.pop(l.index("me")))
                else:
                    negg.append(4)
                    negg.append(l.pop(l.index("ku")))
                negg.append(l[0])
            else:
                negg.append(3)
                negg.append(l.pop(l.index("ku")))
                negg.append(l[0])
        else:
            negg.append(avars[avars[3][5]][0])
            negg.append(ced[str(avars[avars[3][5]][0])])
            negg.append(0)
        y = format(avars[avars[3][5]][14], '032b')
        m = format(mate[3], '032b')
        a = (int(y[:16], 2) & int(m[:16], 2))
        b = ((int(y[:16], 2) ^ int(m[:16], 2)) & randint(0, 65535))
        r = format((a | b), '016b') + format(
            (int(y[16:28], 2) ^ int(m[16:28], 2)), '012b') + format(
                randint(0, 15), '04b')
        if (mate[0] != "PARK") and (mate[0] != avars[3][0]):
            r = r[:30] + '0' + r[31]
        #print('%08x' % int(y, 2))
        #print('%08x' % int(m, 2))
        #print('%08x' % int(r, 2))
        negg.append(int(r, 2))
        return (negg)

    ced = {}
    for f in os.listdir("CCharacters"):
        if f.endswith(".txt") and (f != ("Names.txt")):
            n = open(("CCharacters/" + f), 'r')
            t = n.read()
            i = t.index('/')
            j = int(t[:i])
            if os.path.isfile("Sprites/Eggs/egg_" + str(j) +
                              "b.png") and os.path.isfile("Sprites/Eggs/egg_" +
                                                          str(j) +
                                                          "s.png") and (8 < j <
                                                                        16):
                ced.update({str(j): f[:(len(f) - 4)]})

    ht = pygame.image.load("Sprites/Misc/emo/heart.png").convert()
    ht2 = pygame.image.load("Sprites/Misc/emo/heart2.png").convert()

    walk = pygame.image.load("Sprites/Misc/bg/marrwlk.png").convert()

    s, tm, w = weather.chktime(avars)

    mbk = pygame.image.load("Sprites/Misc/bg/marrsc.png").convert()

    scn = pygame.Surface([240, 160]).convert()
    scn.fill((0, 255, 255))
    scn.blit(mbk, [-(240 * s), -160])
    scn.set_colorkey((0, 255, 255))

    sky = []
    for i in [0, 1, 2, 3]:
        c = pygame.Surface([240, 160]).convert()
        c.blit(mbk, [-(240 * i), 0])
        sky.append(c)

    prevs = []
    for i in avars[avars[3][5]][24]:
        c = chsprs(i, avars[avars[3][5]][14])
        prevs.append(c)

    clock = pygame.time.Clock()

    sound = sounds.imprtsnd(avars)

    anifr = 0

    pygame.time.set_timer(USEREVENT + 1, int(1000 / ((5 * avars[3][3]) + 1)))

    if avars[3][3] == 0:
        avars[3][6] = time.strftime("%H:%M")

    while kr:
        if scr == 0:
            screen.blit(walk, [0, 0])
            if anifr < 60:
                screen.blit(prevs[anifr // (60 // len(prevs))][11 + (2 * (anifr % 12 > 5))], [(240 - ((anifr // 6) * 20)), \
                                                                                              ((8 * (((anifr // (60 // len(prevs))) < 3) + ((anifr // (60 // len(prevs))) < 1))) \
                                                                                               + 98 + (2 * (anifr % 12 < 6)))])
                if (anifr % (60 // len(prevs))) == 0:
                    pygame.mixer.stop()
                    sound[3].play()
            elif anifr < 108:
                screen.blit(
                    pygame.transform.flip(
                        asprs[avars[3][5]][5 * (1 + (anifr % 12 > 5))], 1, 0),
                    [20, 100])
                screen.blit(fsprs[11 + (2 * (anifr % 12 > 5))],
                            [(240 - (((anifr - 60) // 6) * 20)),
                             (98 + (2 * (anifr % 12 < 6)))])
            elif anifr < 120:
                screen.blit(
                    pygame.transform.flip(asprs[avars[3][5]][15], 1, 0),
                    [20, 100])
                screen.blit(fsprs[15], [52, 100])
                if anifr == 108:
                    pygame.mixer.stop()
                    sound[9].play()
            else:
                screen.blit(asprs[avars[3][5]][11 + (2 * (anifr % 12 > 5))],
                            [(20 - (((anifr - 120) // 6) * 20)),
                             (98 + (2 * (anifr % 12 < 6)))])
                screen.blit(fsprs[11 + (2 * (anifr % 12 > 5))],
                            [(52 - (((anifr - 120) // 6) * 20)),
                             (98 + (2 * (anifr % 12 < 6)))])
        else:
            if anifr < 24:
                screen.blit(sky[0], [0, 0])
                screen.blit(scn, [0, 0])
                screen.blit([ht, ht2][anifr < 6], [112, 82])
                if anifr == 6:
                    pygame.mixer.stop()
                    sound[9].play()
                screen.blit(
                    pygame.transform.flip(
                        asprs[avars[3][5]][(15 - (3 * (anifr < 6)))], 1, 0),
                    [88, 104])
                screen.blit(fsprs[(15 - (3 * (anifr < 6)))], [120, 104])
            elif anifr < 84:
                i = (anifr - 24) / 6
                screen.blit(sky[1], [0, ((16 * i) - 160)])
                screen.blit(sky[0], [0, (16 * i)])
                screen.blit(scn, [0, (32 * i)])
                screen.blit(ht, [112, (82 + (32 * i))])
                screen.blit(
                    pygame.transform.flip(asprs[avars[3][5]][15], 1, 0),
                    [88, (104 + (32 * i))])
                screen.blit(fsprs[15], [120, (104 + (32 * i))])
            elif anifr < 96:
                screen.blit(sky[1], [0, 0])
            elif anifr < 102:
                if anifr == 96:
                    pygame.mixer.stop()
                    sound[3].play()
                screen.blit(sky[2], [0, 0])
            else:
                if anifr % 6 == 0:
                    pygame.mixer.stop()
                    sound[9].play()
                screen.blit(pygame.transform.flip(sky[3], (anifr % 12 < 6), 0),
                            [0, 0])
        for event in pygame.event.get():
            if event.type == QUIT:
                varsup.updtvrs(avars)
                kr = False
                pygame.quit()
                sys.exit()
            if event.type == USEREVENT + 1:
                if avars[3][3] == 0:
                    avars[3][6] = time.strftime("%H:%M")
                else:
                    avars[3][7] += 1
                    if avars[3][7] == 60:
                        if int(avars[3][6][3:]) != 59:
                            nhour = avars[3][6][:3] + (
                                "%02d" % (int(avars[3][6][3:]) + 1))
                            avars[3][6] = nhour
                        else:
                            nhour = ("%02d" %
                                     (int(avars[3][6][:2]) + 1)) + ":00"
                            if nhour == "24:00":
                                nhour = "00:00"
                            avars[3][6] = nhour
                        avars[3][7] = 0
                if len(avars[0]) > 0:
                    avars[0][2] += 1
                if len(avars[1]) > 0:
                    avars[1][2] += 1
                if len(avars[2]) > 0:
                    avars[2][2] += 1
                chngsts = True
        if chngsts:
            avars = statusup.chngsts(avars)
            chngsts = False
        if anifr < 143:
            anifr += 1
        else:
            anifr = 0
            if scr == 0:
                scr = 1
            else:
                negg = nchild()
                #print(negg)
                e = avars[3][14]
                e = e[:(negg[0] - 1)] + '1' + e[(negg[0]):]
                avars[3][14] = e
                avars = nextgen.bir(avars, asprs, mate, negg, screen)
                return (avars)
        r = pygame.Surface([240, 160]).convert()
        r.blit(screen, [0, 0])
        r = pygame.transform.scale(
            r, (screen.get_size()[0], screen.get_size()[1]))
        screen.blit(r, [0, 0])
        clock.tick(16)
        pygame.display.update()
예제 #6
0
def game(avars, asprs, screen, pchr1, psps1, pchr2, psps2, pchr3, psps3,
         mfsps):

    kr = True

    chngsts = False

    scr = 0

    chlst = [0, 1, 2]
    shuffle(chlst)

    xlst = [164, 116, 68]

    pcx1 = 208
    pcx2 = 208
    pcx3 = 208
    sprx = 208

    move = 0
    lose = False

    last = 3

    ret = 1

    tuts = True
    strt = False
    play = False
    end = 0

    swthr = ["skyd", "skyaf", "skyn"]
    cwthr = ["skydc", "skydc", "skync"]
    wthrbk = [swthr, cwthr, cwthr]

    pgbk = ["pgbk", "pgbks", "pgbka", "pgbkw"]

    def outbg():
        bg = pygame.image.load("Sprites/Misc/bg/" + wthrbk[w][tm] +
                               ".png").convert()
        a = pygame.image.load("Sprites/Misc/bg/" + pgbk[s] + ".png").convert()
        b = pygame.Surface([240, 160]).convert()
        c = (0, 0, 0)
        if w != 0:
            if w == 2:
                if s == 3:
                    a.blit(snowg, [0, 0])
                else:
                    a.blit(raing, [0, 0])
        a.blit(presout, [0, 0])
        if w != 0:
            b.fill((204, 204, 204))
            c = (81, 81, 81)
            b.set_alpha(102)
            a.blit(b, [0, 0])
        a.set_colorkey(c)
        bg.blit(a, [0, 0])
        return (bg)

    tpborder, btborder, borderico = borders.getborders(avars[3][13], 1, 3, 1)

    hn = pygame.image.load("Sprites/Misc/menu/hngs.png").convert()
    hp = pygame.image.load("Sprites/Misc/menu/hpys.png").convert()
    sk = pygame.image.load("Sprites/Misc/menu/scks.png").convert()
    sl = pygame.image.load("Sprites/Misc/menu/slps.png").convert()

    tutimg = pygame.image.load("Sprites/Misc/bg/statuest.png").convert()

    presin = pygame.image.load("Sprites/Misc/bg/presin.png").convert()
    presout = pygame.image.load("Sprites/Misc/bg/presout.png").convert()

    ready = pygame.image.load("Sprites/Misc/bg/ready.png").convert()
    go = pygame.image.load("Sprites/Misc/bg/go.png").convert()

    toobad = pygame.image.load("Sprites/Misc/bg/toobad.png").convert()
    good = pygame.image.load("Sprites/Misc/bg/good.png").convert()
    great = pygame.image.load("Sprites/Misc/bg/great.png").convert()
    excellent = pygame.image.load("Sprites/Misc/bg/excellent.png").convert()

    rain = pygame.image.load("Sprites/Misc/bg/rain.png").convert()
    snow = pygame.image.load("Sprites/Misc/bg/snow.png").convert()

    raing = pygame.image.load("Sprites/Misc/bg/rpgb.png").convert()
    snowg = pygame.image.load("Sprites/Misc/bg/spgb.png").convert()

    s, tm, w = weather.chktime(avars)

    obgi = outbg()

    fnt = pygame.font.Font("Sprites/Misc/font/Tama2.ttf", 16)

    clock = pygame.time.Clock()

    sound = sounds.imprtsnd(avars)

    anifr = 0

    pygame.time.set_timer(USEREVENT + 1, int(1000 / ((5 * avars[3][3]) + 1)))

    if avars[3][3] == 0:
        avars[3][6] = time.strftime("%H:%M")

    while kr:
        if tuts:
            screen.blit(tutimg, [0, 0])
        elif strt:
            screen.blit(presin, [0, 0])
            if anifr == 16:
                pygame.mixer.stop()
                sound[11].play()
            if anifr < 16:
                screen.blit(ready, [80, 40])
                mfs = 0
                spr = 3
                pcs1 = 3
                pcs2 = 3
                pcs3 = 3
            else:
                screen.blit(go, [95, 40])
                mfs = 2
                spr = 5
                pcs1 = 5
                pcs2 = 5
                pcs3 = 5
            screen.blit(mfsps[mfs], [104, 54])
            screen.blit(psps1[pcs1], [66, 106])
            screen.blit(psps2[pcs2], [94, 106])
            screen.blit(asprs[avars[3][5]][spr], [122, 106])
            screen.blit(psps3[pcs3], [150, 106])
        elif play:
            screen.blit(obgi, [0, 0])
            if w == 2:
                if ((anifr / 12) - (anifr // 12)) < 0.5:
                    y = 0
                else:
                    if s < 3:
                        y = 16
                    else:
                        y = 8
                if s < 3:
                    screen.blit(rain, [0, y])
                else:
                    screen.blit(snow, [0, y])
            if ((anifr / 6) - (anifr // 6)) == 0:
                if move == 1 or move == 2:
                    sprx -= 4
                    if move == 1:
                        move = 2
                    else:
                        move = 0
                    if anifr > 41:
                        lose = True
            if move == 2:
                if anifr < 42:
                    spr = 13
                else:
                    spr = 9
            elif move == 0 and lose:
                spr = 9
            else:
                spr = 11
            if ((anifr / 12) - (anifr // 12)) < 0.5:
                mfs = 0
                if scr == 0:
                    if anifr == 12 or anifr == 24 or anifr == 36:
                        pcx1 -= 4
                        pcx2 -= 4
                        pcx3 -= 4
                    pcs1 = 11
                    pcs2 = 11
                    pcs3 = 11
                elif scr == 1:
                    if anifr == 12 or anifr == 24:
                        pcx1 -= 4
                        pcx2 -= 4
                        pcx3 -= 4
                    elif anifr == 36:
                        if chlst[0] != 0:
                            pcx1 -= 4
                        if chlst[0] != 1:
                            pcx2 -= 4
                        if chlst[0] != 2:
                            pcx3 -= 4
                    pcs1 = 11
                    pcs2 = 11
                    pcs3 = 11
                elif scr == 2:
                    if anifr == 12 or anifr == 24 or anifr == 36:
                        if chlst[0] != 0:
                            pcx1 -= 4
                        if chlst[0] != 1:
                            pcx2 -= 4
                        if chlst[0] != 2:
                            pcx3 -= 4
                    if chlst[0] == 0:
                        pcs1 = 6
                        pcs2 = 11
                        pcs3 = 11
                    elif chlst[0] == 1:
                        pcs1 = 11
                        pcs2 = 6
                        pcs3 = 11
                    else:
                        pcs1 = 11
                        pcs2 = 11
                        pcs3 = 6
                elif scr == 3:
                    if anifr == 12 or anifr == 24:
                        if chlst[0] != 0:
                            pcx1 -= 4
                        if chlst[0] != 1:
                            pcx2 -= 4
                        if chlst[0] != 2:
                            pcx3 -= 4
                    elif anifr == 36:
                        if chlst[2] == 0:
                            pcx1 -= 4
                        if chlst[2] == 1:
                            pcx2 -= 4
                        if chlst[2] == 2:
                            pcx3 -= 4
                    if chlst[0] == 0:
                        pcs1 = 6
                        pcs2 = 11
                        pcs3 = 11
                    elif chlst[0] == 1:
                        pcs1 = 11
                        pcs2 = 6
                        pcs3 = 11
                    else:
                        pcs1 = 11
                        pcs2 = 11
                        pcs3 = 6
                elif scr == 4:
                    if anifr == 12 or anifr == 24 or anifr == 36:
                        if chlst[2] == 0:
                            pcx1 -= 4
                        if chlst[2] == 1:
                            pcx2 -= 4
                        if chlst[2] == 2:
                            pcx3 -= 4
                    if chlst[2] == 0:
                        pcs1 = 11
                        pcs2 = 6
                        pcs3 = 6
                    elif chlst[2] == 1:
                        pcs1 = 6
                        pcs2 = 11
                        pcs3 = 6
                    else:
                        pcs1 = 6
                        pcs2 = 6
                        pcs3 = 11
                elif scr == 5:
                    if anifr == 12 or anifr == 24:
                        if chlst[2] == 0:
                            pcx1 -= 4
                        if chlst[2] == 1:
                            pcx2 -= 4
                        if chlst[2] == 2:
                            pcx3 -= 4
                    if chlst[2] == 0:
                        pcs1 = 11
                        pcs2 = 6
                        pcs3 = 6
                    elif chlst[2] == 1:
                        pcs1 = 6
                        pcs2 = 11
                        pcs3 = 6
                    else:
                        pcs1 = 6
                        pcs2 = 6
                        pcs3 = 11
            else:
                if anifr < 42:
                    mfs = 1
                else:
                    mfs = 2
                if scr == 0:
                    if anifr == 6 or anifr == 18 or anifr == 30:
                        pcx1 -= 4
                        pcx2 -= 4
                        pcx3 -= 4
                    if anifr < 42:
                        pcs1 = 13
                        pcs2 = 13
                        pcs3 = 13
                    else:
                        pcs1 = 11
                        pcs2 = 11
                        pcs3 = 11
                elif scr == 1:
                    if anifr == 6 or anifr == 18:
                        pcx1 -= 4
                        pcx2 -= 4
                        pcx3 -= 4
                    elif anifr == 30:
                        if chlst[0] != 0:
                            pcx1 -= 4
                        if chlst[0] != 1:
                            pcx2 -= 4
                        if chlst[0] != 2:
                            pcx3 -= 4
                    elif anifr == 42:
                        if chlst[0] == 0:
                            pcx1 -= 4
                        if chlst[0] == 1:
                            pcx2 -= 4
                        if chlst[0] == 2:
                            pcx3 -= 4
                    if anifr < 30:
                        pcs1 = 13
                        pcs2 = 13
                        pcs3 = 13
                    elif anifr < 42:
                        if chlst[0] == 0:
                            pcs1 = 11
                            pcs2 = 13
                            pcs3 = 13
                        elif chlst[0] == 1:
                            pcs1 = 13
                            pcs2 = 11
                            pcs3 = 13
                        else:
                            pcs1 = 13
                            pcs2 = 13
                            pcs3 = 11
                    else:
                        if chlst[0] == 0:
                            pcs1 = 9
                            pcs2 = 11
                            pcs3 = 11
                        elif chlst[0] == 1:
                            pcs1 = 11
                            pcs2 = 9
                            pcs3 = 11
                        else:
                            pcs1 = 11
                            pcs2 = 11
                            pcs3 = 9
                elif scr == 2:
                    if anifr == 6 or anifr == 18 or anifr == 30:
                        if chlst[0] != 0:
                            pcx1 -= 4
                        if chlst[0] != 1:
                            pcx2 -= 4
                        if chlst[0] != 2:
                            pcx3 -= 4
                    if anifr < 42:
                        if chlst[0] == 0:
                            pcs1 = 7
                            pcs2 = 13
                            pcs3 = 13
                        elif chlst[0] == 1:
                            pcs1 = 13
                            pcs2 = 7
                            pcs3 = 13
                        else:
                            pcs1 = 13
                            pcs2 = 13
                            pcs3 = 7
                    else:
                        if chlst[0] == 0:
                            pcs1 = 7
                            pcs2 = 11
                            pcs3 = 11
                        elif chlst[0] == 1:
                            pcs1 = 11
                            pcs2 = 7
                            pcs3 = 11
                        else:
                            pcs1 = 11
                            pcs2 = 11
                            pcs3 = 7
                elif scr == 3:
                    if anifr == 6 or anifr == 18:
                        if chlst[0] != 0:
                            pcx1 -= 4
                        if chlst[0] != 1:
                            pcx2 -= 4
                        if chlst[0] != 2:
                            pcx3 -= 4
                    elif anifr == 30:
                        if chlst[2] == 0:
                            pcx1 -= 4
                        if chlst[2] == 1:
                            pcx2 -= 4
                        if chlst[2] == 2:
                            pcx3 -= 4
                    elif anifr == 42:
                        if chlst[1] == 0:
                            pcx1 -= 4
                        if chlst[1] == 1:
                            pcx2 -= 4
                        if chlst[1] == 2:
                            pcx3 -= 4
                    if anifr < 30:
                        if chlst[0] == 0:
                            pcs1 = 7
                            pcs2 = 13
                            pcs3 = 13
                        elif chlst[0] == 1:
                            pcs1 = 13
                            pcs2 = 7
                            pcs3 = 13
                        else:
                            pcs1 = 13
                            pcs2 = 13
                            pcs3 = 7
                    elif anifr < 42:
                        if chlst[0] == 0:
                            pcs1 = 7
                        elif chlst[0] == 1:
                            pcs2 = 7
                        else:
                            pcs3 = 7
                        if chlst[1] == 0:
                            pcs1 = 11
                        elif chlst[1] == 1:
                            pcs2 = 11
                        else:
                            pcs3 = 11
                        if chlst[2] == 0:
                            pcs1 = 13
                        elif chlst[2] == 1:
                            pcs2 = 13
                        else:
                            pcs3 = 13
                    else:
                        if chlst[0] == 0:
                            pcs1 = 7
                        elif chlst[0] == 1:
                            pcs2 = 7
                        else:
                            pcs3 = 7
                        if chlst[1] == 0:
                            pcs1 = 9
                        elif chlst[1] == 1:
                            pcs2 = 9
                        else:
                            pcs3 = 9
                        if chlst[2] == 0:
                            pcs1 = 11
                        elif chlst[2] == 1:
                            pcs2 = 11
                        else:
                            pcs3 = 11
                elif scr == 4:
                    if anifr == 6 or anifr == 18 or anifr == 30:
                        if chlst[2] == 0:
                            pcx1 -= 4
                        if chlst[2] == 1:
                            pcx2 -= 4
                        if chlst[2] == 2:
                            pcx3 -= 4
                    if anifr < 42:
                        if chlst[2] == 0:
                            pcs1 = 13
                            pcs2 = 7
                            pcs3 = 7
                        elif chlst[2] == 1:
                            pcs1 = 7
                            pcs2 = 13
                            pcs3 = 7
                        else:
                            pcs1 = 7
                            pcs2 = 7
                            pcs3 = 13
                    else:
                        if chlst[2] == 0:
                            pcs1 = 11
                            pcs2 = 7
                            pcs3 = 7
                        elif chlst[2] == 1:
                            pcs1 = 7
                            pcs2 = 11
                            pcs3 = 7
                        else:
                            pcs1 = 7
                            pcs2 = 7
                            pcs3 = 11
                elif scr == 5:
                    if anifr == 6 or anifr == 18 or anifr == 42:
                        if chlst[2] == 0:
                            pcx1 -= 4
                        if chlst[2] == 1:
                            pcx2 -= 4
                        if chlst[2] == 2:
                            pcx3 -= 4
                    if anifr < 30:
                        if chlst[2] == 0:
                            pcs1 = 13
                            pcs2 = 7
                            pcs3 = 7
                        elif chlst[2] == 1:
                            pcs1 = 7
                            pcs2 = 13
                            pcs3 = 7
                        else:
                            pcs1 = 7
                            pcs2 = 7
                            pcs3 = 13
                    elif anifr < 42:
                        if chlst[2] == 0:
                            pcs1 = 11
                            pcs2 = 7
                            pcs3 = 7
                        elif chlst[2] == 1:
                            pcs1 = 7
                            pcs2 = 11
                            pcs3 = 7
                        else:
                            pcs1 = 7
                            pcs2 = 7
                            pcs3 = 11
                    else:
                        if chlst[2] == 0:
                            pcs1 = 9
                            pcs2 = 7
                            pcs3 = 7
                        elif chlst[2] == 1:
                            pcs1 = 7
                            pcs2 = 9
                            pcs3 = 7
                        else:
                            pcs1 = 7
                            pcs2 = 7
                            pcs3 = 9
            screen.blit(mfsps[mfs], [32, 98])
            screen.blit(psps1[pcs1], [pcx1, 98])
            screen.blit(psps2[pcs2], [pcx2, 102])
            screen.blit(asprs[avars[3][5]][spr], [sprx, 106])
            screen.blit(psps3[pcs3], [pcx3, 110])
            if anifr == 42:
                if lose:
                    pygame.mixer.stop()
                    sound[12].play()
                else:
                    pygame.mixer.stop()
                    sound[9].play()
        else:
            screen.blit(presin, [0, 0])
            if end == 4:
                if ((anifr / 12) - (anifr // 12)) < 0.5:
                    mfs = 1
                else:
                    mfs = 2
                if scr < 1:
                    screen.blit(toobad, [71, 40])
                    if ((anifr / 12) - (anifr // 12)) < 0.5:
                        spr = 6
                        pcs1 = 4
                        pcs2 = 4
                        pcs3 = 4
                    else:
                        spr = 7
                        pcs1 = 5
                        pcs2 = 5
                        pcs3 = 5
                else:
                    if scr < 2:
                        screen.blit(good, [94, 40])
                    elif scr < 3:
                        screen.blit(great, [85, 40])
                    else:
                        screen.blit(excellent, [51, 40])
                    if ((anifr / 12) - (anifr // 12)) < 0.5:
                        spr = 4
                        if last == 0:
                            pcs1 = 6
                            pcs2 = 4
                            pcs3 = 4
                        elif last == 1:
                            pcs1 = 4
                            pcs2 = 6
                            pcs3 = 4
                        else:
                            pcs1 = 4
                            pcs2 = 4
                            pcs3 = 6
                    else:
                        spr = 5
                        if last == 0:
                            pcs1 = 7
                            pcs2 = 5
                            pcs3 = 5
                        elif last == 1:
                            pcs1 = 5
                            pcs2 = 7
                            pcs3 = 5
                        else:
                            pcs1 = 5
                            pcs2 = 5
                            pcs3 = 7
                screen.blit(mfsps[mfs], [104, 54])
                screen.blit(psps1[pcs1], [66, 106])
                screen.blit(psps2[pcs2], [94, 106])
                screen.blit(asprs[avars[3][5]][spr], [122, 106])
                screen.blit(psps3[pcs3], [150, 106])
        screen = borders.drawborders(screen, avars, asprs, tpborder, btborder,
                                     borderico, fnt, 0, anifr, hn, hp, sk, sl)
        for event in pygame.event.get():
            if event.type == QUIT:
                varsup.updtvrs(avars)
                kr = False
                pygame.quit()
                sys.exit()
            if event.type == MOUSEBUTTONDOWN:
                mp = event.pos
                d = (screen.get_size()[0] // 240)
                mp = ((mp[0] // d), (mp[1] // d))
                pb = event.button
                if pb == 1:
                    if 138 < mp[1] < 158:
                        if 228 < mp[0] < 240:
                            pygame.mixer.stop()
                            sound[4].play()
                            return (avars, ret)
                        elif 212 < mp[0] < 224:
                            pygame.mixer.stop()
                            sound[4].play()
                            ret = 0
                            return (avars, ret)
                    if (24 < mp[1] < 136) and tuts:
                        pygame.mixer.stop()
                        sound[10].play()
                        tuts = False
                        strt = True
                        anifr = -1
                    elif 24 < mp[1] < 136 and play and move == 0:
                        move = 1
            if event.type == USEREVENT + 1:
                if avars[3][3] == 0:
                    avars[3][6] = time.strftime("%H:%M")
                else:
                    avars[3][7] += 1
                    if avars[3][7] == 60:
                        if int(avars[3][6][3:]) != 59:
                            nhour = avars[3][6][:3] + (
                                "%02d" % (int(avars[3][6][3:]) + 1))
                            avars[3][6] = nhour
                        else:
                            nhour = ("%02d" %
                                     (int(avars[3][6][:2]) + 1)) + ":00"
                            if nhour == "24:00":
                                nhour = "00:00"
                            avars[3][6] = nhour
                        avars[3][7] = 0
                if len(avars[0]) > 0:
                    avars[0][2] += 1
                if len(avars[1]) > 0:
                    avars[1][2] += 1
                if len(avars[2]) > 0:
                    avars[2][2] += 1
                chngsts = True
        if chngsts:
            avars = statusup.chngsts(avars)
            chngsts = False
        if (anifr < 23 and (strt or end == 4)) or (anifr < 47 and play):
            anifr += 1
        else:
            anifr = 0
            if strt:
                play = True
                strt = False
            elif play:
                scr += 1
                if scr == 6 or lose:
                    pcx1 = xlst[chlst.index(0)]
                    pcx2 = xlst[chlst.index(1)]
                    pcx3 = xlst[chlst.index(2)]
                    wnlst = [pcx1, pcx2, pcx3, sprx]
                    wnlst.sort()
                    wnlst.reverse()
                    scr = wnlst.index(sprx)
                    if wnlst[0] == pcx1:
                        last = 0
                    elif wnlst[0] == pcx2:
                        last = 1
                    elif wnlst[0] == pcx3:
                        last = 2
                    play = False
                    if scr < 1:
                        pygame.mixer.stop()
                        sound[14].play()
                    else:
                        pygame.mixer.stop()
                        sound[1].play()
                    end = 4
                    if (avars[avars[3][5]][17] + scr) < 6:
                        avars[avars[3][5]][17] += scr
                    else:
                        avars[avars[3][5]][17] = 6
                    if (avars[avars[3][5]][18] - scr) > 1:
                        avars[avars[3][5]][18] -= scr
                    else:
                        avars[avars[3][5]][18] = 1
                    b = randint(0, 5)
                    avars[avars[3][5]][(5 + b)] += scr
            elif end == 4:
                ret = 0
                return (avars, ret)
        r = pygame.Surface([240, 160]).convert()
        r.blit(screen, [0, 0])
        r = pygame.transform.scale(
            r, (screen.get_size()[0], screen.get_size()[1]))
        screen.blit(r, [0, 0])
        clock.tick(16)
        pygame.display.update()
예제 #7
0
def mailbox(avars, asprs, screen, md):
    class Txtbx(pygame.sprite.Sprite):

        bxt = []

        def __init__(self):
            super().__init__()
            box = pygame.image.load("Sprites/Misc/txtbox/box1.png").convert()

            image = pygame.Surface([8, 8]).convert()
            image.set_colorkey((0, 0, 0))
            image.blit(box, (0, 0), (0, 0, 8, 8))
            self.bxt.append(image)
            image = pygame.Surface([8, 8]).convert()
            image.set_colorkey((0, 0, 0))
            image.blit(box, (0, 0), (8, 0, 8, 8))
            self.bxt.append(image)
            image = pygame.Surface([8, 8]).convert()
            image.set_colorkey((0, 0, 0))
            image.blit(box, (0, 0), (16, 0, 8, 8))
            self.bxt.append(image)
            image = pygame.Surface([8, 8]).convert()
            image.set_colorkey((0, 0, 0))
            image.blit(box, (0, 0), (0, 8, 8, 8))
            self.bxt.append(image)
            image = pygame.Surface([8, 8]).convert()
            image.set_colorkey((0, 0, 0))
            image.blit(box, (0, 0), (8, 8, 8, 8))
            self.bxt.append(image)
            image = pygame.Surface([8, 8]).convert()
            image.set_colorkey((0, 0, 0))
            image.blit(box, (0, 0), (16, 8, 8, 8))
            self.bxt.append(image)
            image = pygame.Surface([8, 8]).convert()
            image.set_colorkey((0, 0, 0))
            image.blit(box, (0, 0), (0, 16, 8, 8))
            self.bxt.append(image)
            image = pygame.Surface([8, 8]).convert()
            image.set_colorkey((0, 0, 0))
            image.blit(box, (0, 0), (8, 16, 8, 8))
            self.bxt.append(image)
            image = pygame.Surface([8, 8]).convert()
            image.set_colorkey((0, 0, 0))
            image.blit(box, (0, 0), (16, 16, 8, 8))
            self.bxt.append(image)

            self.image = self.bxt[0]
            self.rect = self.image.get_rect()

        def update(self):
            self.image = self.bxt[tl]

    kr = True

    global nflip
    nflip = False

    chngsts = False

    scr = 0

    clt = 0

    msel = 0

    swt = False

    inf = False

    tyod = 1

    swthr = ["skyd", "skyaf", "skyn"]
    cwthr = ["skydc", "skydc", "skync"]
    wthrbk = [swthr, cwthr, cwthr]

    pgbk = ["pgbk", "pgbks", "pgbka", "pgbkw"]

    def drbx():
        tile = Txtbx()
        tile.update()
        textbox.blit(tile.image, [tx, ty])

    def drhl():
        global tx
        global tl
        tx = 0
        drbx()
        tl += 1
        while tx < 224:
            tx += 8
            drbx()
        tx = 232
        tl += 1
        drbx()

    def dral():
        global ty
        global tl
        while ty < 96:
            tl = 3
            ty += 8
            drhl()

    def outbg():
        bg = pygame.image.load("Sprites/Misc/bg/" + wthrbk[w][tm] +
                               ".png").convert()
        a = pygame.image.load("Sprites/Misc/bg/" + pgbk[s] + ".png").convert()
        b = pygame.Surface([240, 160]).convert()
        c = (0, 0, 0)
        if w != 0:
            if w == 2:
                if s == 3:
                    a.blit(snowg, [0, 0])
                else:
                    a.blit(raing, [0, 0])
        a.blit(house, [0, 0])
        if w != 0:
            if tm < 2:
                b.fill((204, 204, 204))
                c = (81, 81, 81)
            else:
                b.fill((102, 102, 102))
                c = (40, 40, 40)
            b.set_alpha(102)
            a.blit(b, [0, 0])
        elif tm > 0:
            if tm == 1:
                b.fill((255, 102, 0))
                c = (101, 40, 0)
            else:
                b.fill((0, 0, 102))
                c = (0, 0, 40)
            b.set_alpha(102)
            a.blit(b, [0, 0])
        if tm == 2:
            a.blit(nwin, [204, 80])
        a.set_colorkey(c)
        bg.blit(a, [0, 0])
        return (bg)

    def mailani():
        nflip = False
        if anifr < 24 or anifr > 119:
            if ((anifr / 12) - (anifr // 12)) < 0.5:
                nzs = 5
            else:
                nzs = 3
            if anifr < 24:
                nflip = True
            if anifr < 6 or anifr > 137:
                nzx = -24
            elif anifr < 12 or 131 < anifr < 138:
                nzx = 0
            elif anifr < 18 or 125 < anifr < 132:
                nzx = 24
            else:
                nzx = 48
        elif anifr < 36 or 107 < anifr < 120:
            nzs = 2
            nzx = 48
        elif anifr < 84:
            if ((anifr / 12) - (anifr // 12)) < 0.5:
                nzs = 0
            else:
                nzs = 1
            nzx = 48
        elif anifr < 108:
            if anifr < 90 or anifr > 101:
                nzs = 3
            else:
                nzs = 4
            nflip = True
            nzx = 48
        return nzs, nzx, nflip

    tpborder, btborder, borderico = borders.getborders(avars[3][13], 1, 5, 0)

    nsprs = []
    s = pygame.image.load("Sprites/NPC/Nazotchi.png").convert()
    for i in range(6):
        a = pygame.Surface([32, 32]).convert()
        a.fill((0, 255, 255))
        a.blit(s, [-([0, 32, 64, 0, 32, 64][i]), -([0, 0, 0, 64, 64, 64][i])])
        a.set_colorkey((0, 255, 255))
        nsprs.append(a)

    hn = pygame.image.load("Sprites/Misc/menu/hngs.png").convert()
    hp = pygame.image.load("Sprites/Misc/menu/hpys.png").convert()
    sk = pygame.image.load("Sprites/Misc/menu/scks.png").convert()
    sl = pygame.image.load("Sprites/Misc/menu/slps.png").convert()

    house = pygame.image.load("Sprites/Misc/bg/house.png").convert()
    nwin = pygame.image.load("Sprites/Misc/bg/housewn.png").convert()

    mailbx = pygame.image.load("Sprites/Misc/obj/mailbx1.png").convert()
    letter = pygame.image.load("Sprites/Misc/obj/letter.png").convert()

    g = pygame.Surface([32, 32]).convert()
    g.fill((0, 255, 255))
    g.blit(pygame.image.load("Sprites/NPC/Guide.png").convert(), [0, 0])
    g.set_colorkey((0, 255, 255))

    b = pygame.Surface([32, 32]).convert()
    b.fill((0, 255, 255))
    b.blit(pygame.image.load("Sprites/NPC/Burglar.png").convert(), [0, 0])
    b.set_colorkey((0, 255, 255))

    s = pygame.Surface([32, 32]).convert()
    s.fill((0, 255, 255))
    s.blit(pygame.image.load("Sprites/NPC/Santa.png").convert(), [0, 0])
    s.set_colorkey((0, 255, 255))

    k = pygame.Surface([32, 32]).convert()
    k.fill((0, 255, 255))
    k.blit(pygame.image.load("Sprites/NPC/King.png").convert(), [0, 0])
    k.set_colorkey((0, 255, 255))

    nwsprs = [g, b, k, s]

    nwsprn = [1, 1, 2, 0, 0]

    gtnw = pygame.image.load("Sprites/Misc/bg/gotchinews.png").convert()
    tmlt = pygame.image.load("Sprites/Misc/bg/tamaletter.png").convert()

    if 0 < avars[avars[3][5]][31] < 4:
        worki = pygame.image.load(
            "Sprites/Misc/mail/" +
            ["kinderen", "schoolen", "joben"][avars[avars[3][5]][31] - 1] +
            ".png").convert()
    elif 3 < avars[avars[3][5]][31] < 40:
        worki = pygame.image.load("Sprites/Misc/mail/job_" +
                                  str(avars[avars[3][5]][31] - 3) +
                                  ".png").convert()
    else:
        worki = pygame.image.load("Sprites/Misc/mail/retire.png").convert()

    ltrbox = pygame.image.load("Sprites/Misc/txtbox/box3.png").convert()

    inbox = []

    for file in os.listdir("Sprites/Misc/mail/tm" + str(avars[3][5] + 1)):
        if file.endswith(".png"):
            if pygame.image.load("Sprites/Misc/mail/tm" +
                                 str(avars[3][5] + 1) + "/" +
                                 file).get_rect().size == (240, 160):
                inbox.append(
                    pygame.image.load("Sprites/Misc/mail/tm" +
                                      str(avars[3][5] + 1) + "/" +
                                      file).convert())

    inbox.reverse()

    rain = pygame.image.load("Sprites/Misc/bg/rain.png").convert()
    snow = pygame.image.load("Sprites/Misc/bg/snow.png").convert()

    raing = pygame.image.load("Sprites/Misc/bg/rpgb.png").convert()
    snowg = pygame.image.load("Sprites/Misc/bg/spgb.png").convert()

    s, tm, w = weather.chktime(avars)

    obgi = outbg()

    fnt = pygame.font.Font("Sprites/Misc/font/Tama2.ttf", 16)
    lfnt = pygame.font.Font("Sprites/Misc/font/Tama1.ttf", 8)

    textbox = pygame.Surface([240, 112]).convert()
    textbox.fill((0, 255, 255))
    global tl
    global ty
    tl = 0
    ty = 0
    drhl()
    dral()
    tl = 6
    ty = 104
    drhl()

    scrli = pygame.image.load("Sprites/Misc/txtbox/scrli.png").convert()

    if avars[3][11] > -1:
        newtx = fnt.render("NEWS", 1, (0, 0, 100))
    else:
        newtx = fnt.render("NEWS", 1, (102, 102, 255))
    pertx = fnt.render("PERSONAL", 1, (0, 0, 100))
    if avars[avars[3][5]][31] == 0:
        wrktx = fnt.render("WORK", 1, (102, 102, 255))
    else:
        wrktx = fnt.render("WORK", 1, (0, 0, 100))
    if len(inbox) == 0:
        frntx = fnt.render("FRIENDS", 1, (102, 102, 255))
    else:
        frntx = fnt.render("FRIENDS", 1, (0, 0, 100))

    newstx = [[
        "TO ALL INHABITANTS OF TAMAGOTCHI  PLANET:",
        "THE GOTCHI  BANK HAS BEEN ROBBED. THE",
        "BULGLAR HAS NOT BEEN FOUND YET. THE VICTIMS,",
        "THOSE WHOSE MONEY WAS TAKEN, WILL BE", "INFORMED BY MAIL.", "",
        "PLEASE CHECK YOUR MAIL TONIGHT."
    ],
              [
                  "TO ALL CITIZENS OF TAMAGOTCHI  TOWN:",
                  "A BULGLAR HAS BEEN SEEN WANDERING",
                  "AROUND TAMAGOTCHI  TOWN. PLEASE MAKE SURE",
                  "YOUR HOUSE IS WELL PROTECTED TO PREVENT", "ANY ROBBERY.",
                  "", "PLEASE BE CAREFUL."
              ],
              [
                  "NEWS FROM GOTCHI  KING'S CASTLE:",
                  "THE  KING HAS LEFT HIS CASTLE AND IS NOW",
                  "VISITING SOME OF OUR HOMES.",
                  "IF YOU ARE  LUCKY ENOUGH, HE  MIGHT GIVE  YOU",
                  "A PRESENT!", "", "HOW EXCITING!"
              ],
              [
                  "EVERYTHING IS GOING FINE ON OUR TOWN.",
                  "WE HOPE  YOU ALL HAVE A GOOD DAY", "",
                  "AS USUAL, A LETTER WILL BE  SENT TO EVERY OF",
                  "OUR CITIZENS THIS AFTERNOON.", "",
                  "PLEASE  STAY TUNED FOR MORE  NEWS TOMORROW!"
              ], []]

    if (time.strftime("%m") + time.strftime("%d")) == avars[3][1]:
        newstx.append([
            "IT SEEMS LIKE SOMEONE IS HAVING A", "BIRTHDAY TODAY...",
            "HAPPY BIRTHDAY, " + avars[3][0] + "!", "",
            "WE HOPE YOU HAVE A GREAT DAY!", "", "PLEASE, ACCEPT THIS CAKE!"
        ])
    if 2 < int(time.strftime("%m")) < 6:
        if int(time.strftime("%m")) == 3 and int(time.strftime("%d")) < 11:
            newstx[4] = [
                "THE  WINTER FREEZE IS LEAVING AT LAST.",
                "IT IS NOW THE BEGINNING OF A NEW SEASON",
                "HERE, IN TAMAGOTCHI  TOWN.", "",
                "WE WANT TO WISH ALL THE FAMILIES WITH",
                "GIRLS A HEALTHY GROWTH.",
                "DO NOT FORGET THE ORNAMENTAL DOLLS!"
            ]
        elif int(time.strftime("%m")) == 4 and int(time.strftime("%d")) < 11:
            newstx[4] = [
                "THE FLOWERS ARE  BLOOMING, DYEING OUR TOWN",
                "WITH THE  SOFT COLOURS OF SPRING.",
                "CHERRY BLOSSOMS CAN BE  SEEN ALL AROUND.", "",
                "WE WANT TO WISH ALL OUR CITIZENS A HAPPY AND",
                "EVENTFUL SEASON.", "ENJOY THE VIEWS AS LONG AS YOU CAN!"
            ]
            newstx.append([
                "WE HOPE YOU ARE ENJOYING THIS BEAUTIFUL",
                "SEASON, WITH  ALL OUR FLOWERS AT FULL BLOOM.", "",
                "WE HAVE SENT YOU A GIFT.", "PLEASE ACCEPT IT!", "",
                "WE WILL SEND YOU ANOTHER LETTER SOON."
            ])
        elif int(time.strftime("%m")) == 5 and int(time.strftime("%d")) < 11:
            newstx[4] = [
                "THE FLOWERS ARE SLOWLY DISAPPEARING AT",
                "THE INMINENT ARRIVAL OF SUMMER, ALL OVER",
                "OUR TOWN, TAMAGOTCHI  TOWN.", "",
                "WE WANT TO WISH ALL THE FAMILIES WITH",
                "BOYS A HEALTHY GROWTH.", "DO NOT FORGET THE CARP STREAMERS!"
            ]
        else:
            newstx[4] = [
                "TODAY IS JUST ANOTHER PEACEFUL AND NICE", "SPRING DAY...", "",
                "FLOWERS ARE EVERYWHERE TO BE SEEN AND BIRDS",
                "ARE SINGING THEIR MOST CHEERFUL MELODIES.", "",
                "THOSE WITH ALLERGIES SHOULD BE CAREFUL."
            ]
    elif 5 < int(time.strftime("%m")) < 9:
        if int(time.strftime("%m")) == 7 and int(time.strftime("%d")) < 11:
            newstx[4] = [
                "THE SUN SHINES BRIGHT ON TAMAGOTCHI  TOWN.",
                "THIS SEASON WILL BRING US SEVERAL CLEAR,",
                "STAR FILLED NIGHTS!",
                "THE PERFECT WEATHER FOR THE STAR  FESTIVAL.", "",
                "MAKE SURE TO MAKE A WISH UPON A STAR",
                "TONIGHT, FOR THEY MAY GRANT IT TO YOU!"
            ]
            newstx.append([
                "WE HOPE YOU ARE ENJOYING SUMMER, IN SPITE  OF", "THE  HEAT!",
                "", "BE SURE TO MAKE YOUR WISH, SO IT CAN BE",
                "GRANTED TO YOU!", "", "WE HOPE YOU LIKE  THIS  GIFT!"
            ])
        elif int(time.strftime("%m")) == 8 and 10 < int(
                time.strftime("%d")) < 21:
            newstx[4] = [
                "THIS SUMMER IS BRINGING US MANY CLEAR  DAYS,",
                "A PERFECT WEATHER FOR FIREWORKS!", "",
                "BE PREPARED TO SEE THE NIGHT SKY FILLED WITH",
                "COLOURFUL BLASTS!", "", "HAVE A NICE SUMMER BREAK!"
            ]
        else:
            newstx[4] = [
                "THE  SUMMER HEAT IS EVAPORATING ALL OUR",
                "WORRIES AND THE  WIND IS BLOWING ALL OUR", "TROUBLES AWAY.",
                "", "THIS IS THE IDEAL SEASON FOR RELAXING.", "",
                "TRY NOT TO GET SUN BURNED!"
            ]
    elif 8 < int(time.strftime("%m")) < 12:
        if (int(time.strftime("%m")) == 10 and int(time.strftime("%d")) > 25
            ) or (int(time.strftime("%m")) == 11
                  and int(time.strftime("%d")) < 5):
            newstx[4] = [
                "RAIN FALLS ON THE  GRAVEYARD TO REMIND US OF",
                "THE INEXORABLE  PASSAGE OF TIME  AND OF ALL",
                "OUR LOVED ONES WHO HAVE LEFT US.", "",
                "LET US CELEBRTE THIS HOLIDAY IN THEIR HONOUR",
                "AND REPLACE THE GRIEF WITH JOY!",
                "OR JUST EAT CANDY IF YOU WANT."
            ]
            newstx.append([
                "WE  HOPE YOU ARE  ENJOYING THIS FRIGHTENING",
                "YET DELICIOUS  HOLIDAY!", "",
                "WE PREPARED A SPOOKY SWEET TREAT JUST", "FOR YOU!", "",
                "WE HOPE YOU ENJOY IT!"
            ])
        else:
            newstx[4] = [
                "THE RAIN IS FALLING.",
                "THE  TREES ARE  COLOURED  BRIGHT RED.", "HOW ENSORCELLING.",
                "", "WE  HOPE YOU ALL ENJOY THIS BEAUTIFUL SEASON",
                "AS MUCH AS WE DO!", "TRY NOT TO CATCH A COLD, THOUGH."
            ]
    else:
        if int(time.strftime("%m")) == 12 and int(time.strftime("%d")) > 19:
            newstx[4] = [
                "WHAT ARE THOSE BELLS JINGLING?",
                "IT SEEMS LIKE  THE  HOLIDAYS  ARE  FINALLY HERE!", "",
                "IT IS TIME TO SET ALL THE  DECORATIONS  UP AND",
                "WAIT FOR THE  ARRIVAL OF  SANTACLAUTCHI!", "",
                "MERRY CHRISTMAS, TAMAGOTCHI TOWN!"
            ]
            nwsprn[4] = 3
            newstx.append([
                "WE HOPE YOU ARE ENJOYING YOUR HOLIDAYS!", "",
                "PLEASE  ACCEPT THESE  PRESENT!",
                "IT WILL HELP YOU MAKE THE MOST OUT OF YOUR",
                "WINTER HOLIDAYS!", "", "MERRY CHRISTMAS!"
            ])
        elif int(time.strftime("%m")) == 1 and int(time.strftime("%d")) < 11:
            newstx[4] = [
                "HAPPY NEW YEAR  " + time.strftime("%Y") + "!", "",
                "IT IS FINALLY THE DAWN OF A NEW YEAR.", "",
                "WE HOPE ALL YOUR RESOLUTIONS  HAVE  BECOME  A",
                "REALITY BY THE TIME THIS YEAR ENDS!",
                "TRY TO MAKE THE BEST OUT OF THIS NEW YEAR!"
            ]
            newstx.append([
                "GREETINGS!", "WE HOPE  " + time.strftime("%Y") +
                " HAD A GREAT START FOR YOU!", "",
                "WE WOULD LIKE TO GIVE  YOU THIS  PRESENT AND",
                "WISH YOU AN EVENTFUL YEAR.", "", "HAPPY NEW YEAR!"
            ])
        else:
            newstx[4] = [
                "OUR TOWN IS COVERED WITH PURE  WHITE SNOW.",
                "WE  WANT TO GO OUTSIDE TO SEE  IT, BUT THE",
                "WARMTH OF OUR HOMES  SEEMS  TO BE  MORE",
                "INVITING THAN IT EVER WAS...", "",
                "WE HOPE  YOU ALL ENJOY YOURSELVES DURING",
                "THIS FREEZING SEASON!"
            ]

    if avars[avars[3][5]][31] == 0:
        newstx.append([
            "GOOD EVENING!", "WE ARE CONTACTING YOU TO REMIND YOU THAT",
            avars[avars[3][5]][22] + " IS STILL UNEMPLOYED.", "",
            "WE HOPE YOU CAN FIND A JOB SOON!", "", "BYE!"
        ])
    elif avars[avars[3][5]][31] == 1:
        newstx.append([
            "LETTER FROM TAMAGOTCHI  PRESCHOOL!", "",
            avars[avars[3][5]][22] + "'S CLASS WON A COMPETITION!", "",
            "THEY ALL GOT A PRIZE!", "", "WELL DONE!"
        ])
        newstx.append([
            "LETTER FROM TAMAGOTCHI  PRESCHOOL...", "",
            avars[avars[3][5]][22] + "'S CLASS WAS CHOSEN TO PAY FOR THE",
            "NEW TOYS FOR OUR STUDENTS.", "EACH ONE HAS TO PAY 200G.", "",
            "SORRY FOR THE  INCONVENIENCE..."
        ])
    elif avars[avars[3][5]][31] == 2:
        newstx.append([
            "LETTER FROM TAMAGOTCHI  SCHOOL!", "",
            avars[avars[3][5]][22] + "'S CLASS WON A COMPETITION!", "",
            "THEY ALL GOT A PRIZE!", "", "WELL DONE!"
        ])
        newstx.append([
            "LETTER FROM TAMAGOTCHI  SCHOOL...", "",
            avars[avars[3][5]][22] + "'S CLASS WAS CHOSEN TO PAY FOR THE",
            "NEW SCHOOL MATERIAL FOR OUR STUDENTS.",
            "EACH ONE HAS TO PAY 300G.", "", "SORRY FOR THE  INCONVENIENCE..."
        ])
    else:
        newstx.append([
            "LETTER FROM GOTCHI CASTLE!", "",
            avars[avars[3][5]][22] + " HAS BEEN WORKING HARD!", "",
            "YOU DESERVE A BONUS!", "", "WELL DONE!"
        ])
        newstx.append([
            "LETTER FROM GOTCHI CASTLE...", "",
            avars[avars[3][5]][22] + "'S WORKPLACE  NEEDS  FUNDING IN",
            "ORDER TO IMPROVE THE FACILITIES.", "EACH ONE HAS TO PAY 500G.",
            "", "SORRY FOR THE  INCONVENIENCE..."
        ])

    if avars[3][11] == 0 or avars[3][11] == 1:
        newstx.append([
            "LETTER FROM GOTCHI BANK...", "", "YOU HAVE  BEEN ROBBED.",
            "THE BURGLAR PRESUMED TO BE  THE  CULPRIT IS",
            "KNOWN TO STEAL QUANTITIES UP TO 500G.", "", "WE ARE VERY SORRY..."
        ])
    elif avars[3][11] == 2:
        newstx.append([
            "LETTER FROM GOTCHI BANK!", "",
            "THE GOTCHI KING HAS COME HERE AND GAVE AWAY",
            "MONEY TO SEVERAL CITIZENS!", "YOU RECEIVED 1000G!", "",
            "YOU ARE SO LUCKY!"
        ])

    mailsp = pygame.image.load("Sprites/Misc/obj/letter.png").convert()

    if md == 0 and ((int(avars[3][6][:2]) < 16 and avars[3][11] < 0) or
                    (int(avars[3][6][:2]) > 15
                     and avars[3][11] < 5)) and avars[avars[3][5]][1] > 1:
        tyod = 0
        if int(avars[3][6][:2]) < 16:
            avars[3][11] = randint(0, 4)
        else:
            if (time.strftime("%m") + time.strftime("%d")) == avars[3][1]:
                avars[3][11] = 5
            else:
                avars[3][11] = randint(5, (len(newstx) - 1))
            if newstx[avars[3][11]][0] == "IT SEEMS LIKE SOMEONE IS HAVING A":
                h = False
                a = 0
                for f in avars[3][4]:
                    if f[0] == 'BDCake':
                        h = True
                        break
                    a += 1
                if h:
                    avars[3][4][a][4] += 1
                else:
                    a = avars[3][4]
                    a.append(['BDCake', 4, 4, 4, 1, 2, 2, 2, 2, 2, 2])
                    avars[3][4] = a
                s = pygame.image.load("Sprites/Food/BDCake.png").convert()
                mailsp = pygame.Surface([24, 24]).convert()
                mailsp.fill((0, 255, 255))
                mailsp.blit(s, [0, 0])
                mailsp.set_colorkey((0, 255, 255))
                avars[avars[3][5]][17] = 6
            elif newstx[avars[3][11]][0] in [
                    "WE HOPE YOU ARE ENJOYING THIS BEAUTIFUL",
                    "WE HOPE YOU ARE ENJOYING SUMMER, IN SPITE  OF",
                    "WE  HOPE YOU ARE  ENJOYING THIS FRIGHTENING",
                    "WE HOPE YOU ARE ENJOYING YOUR HOLIDAYS!", "GREETINGS!"
            ]:
                if newstx[avars[3][11]][
                        0] == "WE HOPE YOU ARE ENJOYING THIS BEAUTIFUL":
                    h = False
                    a = 0
                    for f in avars[3][4]:
                        if f[0] == 'Sakuramochi':
                            h = True
                            break
                        a += 1
                    if h:
                        avars[3][4][a][4] += 3
                    else:
                        a = avars[3][4]
                        a.append(['Sakuramochi', 3, 3, 2, 3, 0, 6, 0, 0, 6, 0])
                        avars[3][4] = a
                elif newstx[avars[3][11]][
                        0] == "WE HOPE YOU ARE ENJOYING SUMMER, IN SPITE  OF":
                    h = False
                    a = 0
                    for f in avars[3][4]:
                        if f[0] == 'Beans':
                            h = True
                            break
                        a += 1
                    if h:
                        avars[3][4][a][4] += 3
                    else:
                        a = avars[3][4]
                        a.append(['Beans', 3, 3, 1, 3, 0, 0, 6, 0, 0, 6])
                        avars[3][4] = a
                elif newstx[avars[3][11]][
                        0] == "WE  HOPE YOU ARE  ENJOYING THIS FRIGHTENING":
                    h = False
                    a = 0
                    for f in avars[3][4]:
                        if f[0] == 'PumPie':
                            h = True
                            break
                        a += 1
                    if h:
                        avars[3][4][a][4] += 3
                    else:
                        a = avars[3][4]
                        a.append(['PumPie', 3, 3, 3, 3, 6, 0, 0, 6, 0, 0])
                        avars[3][4] = a
                elif newstx[avars[3][11]][
                        0] == "WE HOPE YOU ARE ENJOYING YOUR HOLIDAYS!":
                    h = False
                    a = 0
                    for f in avars[3][4]:
                        if f[0] == 'XMasCake':
                            h = True
                            break
                        a += 1
                    if h:
                        avars[3][4][a][4] += 3
                    else:
                        a = avars[3][4]
                        a.append(['XMasCake', 4, 4, 3, 3, 2, 2, 2, 2, 2, 2])
                        avars[3][4] = a
                elif newstx[avars[3][11]][0] == "GREETINGS!":
                    h = False
                    a = 0
                    for f in avars[3][4]:
                        if f[0] == 'Zouni':
                            h = True
                            break
                        a += 1
                    if h:
                        avars[3][4][a][4] += 3
                    else:
                        a = avars[3][4]
                        a.append(['Zouni', 2, 2, 2, 3, 1, 1, 1, 1, 1, 1])
                        avars[3][4] = a
                mailsp = pygame.image.load(
                    "Sprites/Misc/obj/present.png").convert()
                if avars[avars[3][5]][17] < 6:
                    avars[avars[3][5]][17] += 1
            elif newstx[avars[3][11]][0] == "GOOD EVENING!":
                if avars[avars[3][5]][17] > 0:
                    avars[avars[3][5]][17] -= 1
            elif newstx[avars[3][11]][0] in [
                    "LETTER FROM TAMAGOTCHI  PRESCHOOL!",
                    "LETTER FROM TAMAGOTCHI  SCHOOL!",
                    "LETTER FROM GOTCHI CASTLE!"
            ]:
                if avars[3][2] < 99499:
                    avars[3][2] += 500
                else:
                    avars[3][2] = 99999
                if avars[avars[3][5]][17] < 5:
                    avars[avars[3][5]][17] += 2
                else:
                    avars[avars[3][5]][17] = 6
            elif newstx[avars[3][11]][0] in [
                    "LETTER FROM TAMAGOTCHI  PRESCHOOL...",
                    "LETTER FROM TAMAGOTCHI  SCHOOL...",
                    "LETTER FROM GOTCHI CASTLE..."
            ]:
                if avars[avars[3][5]][31] == 2:
                    a = 200
                elif avars[avars[3][5]][31] == 3:
                    a = 300
                else:
                    a = 500
                if avars[3][2] > a:
                    avars[3][2] -= a
                else:
                    avars[3][2] = 0
                if avars[avars[3][5]][17] > 2:
                    avars[avars[3][5]][17] -= 2
                else:
                    avars[avars[3][5]][17] = 0
            elif newstx[avars[3][11]][0] == "LETTER FROM GOTCHI BANK...":
                mailsp = pygame.image.load(
                    "Sprites/Misc/obj/money.png").convert()
                if avars[3][2] > 500:
                    avars[3][2] -= 500
                else:
                    avars[3][2] = 0
                if avars[avars[3][5]][17] > 2:
                    avars[avars[3][5]][17] -= 2
                else:
                    avars[avars[3][5]][17] = 0
            elif newstx[avars[3][11]][0] == "LETTER FROM GOTCHI BANK!":
                mailsp = pygame.image.load(
                    "Sprites/Misc/obj/money.png").convert()
                if avars[3][2] < 98999:
                    avars[3][2] += 1000
                else:
                    avars[3][2] = 99999
                if avars[avars[3][5]][17] < 3:
                    avars[avars[3][5]][17] += 3
                else:
                    avars[avars[3][5]][17] = 6
        n = pygame.Surface([240, 160]).convert()
        n.fill((0, 255, 255))
        if avars[3][11] < 5:
            n.blit(gtnw, [40, 32])
            n.blit(nwsprs[nwsprn[avars[3][11]]], [8, 32])
        else:
            n.blit(tmlt, [8, 32])
            n.blit(lfnt.render(avars[3][0], 1, (0, 0, 100)), [68, 53])
            n.blit(mailsp, [196, 36])
        n.blit(lfnt.render(newstx[avars[3][11]][0], 1, (0, 0, 100)), [8, 71])
        n.blit(lfnt.render(newstx[avars[3][11]][1], 1, (0, 0, 100)), [8, 79])
        n.blit(lfnt.render(newstx[avars[3][11]][2], 1, (0, 0, 100)), [8, 87])
        n.blit(lfnt.render(newstx[avars[3][11]][3], 1, (0, 0, 100)), [8, 95])
        n.blit(lfnt.render(newstx[avars[3][11]][4], 1, (0, 0, 100)), [8, 103])
        n.blit(lfnt.render(newstx[avars[3][11]][5], 1, (0, 0, 100)), [8, 111])
        n.blit(lfnt.render(newstx[avars[3][11]][6], 1, (0, 0, 100)), [8, 119])
        pygame.image.save(n, "Sprites/Misc/mail/news.png")

    if avars[3][11] > -1:
        nwsimg = pygame.image.load("Sprites/Misc/mail/news.png").convert()
        nwsimg.set_colorkey((0, 255, 255))

    sound = sounds.imprtsnd(avars)

    clock = pygame.time.Clock()

    anifr = 0

    pygame.time.set_timer(USEREVENT + 1, int(1000 / ((5 * avars[3][3]) + 1)))

    if avars[3][3] == 0:
        avars[3][6] = time.strftime("%H:%M")

    while kr:
        if md == 0:
            screen.blit(obgi, [0, 0])
            if w == 2:
                if ((anifr / 12) - (anifr // 12)) < 0.5:
                    y = 0
                else:
                    if s < 3:
                        y = 16
                    else:
                        y = 8
                if s < 3:
                    screen.blit(rain, [0, y])
                else:
                    screen.blit(snow, [0, y])
            screen.blit(mailbx, [106, 94])
            nzs, nzx, nflip = mailani()
            screen.blit(pygame.transform.flip(nsprs[nzs], nflip, 0), [nzx, 98])
            if 89 < anifr < 102:
                screen.blit(letter, [82, 100])
            if anifr == 0 or anifr == 12 or anifr == 90 or anifr == 120 or anifr == 132:
                sound[6].play()
            elif anifr == 24 or anifr == 108:
                sound[9].play()
        elif md == 1:
            if scr < 2:
                screen.blit(textbox, [0, 24])
            if scr == 0:
                screen.blit(newtx, [8, 34])
                screen.blit(pertx, [8, 50])
            elif scr == 1:
                screen.blit(wrktx, [8, 34])
                screen.blit(frntx, [8, 50])
            elif scr == 2:
                screen.blit(ltrbox, [0, 0])
                screen.blit(nwsimg, [0, 0])
            elif scr == 3:
                screen.blit(worki, [0, 0])
            elif scr == 4:
                screen.blit(inbox[msel], [0, 0])
                screen.blit(scrli, [232, 128])
            elif scr == 5:
                screen.blit(outbox[msel], [0, 0])
                screen.blit(scrli, [232, 128])
        screen = borders.drawborders(screen, avars, asprs, tpborder, btborder,
                                     borderico, fnt, 0, anifr, hn, hp, sk, sl)
        for event in pygame.event.get():
            if event.type == QUIT:
                varsup.updtvrs(avars)
                kr = False
                pygame.quit()
                sys.exit()
            if event.type == MOUSEBUTTONDOWN:
                mp = event.pos
                d = (screen.get_size()[0] // 240)
                mp = ((mp[0] // d), (mp[1] // d))
                pb = event.button
                if (pb in [2, 4]) and scr > 3:
                    if 24 < mp[1] < 136:
                        sound[2].play()
                        if msel != msmax:
                            msel += 1
                        else:
                            msel = 0
                        clt = 0
                elif pb == 5 and scr > 3:
                    if 24 < mp[1] < 136:
                        sound[2].play()
                        if msel != 0:
                            msel -= 1
                        else:
                            msel = msmax
                        clt = 0
                elif pb == 1:
                    clt = 0
                    if 138 < mp[1] < 158:
                        if 228 < mp[0] < 240:
                            sound[4].play()
                            return (avars)
                    if md == 1:
                        if 32 < mp[1] < 48 and 8 < mp[0] < 110:
                            if scr == 0 and avars[3][11] > -1:
                                pygame.mixer.stop()
                                sound[3].play()
                                scr = 2
                            elif scr == 1 and avars[avars[3][5]][31] > 0:
                                pygame.mixer.stop()
                                sound[3].play()
                                scr = 3
                        elif 48 < mp[1] < 64 and 8 < mp[0] < 110:
                            if scr == 0:
                                pygame.mixer.stop()
                                sound[3].play()
                                scr = 1
                            elif scr == 1 and len(inbox) > 0:
                                pygame.mixer.stop()
                                sound[3].play()
                                scr = 4
                                msel = 0
                                msmax = len(inbox) - 1
            if event.type == USEREVENT + 1:
                if avars[3][3] == 0:
                    avars[3][6] = time.strftime("%H:%M")
                else:
                    avars[3][7] += 1
                    if avars[3][7] == 60:
                        if int(avars[3][6][3:]) != 59:
                            nhour = avars[3][6][:3] + (
                                "%02d" % (int(avars[3][6][3:]) + 1))
                            avars[3][6] = nhour
                        else:
                            nhour = ("%02d" %
                                     (int(avars[3][6][:2]) + 1)) + ":00"
                            if nhour == "24:00":
                                nhour = "00:00"
                            avars[3][6] = nhour
                        avars[3][7] = 0
                if len(avars[0]) > 0:
                    avars[0][2] += 1
                if len(avars[1]) > 0:
                    avars[1][2] += 1
                if len(avars[2]) > 0:
                    avars[2][2] += 1
                chngsts = True
                clt += 1
        if chngsts:
            avars = statusup.chngsts(avars)
            if avars[avars[3][5]][20] or not avars[avars[3][5]][21]:
                return (avars)
            chngsts = False
        if anifr < 143:
            anifr += 1
        else:
            anifr = 0
            if md == 0:
                if tyod == 0:
                    md = 1
                    scr = 2
                elif len(inbox) > 0:
                    md = 1
                    scr = 4
                else:
                    return (avars)
        if clt > 29 and md == 1 and scr < 2:
            return (avars)
        r = pygame.Surface([240, 160]).convert()
        r.blit(screen, [0, 0])
        r = pygame.transform.scale(
            r, (screen.get_size()[0], screen.get_size()[1]))
        screen.blit(r, [0, 0])
        clock.tick(16)
        pygame.display.update()