当前位置:   article > 正文

Python实现植物大战僵尸_做基于python植物大战僵尸思路

做基于python植物大战僵尸思路

Python实现植物大战僵尸

一、概述

大二暑期python项目,使用pygame编写,仅实现了冒险模式一关及我是僵尸,均使用原版贴图和音效,并尽量完整复刻了动画效果
资源链接:https://download.csdn.net/download/qq_39033469/87373063

二、整体展示

整体展示
冒险模式:
经典关卡,合理运用阳光种植植物抵挡僵尸,消灭所有僵尸后获胜
目前共有7种植物,3种僵尸

迷你游戏 我是僵尸(僵尸公敌):
角色互换,合理运用阳光放置僵尸,以消灭确定阵型的植物,僵尸吃掉所有植物后面的脑子后获胜
除樱桃炸弹外的6种植物和3种僵尸都有涉及

三、细节展示

暂停界面
所有界面均可点击菜单键暂停,并可调整音乐和音效音量
按钮效果
大部分按钮均有鼠标高亮显示和点击时下降效果凸显立体感

资源缺失
进入游戏前会检测文件完整性,文件缺失会有提示界面
悬浮效果
放置植物或僵尸时会有跟随鼠标的植物或僵尸在草地上会显示预览位置

四、基本思路

将完整界面分为各个部分,植物、僵尸、界面元素等。几乎每个部分都有相应的类对应。
游戏时每个部分首先绘制当前帧,并自行计算下一帧,不同位置的鼠标操作会影响下一帧。只有可能有多帧动画的部分使用了类,其他动画很少或者静态图片都用不同状态的图片显示
由于游戏全程每秒60帧,每次循环绘制的帧都会持续1/60秒,从而也是一种计时器,游戏中与时间相关的数据,如冷却时间,动画效果,移动速度等都以帧来计算。不同的对象有互相独立的帧动画,帧与帧之间的时间间隔也不同,因此在每个有帧动画的类中内置了帧率参数cur,FPSVar和FPSDiv
cur代表该对象需要绘制的帧,每次加一代表下一张需要绘制的帧
FPSVar代表外部帧数,初始化之后与整体循环帧率同步
FPSDiv代表该对象帧率与游戏帧率的比例,如果值为6,则该对象每6帧绘制下一帧
这样就能使每个对象都独立流畅地绘制动画

五、全部代码

因个人编码能力及经验限制,代码风格极其简陋,仅供学习。
贴图、音效等资源见https://download.csdn.net/download/qq_39033469/87373063
目前未发现较大bug

import pygame
import random


WINDOW_WIDTH = 800
WINDOW_HEIGHT = 600
WINDOW_SIZE = (WINDOW_WIDTH, WINDOW_HEIGHT)


FONT = 'gbk.ttf'
FONT_COLOR = ((18, 179, 24), (16, 217, 14), (226, 188, 107),
              (111, 111, 135), (59, 39, 15), (213, 160, 36),
              (220, 220, 220), (46, 46, 93))


# 显示位置
POS_X = 0
POS_Y = 0
POS = (POS_X, POS_Y)


SUN_POS = (10, 0)
CARD_POS = (90, 8)


CARD_SIZE = (51, 70)


GRASS_POS = (36, 78)
GRASS_SIZE = (80, 100)
GRASS_NUM = (9, 5)

# 位移误差
GROW_PLUSX = (5, 5, -15, 0, 0, 5, -10)
GROW_PLUSY = (10, 5, 8, 0, 40, 10, -30)


MINIGAMES_ZOMBIE_PLUSX = -75
MINIGAMES_ZOMBIE_PLUSY = -70
ZOMBIE_PLUSY = 30


FPS = 60

# 草地是否被占用
GRASS = []

"""
Code
0 Peashooter
1 Sunflower
2 Cherrybomb
3 Wallnut
4 Potatomine
5 Doublepeashooter
6 Chomper


0 NormalZombie
1 ConeheadZombie
2 BucketheadZombie
"""
ZOMBIE_SUN_COST = (50, 75, 125)
SUN_COST = (100, 50, 150, 50, 25, 200, 150)

FROZEN_TIME = (7.5, 7.5, 3.5, 30, 30, 7.5, 7.5)

PLANT_SIZE = ((71, 71), (73, 74), (112, 81), (100, 100), (75, 55), (73, 71), (130, 114))
ZOMBIE_SIZE = ((166, 144), (166, 144), (166, 144))

INDEX_Zombie = [22, 11, 20]

ZOMBIE_SPEED = 122.24 / FPS

BULLET_START_POS = (53, 11)
BULLET_SIZE = (28, 28)

# 按钮位置
ADVENTURE_BUTTON = (384, 72)
MINIGAMES_BUTTON = (385, 203)

ADVENTURE_TEXT = ((552, 90), (575, 92))
HELP_BUTTON = (650, 530)
QUIT_BUTTON = (731, 510)
OPTIONS_BUTTON = (561, 486)

PAUSE_BUTTON = ((680, -10), (716, -10), (762, -10))
PAUSE_BUTTON_ALPHA = (683, -9)

BACK_TO_GAME = (224, 438)
BACK_TO_GAME_ALPHA = (224, 440)

PAUSE_OPTION_DOWN = ((298, 350), (334, 350), (380, 350), (426, 350), (472, 350))
PAUSE_OPTION_DOWN_ALPHA = (298, 354)

PAUSE_OPTION_UP = ((298, 280), (334, 280), (380, 280), (426, 280), (472, 280))
PAUSE_OPTION_UP_ALPHA = (298, 284)

LOST_RESTART = ((295, 347), (331, 347), (377, 347), (423, 347), (469, 347))
LOST_RESTART_ALPHA = (295, 351)


# 音乐播放位置
MUSIC_POS = 0.0

MUSIC_VOLUME = 0.5
SOUND_VOLUME = 0.15

USEREVENT_COUNT = 0

LEVEL = 1
TOTAL_ZOMBIE = 37

INIT_SUN = 1500


class Button(object):
    def __init__(self, position, file, alpha=None):
        self.image = file
        self.image_alpha = alpha
        self.pos = position

    def draw(self):
        window.blit(self.image, self.pos)

    # 高亮显示
    def draw_alpha(self):
        window.blit(self.image_alpha, self.pos)


class Trophy(object):
    size = (166, 136)

    def __init__(self, posx, posy):
        self.posx = posx
        self.posy = posy
        self.endx = posx - 80
        self.endy = posy - 80
        falling_time = FPS * 2
        self.speed_x = (self.endx - posx) / falling_time
        self.speed_y = 0
        self.images = IMAGE_Trophy
        self.cur = 0
        self.FPSVar = 0
        self.index = 9

    def fall(self):
        if self.posy >= self.endy:
            return
        self.posx += self.speed_x
        self.posy += self.speed_y
        self.speed_y += 0.16

    def draw(self):
        window.blit(self.images[self.cur % self.index], (self.posx, self.posy))
        self.FPSVar = (self.FPSVar + 1) % 5
        if self.FPSVar == 0:
            self.cur += 1


class Head(object):
    def __init__(self, posx, posy):
        self.posx = random.randint(int(posx) + 20, int(posx) + 40)
        self.posy = posy - 30
        self.cur = 0
        self.FPSVar = 0
        self.images = IMAGE_Zombie_head

    def draw(self):
        window.blit(self.images[self.cur], (self.posx, self.posy))
        self.FPSVar = (self.FPSVar + 1) % 7
        if self.FPSVar == 0:
            self.cur += 1
        if self.cur == 17:
            head_list.remove(self)


class Body(object):
    def __init__(self, posx, posy, status, speed=None):
        self.posx = posx
        self.posy = posy
        self.cur = 0
        self.FPSVar = 0
        self.images = IMAGE_Zombie_body
        self.images_walking_dead = IMAGE_Zombie_body_walking
        self.images_eating_dead = IMAGE_Zombie_body_eating
        self.status = status
        self.speed = speed

    def draw(self):
        self.FPSVar = (self.FPSVar + 1) % 7
        if self.FPSVar == 0:
            self.cur += 1
        if self.status == 0:
            window.blit(self.images_walking_dead[self.cur], (self.posx, self.posy))
            self.move()
            if self.cur == 17:
                load_sound(random.randint(11, 12))
                self.cur = 0
                self.FPSVar = 0
                self.posx -= 10
                self.status = 2
        elif self.status == 1:
            window.blit(self.images_eating_dead[self.cur], (self.posx, self.posy))
            if self.cur == 10:
                load_sound(random.randint(11, 12))
                self.cur = 0
                self.FPSVar = 0
                self.posx -= 10
                self.status = 2
        if self.status == 2:
            window.blit(self.images[self.cur], (self.posx, self.posy))
            if self.cur == 16:
                body_list.remove(self)

    def move(self):
        if self.status == 0:
            self.posx -= self.speed

    def draw_walking(self):
        self.cur = 0

        self.FPSVar = (self.FPSVar + 1) % 7
        if self.FPSVar == 0:
            self.cur += 1
        if self.cur == 17:
            body_list.remove(self)

    def draw_eating(self):
        self.cur = 0
        window.blit(self.images_eating_dead[self.cur], (self.posx, self.posy))
        self.FPSVar = (self.FPSVar + 1) % 7
        if self.FPSVar == 0:
            self.cur += 1
        if self.cur == 17:
            body_list.remove(self)


class MinigamesZombie(object):
    def __init__(self, code, speed, health, images, move, initpos=None,
                 posx=None, grassy=None, cur=0, FPSVar=0, eating_flag=False):
        self.code = code
        self.index = INDEX_Zombie
        self.cur = cur
        self.FPSVar = FPSVar
        self.move = move
        self.images_normal = images[0]
        self.images_eating = images[1]
        self.images_boom = images[2]
        self.eating_flag = eating_flag
        self.alpha_image = self.images_normal[0].copy()
        self.alpha_image.set_alpha(100)
        self.speed = speed
        self.health = health

        if move:
            grass_x = (initpos[0] - GRASS_POS[0]) // GRASS_SIZE[0]
            grass_y = (initpos[1] - GRASS_POS[1]) // GRASS_SIZE[1] + 1
            self.posx = GRASS_POS[0] + grass_x * GRASS_SIZE[0] + MINIGAMES_ZOMBIE_PLUSX
            self.grassy = grass_y
            self.posy = self.grassy * GRASS_SIZE[1] + MINIGAMES_ZOMBIE_PLUSY

        if posx is not None:
            self.grassy = grassy
            self.posx = posx
            self.posy = self.grassy * GRASS_SIZE[1] + ZOMBIE_PLUSY

    def draw(self, pos):
        window.blit(self.images_normal[0], pos)

    def draw_on_grass(self):
        eat_flag = check_eat(self.posx, self.posy)

        if eat_flag is None:
            if self.eating_flag:
                self.cur = 0
                self.eating_flag = False
            pos = (self.posx, self.posy)
            window.blit(self.images_normal[self.cur % self.index[0]], pos)

            self.FPSVar = (self.FPSVar + 1) % 8
            if self.FPSVar == 0:
                self.cur += 1
                self.move_on_grass()
        else:
            if not self.eating_flag:
                self.cur = 0
                self.eating_flag = True
            pos = (self.posx, self.posy)
            window.blit(self.images_eating[self.cur % self.index[1]], pos)

            self.FPSVar = (self.FPSVar + 1) % 8
            if self.FPSVar == 0:
                self.cur += 1
                if self.cur % self.index[1] == 5:
                    eat_flag.hurt(70)
                    load_sound(random.randint(0, 1) * 2 + 1)

                elif self.cur % self.index[1] == 10:
                    eat_flag.hurt(70)
                    load_sound(2)

    def draw_alpha(self, pos):
        x = (pos[0] - GRASS_POS[0]) // GRASS_SIZE[0]
        y = (pos[1] - GRASS_POS[1]) // GRASS_SIZE[1]
        grow_pos = (GRASS_POS[0] + x * GRASS_SIZE[0] + MINIGAMES_ZOMBIE_PLUSX,
                    GRASS_POS[1] + y * GRASS_SIZE[1] + MINIGAMES_ZOMBIE_PLUSY + 20)
        window.blit(self.alpha_image, grow_pos)

    def move_on_grass(self):
        self.posx -= self.speed
        if self.posx < -150:
            zombie_list.remove(self)

    def hurt(self, num, status=None):
        self.health -= num
        if self.health <= 0:

            if status == 'mine':
                zombie_list.remove(self)
            else:
                self.die()

    def die(self):
        load_sound(10)
        head_list.append(Head(self.posx, self.posy))
        if self.eating_flag:
            body_list.append(Body(self.posx, self.posy, 1))
        else:
            body_list.append(Body(self.posx, self.posy, 0, self.speed / 8))
        zombie_list.remove(self)


class MinigamesNormalZombie(MinigamesZombie):
    def __init__(self, move, initpos=None, posx=None, grassy=None, cur=0, FPSVar=0, eating_flag=False):
        MinigamesZombie.__init__(self, 0, ZOMBIE_SPEED, 300, IMAGE_Normal_zombie, move, initpos,
                                 posx, grassy, cur, FPSVar, eating_flag)


class MinigamesConeZombie(MinigamesZombie):
    def __init__(self, move, initpos=None, posx=None, grassy=None):
        MinigamesZombie.__init__(self, 1, ZOMBIE_SPEED, 370, IMAGE_Conehead_zombie, move, initpos, posx=posx, grassy=grassy)

    def hurt(self, num, status=None):
        self.health -= num

        if self.health <= 0:

            if status == 'mine':
                zombie_list.remove(self)
            else:
                zombie_list.remove(self)
                zombie_list.append(MinigamesNormalZombie(True, posx=self.posx + 10, grassy=self.grassy, cur=self.cur,
                                                         FPSVar=self.FPSVar, eating_flag=self.eating_flag))


class MinigamesBucketZombie(MinigamesZombie):
    def __init__(self, move, initpos=None, posx=None, grassy=None):
        MinigamesZombie.__init__(self, 2, ZOMBIE_SPEED, 1100, IMAGE_Buckethead_zombie, move, initpos, posx=posx, grassy=grassy)

    def hurt(self, num, status=None):
        self.health -= num

        if self.health <= 0:

            if status == 'mine':
                zombie_list.remove(self)
            else:
                zombie_list.remove(self)
                zombie_list.append(MinigamesNormalZombie(True, posx=self.posx + 10, grassy=self.grassy, cur=self.cur,
                                                         FPSVar=self.FPSVar, eating_flag=self.eating_flag))


class MinigamesPlant(object):
    def __init__(self, code, index, FPSDiv, images, grassx, grassy):
        self.code = code
        self.index = index
        self.cur = 0
        self.FPSVar = 0
        self.FPSDiv = FPSDiv
        self.images = images
        self.health = 300
        self.grassx = grassx
        self.grassy = grassy

    def draw_on_grass(self):
        grow_pos = (GRASS_POS[0] + self.grassx * GRASS_SIZE[0] + GROW_PLUSX[self.code],
                    GRASS_POS[1] + self.grassy * GRASS_SIZE[1] + GROW_PLUSY[self.code])
        window.blit(self.images[self.cur % self.index], grow_pos)
        self.FPSVar = (self.FPSVar + 1) % self.FPSDiv
        if self.FPSVar == 0:
            self.cur += 1

    def hurt(self, num):
        self.health -= num
        if self.health <= 0:
            self.die()

    def die(self):
        load_sound(30)
        plant_list.remove(self)


class MinigamesSunflower(MinigamesPlant):
    def __init__(self, grassx, grassy):
        MinigamesPlant.__init__(self, 1, 18, 5, IMAGE_Sunflower, grassx, grassy)

    def produce(self):
        sun_falling.append(Sun(self.grassx, self.grassy))

    def draw_on_grass(self):
        grow_pos = (GRASS_POS[0] + self.grassx * GRASS_SIZE[0] + GROW_PLUSX[self.code],
                    GRASS_POS[1] + self.grassy * GRASS_SIZE[1] + GROW_PLUSY[self.code])
        window.blit(self.images[self.cur % self.index], grow_pos)
        self.FPSVar = (self.FPSVar + 1) % self.FPSDiv
        if self.FPSVar == 0:
            self.cur += 1

    def hurt(self, num):
        self.health -= num
        sun_falling.append(Sun(self.grassx, self.grassy))
        if self.health <= 0:
            self.die()


class MinigamesPeashooter(MinigamesPlant):
    def __init__(self, grassx, grassy):
        MinigamesPlant.__init__(self, 0, 13, 6, IMAGE_Peashooter, grassx, grassy)

    def draw_on_grass(self):
        grow_pos = (GRASS_POS[0] + self.grassx * GRASS_SIZE[0] + GROW_PLUSX[self.code],
                    GRASS_POS[1] + self.grassy * GRASS_SIZE[1] + GROW_PLUSY[self.code])
        window.blit(self.images[self.cur % self.index], grow_pos)
        return self.next()

    def next(self):
        self.FPSVar = (self.FPSVar + 1) % self.FPSDiv
        if self.FPSVar == 0:
            self.cur += 1
        if self.cur % self.index == 2 and self.FPSVar == 0:
            if minigames_discover_zombie(self.grassx, self.grassy):
                return MinigamesBullet(self.grassx, self.grassy)
        return None


class MinigamesWallNut(MinigamesPlant):
    def __init__(self, grassx, grassy):
        MinigamesPlant.__init__(self, 3, 3, 6, IMAGE_Wallnut, grassx, grassy)
        self.health = 4000

    def draw_on_grass(self):
        grow_pos = (GRASS_POS[0] + self.grassx * GRASS_SIZE[0] + GROW_PLUSX[self.code],
                    GRASS_POS[1] + self.grassy * GRASS_SIZE[1] + GROW_PLUSY[self.code])
        if self.health >= 8000 / 3:
            window.blit(self.images[0], grow_pos)
        elif self.health >= 4000 / 3:
            window.blit(self.images[1], grow_pos)
        else:
            window.blit(self.images[2], grow_pos)


class MinigamesPotatoMine(MinigamesPlant):
    def __init__(self, grassx, grassy):
        MinigamesPlant.__init__(self, 4, 8, 10, IMAGE_Potatomine, grassx, grassy)
        self.initimage = IMAGE_Potatomine_init
        self.blowimage = IMAGE_Potatomine_blow
        self.ready = True
        self.blowing = False

    def draw_on_grass(self):
        grow_pos = (GRASS_POS[0] + self.grassx * GRASS_SIZE[0] + GROW_PLUSX[self.code],
                    GRASS_POS[1] + self.grassy * GRASS_SIZE[1] + GROW_PLUSY[self.code])
        if self.ready:
            zombie_to_blow = self.check_collision()
            if zombie_to_blow is not None:
                grow_pos_v = (grow_pos[0] - 30, grow_pos[1] - 25)
                window.blit(self.blowimage, grow_pos_v)
                self.ready = False
                self.blowing = True
                load_sound(23)
                zombie_to_blow.hurt(1800, 'mine')
                self.cur = 0
            else:
                window.blit(self.images[self.cur % self.index], grow_pos)
        else:
            if self.blowing:
                grow_pos_v = (grow_pos[0] - 40, grow_pos[1] - 60)
                window.blit(self.blowimage, grow_pos_v)
                if self.cur == 8:
                    plant_list.remove(self)
            else:
                grow_pos_v = (grow_pos[0] + 20, grow_pos[1] + 10)
                window.blit(self.initimage, grow_pos_v)
        self.FPSVar = (self.FPSVar + 1) % self.FPSDiv
        if self.FPSVar == 0:
            self.cur += 1
            if not self.blowing and not self.ready and self.cur == 15 * FPS / self.FPSDiv:
                self.ready = True

    def check_collision(self):
        for each in zombie_list:
            temp_posx = GRASS_POS[0] + self.grassx * GRASS_SIZE[0] + GROW_PLUSX[self.code]
            if -90 <= each.posx - temp_posx <= -10 and each.grassy == self.grassy + 1:
                return each
        return None


class MinigamesDoublePea(MinigamesPeashooter):
    def __init__(self, grassx, grassy):
        MinigamesPeashooter.__init__(self, grassx, grassy)
        self.code = 5
        self.index = 15
        self.images = IMAGE_Doublepea


    def next(self):
        self.FPSVar = (self.FPSVar + 1) % self.FPSDiv
        if self.FPSVar == 0:
            self.cur += 1
        if (self.cur % self.index == 2 or self.cur % self.index == 8) and self.FPSVar == 0:
            if minigames_discover_zombie(self.grassx, self.grassy):
                return MinigamesBullet(self.grassx, self.grassy)
        return None


class MinigamesChomper(MinigamesPlant):
    def __init__(self, grassx, grassy):
        MinigamesPlant.__init__(self, 6, (13, 9, 6), 8, IMAGE_Chomper, grassx, grassy)
        self.attackimages = IMAGE_Chomper_attack
        self.digestimages = IMAGE_Chomper_digest
        self.chewingtime = 42 * FPS / self.FPSDiv
        self.attack = False
        self.ready = True

    def draw_on_grass(self):
        grow_pos = (GRASS_POS[0] + self.grassx * GRASS_SIZE[0] + GROW_PLUSX[self.code],
                    GRASS_POS[1] + self.grassy * GRASS_SIZE[1] + GROW_PLUSY[self.code])
        if not self.attack:
            if self.ready:
                window.blit(self.images[self.cur % self.index[0]], grow_pos)
                if self.check_collision():
                    self.attack = True
                    self.cur = 0
            else:
                window.blit(self.digestimages[self.cur % self.index[2]], grow_pos)
                if self.cur == self.chewingtime:
                    self.cur = 0
                    self.ready = True
        else:
            window.blit(self.attackimages[self.cur], grow_pos)
            if self.cur == 6 and self.FPSVar == 0:
                load_sound(24)
                self.eat()
            if self.cur == self.index[1] - 1:
                self.cur = 0
                self.attack = False
                self.ready = False
        self.FPSVar = (self.FPSVar + 1) % self.FPSDiv
        if self.FPSVar == 0:
            self.cur += 1

    def check_collision(self):
        for each in zombie_list:
            temp_posx = GRASS_POS[0] + self.grassx * GRASS_SIZE[0] + GROW_PLUSX[self.code]
            if -40 <= each.posx - temp_posx <= 80 and self.grassy == each.grassy - 1:
                return True

    def eat(self):
        for each in zombie_list:
            temp_posx = GRASS_POS[0] + self.grassx * GRASS_SIZE[0] + GROW_PLUSX[self.code]
            if -40 <= each.posx - temp_posx <= 80 and self.grassy == each.grassy - 1:
                each.hurt(1800, 'mine')
                return


class Zombie(object):
    def __init__(self, code, speed, health, images, posx=None, grassy=None, cur=0, FPSVar=0, eating_flag=False):
        self.code = code
        self.cur = cur
        self.FPSVar = FPSVar
        self.speed = speed
        self.health = health
        self.index = INDEX_Zombie
        if posx is None:
            self.grassy = random.randint(0, 4)
            self.posx = 730
            self.posy = self.grassy * GRASS_SIZE[1] + ZOMBIE_PLUSY
        else:
            self.grassy = grassy
            self.posx = posx
            self.posy = self.grassy * GRASS_SIZE[1] + ZOMBIE_PLUSY

        self.images_normal = images[0]
        self.images_eating = images[1]
        self.images_boom = images[2]
        self.eating_flag = eating_flag
        self.boom = False

    def draw(self):
        # print(self.code, self.health, self.posx, self.posy, self.grassy)
        eat_flag = check_eat(self.posx, self.posy)
        if self.boom:
            pos = (self.posx, self.posy)
            window.blit(self.images_boom[self.cur % self.index[2]], pos)
            self.FPSVar = (self.FPSVar + 1) % 6
            if self.FPSVar == 0:
                self.cur += 1
                if self.cur == self.index[2]:
                    self.boom_die()
            return
        if eat_flag is None:
            if self.eating_flag:
                self.cur = 0
                self.eating_flag = False
            pos = (self.posx, self.posy)
            window.blit(self.images_normal[self.cur % self.index[0]], pos)
            self.FPSVar = (self.FPSVar + 1) % 8
            if self.FPSVar == 0:
                self.cur += 1
                self.move()
        else:
            if not self.eating_flag:
                self.cur = 0
                self.eating_flag = True
            pos = (self.posx, self.posy)
            window.blit(self.images_eating[self.cur % self.index[1]], pos)
            self.FPSVar = (self.FPSVar + 1) % 8
            if self.FPSVar == 0:
                self.cur += 1
                if self.cur % self.index[1] == 5:
                    eat_flag.hurt(70)
                    load_sound(random.randint(0, 1) * 2 + 1)

                elif self.cur % self.index[1] == 10:
                    eat_flag.hurt(70)
                    load_sound(2)

    def move(self):
        if self.posx < -150:
            global fail
            fail = True
        self.posx -= self.speed

    def hurt(self, num, status=None):
        self.health -= num
        if self.health <= 0:

            if num == 10000:
                self.instant_die()
            elif status == 'boom':
                self.boom = True
                self.cur = 0
                self.speed = 0
            elif status == 'mine':
                zombie_list.remove(self)
                if win and len(zombie_list) == 0:
                    global trophy
                    trophy = Trophy(self.posx, self.posy)
            else:
                if self.boom:
                    return
                self.die()

    def die(self):
        load_sound(10)
        head_list.append(Head(self.posx, self.posy))
        if self.eating_flag:
            body_list.append(Body(self.posx, self.posy, 1))
        else:
            body_list.append(Body(self.posx, self.posy, 0, self.speed / 8))
        zombie_list.remove(self)
        if win and len(zombie_list) == 0:
            global trophy
            trophy = Trophy(self.posx, self.posy)

    def instant_die(self):
        load_sound(10)
        head_list.append(Head(self.posx, self.posy))
        body_list.append(Body(self.posx, self.posy, 2))
        zombie_list.remove(self)
        if win and len(zombie_list) == 0:
            global trophy
            trophy = Trophy(self.posx, self.posy)

    def boom_die(self):
        zombie_list.remove(self)
        if win and len(zombie_list) == 0:
            global trophy
            trophy = Trophy(self.posx, self.posy)


class NormalZombie(Zombie):
    def __init__(self, posx=None, grassy=None, cur=0, FPSVar=0, eating_flag=False):
        Zombie.__init__(self, 0, ZOMBIE_SPEED, 300, IMAGE_Normal_zombie, posx, grassy, cur, FPSVar, eating_flag)


class ConeHeadZombie(Zombie):
    def __init__(self, posx=None, grassy=None, cur=0, FPSVar=0, eating_flag=False):
        Zombie.__init__(self, 1, ZOMBIE_SPEED, 370, IMAGE_Conehead_zombie, posx, grassy, cur, FPSVar, eating_flag)

    def hurt(self, num, status=None):
        self.health -= num

        if self.health <= 0:
            if num == 10000:
                self.instant_die()
            elif status == 'boom':
                self.boom = True
                self.cur = 0
                self.speed = 0
            elif status == 'mine':
                zombie_list.remove(self)
                if win and len(zombie_list) == 0:
                    global trophy
                    trophy = Trophy(self.posx, self.posy)
            else:
                if self.boom:
                    return
                zombie_list.remove(self)
                zombie_list.append(NormalZombie(self.posx + 10, self.grassy, self.cur, self.FPSVar, self.eating_flag))


class BucketHeadZombie(Zombie):
    def __init__(self, posx=None, grassy=None, cur=0, FPSVar=0, eating_flag=False):
        Zombie.__init__(self, 2, ZOMBIE_SPEED, 1100, IMAGE_Buckethead_zombie, posx, grassy, cur, FPSVar, eating_flag)

    def hurt(self, num, status=None):
        self.health -= num
        # print(self.posx, self.grassy, self.health)
        if self.health <= 0:
            if num == 10000:
                self.instant_die()
            elif status == 'boom':
                # print(self.posx, self.grassy, self.health, 'boom')
                self.boom = True
                self.cur = 0
                self.speed = 0
            elif status == 'mine':
                zombie_list.remove(self)
                if win and len(zombie_list) == 0:
                    global trophy
                    trophy = Trophy(self.posx, self.posy)
            else:
                if self.boom:
                    return
                zombie_list.remove(self)
                zombie_list.append(NormalZombie(self.posx, self.grassy, self.cur, self.FPSVar, self.eating_flag))


class Plant(object):
    def __init__(self, move, code, index, FPSDiv, images, pos=None):
        self.code = code
        self.index = index
        self.cur = 0
        self.FPSVar = 0
        self.FPSDiv = FPSDiv
        self.move = move
        self.images = images
        self.alpha_image = self.images[0].copy()
        self.alpha_image.set_alpha(100)
        self.health = 300
        if move:
            self.grassx = (pos[0] - GRASS_POS[0]) // GRASS_SIZE[0]
            self.grassy = (pos[1] - GRASS_POS[1]) // GRASS_SIZE[1]

    def draw(self, pos):
        window.blit(self.images[0], pos)

    def draw_on_grass(self):
        grow_pos = (GRASS_POS[0] + self.grassx * GRASS_SIZE[0] + GROW_PLUSX[self.code],
                    GRASS_POS[1] + self.grassy * GRASS_SIZE[1] + GROW_PLUSY[self.code])
        window.blit(self.images[self.cur % self.index], grow_pos)
        self.FPSVar = (self.FPSVar + 1) % self.FPSDiv
        if self.FPSVar == 0:
            self.cur += 1

    def draw_alpha(self, pos):
        x = (pos[0] - GRASS_POS[0]) // GRASS_SIZE[0]
        y = (pos[1] - GRASS_POS[1]) // GRASS_SIZE[1]
        grow_pos = (GRASS_POS[0] + x * GRASS_SIZE[0] + GROW_PLUSX[self.code],
                    GRASS_POS[1] + y * GRASS_SIZE[1] + GROW_PLUSY[self.code])
        window.blit(self.alpha_image, grow_pos)

    def hurt(self, num):
        self.health -= num
        if self.health <= 0:
            self.die()

    def die(self):
        load_sound(30)
        plant_list.remove(self)
        remove_plant_in_GRASS(self)


class Sunflower(Plant):
    def __init__(self, move, pos=None):
        Plant.__init__(self, move, 1, 18, 5, IMAGE_Sunflower, pos)

    def produce(self):
        sun_falling.append(Sun(self.grassx, self.grassy))

    def draw_on_grass(self):
        grow_pos = (GRASS_POS[0] + self.grassx * GRASS_SIZE[0] + GROW_PLUSX[self.code],
                    GRASS_POS[1] + self.grassy * GRASS_SIZE[1] + GROW_PLUSY[self.code])
        window.blit(self.images[self.cur % self.index], grow_pos)
        self.FPSVar = (self.FPSVar + 1) % self.FPSDiv
        if self.FPSVar == 0:
            self.cur += 1
            if (self.cur + 9) % 288 == 0:
                self.produce()


class Peashooter(Plant):
    def __init__(self, move, pos=None):
        Plant.__init__(self, move, 0, 13, 6, IMAGE_Peashooter, pos)

    def draw_on_grass(self):
        grow_pos = (GRASS_POS[0] + self.grassx * GRASS_SIZE[0] + GROW_PLUSX[self.code],
                    GRASS_POS[1] + self.grassy * GRASS_SIZE[1] + GROW_PLUSY[self.code])
        window.blit(self.images[self.cur % self.index], grow_pos)
        return self.next()

    def next(self):
        self.FPSVar = (self.FPSVar + 1) % self.FPSDiv
        if self.FPSVar == 0:
            self.cur += 1
        if self.cur % self.index == 2 and self.FPSVar == 0:
            if discover_zombie(self.grassx, self.grassy):
                return Bullet(self.grassx, self.grassy)
        return None


class CherryBomb(Plant):
    def __init__(self, move, pos=None):
        Plant.__init__(self, move, 2, 11, 6, IMAGE_Cherrybomb, pos)
        self.health = 3000

    def draw_on_grass(self):
        grow_pos = (GRASS_POS[0] + self.grassx * GRASS_SIZE[0] + GROW_PLUSX[self.code],
                    GRASS_POS[1] + self.grassy * GRASS_SIZE[1] + GROW_PLUSY[self.code])
        if self.cur >= 7:
            grow_pos_v = (grow_pos[0] - 50, grow_pos[1] - 30)
            window.blit(self.images[self.cur], grow_pos_v)
        else:
            window.blit(self.images[self.cur], grow_pos)
        self.FPSVar = (self.FPSVar + 1) % self.FPSDiv
        if self.FPSVar == 0:
            self.cur += 1
            if self.cur == self.index - 4:
                load_sound(22)
                self.blow()
            if self.cur == self.index - 1:
                plant_list.remove(self)
                remove_plant_in_GRASS(self)

    def blow(self):
        for each in zombie_list:
            # temp_pos = (GRASS_POS[0] + self.grassx * GRASS_SIZE[0] + GROW_PLUSX[self.code],
            #             GRASS_POS[1] + self.grassy * GRASS_SIZE[1] + GROW_PLUSY[self.code])
            temp_pos = (GRASS_POS[0] + self.grassx * GRASS_SIZE[0],
                        GRASS_POS[1] + self.grassy * GRASS_SIZE[1])
            # if ((each.posx - temp_pos[0]) ** 2 + (each.posy - temp_pos[1]) ** 2) ** 0.5 <= GRASS_SIZE[0] * 2:
            # if -GRASS_SIZE[0] <= each.posx - temp_pos[0] <= GRASS_SIZE[0] and -GRASS_SIZE[0] <= each.posx - temp_pos[0] <= GRASS_SIZE[0]:
            if -GRASS_SIZE[0] * 2.5 <= each.posx - temp_pos[0] <= GRASS_SIZE[0] and -GRASS_SIZE[1] * 2 <= each.posy - \
                    temp_pos[1] <= GRASS_SIZE[1]:
                each.hurt(1800, 'boom')


class WallNut(Plant):
    def __init__(self, move, pos=None):
        Plant.__init__(self, move, 3, 3, 6, IMAGE_Wallnut, pos)
        self.health = 4000

    def draw_on_grass(self):
        grow_pos = (GRASS_POS[0] + self.grassx * GRASS_SIZE[0] + GROW_PLUSX[self.code],
                    GRASS_POS[1] + self.grassy * GRASS_SIZE[1] + GROW_PLUSY[self.code])
        if self.health >= 8000 / 3:
            window.blit(self.images[0], grow_pos)
        elif self.health >= 4000 / 3:
            window.blit(self.images[1], grow_pos)
        else:
            window.blit(self.images[2], grow_pos)


class PotatoMine(Plant):
    def __init__(self, move, pos=None):
        Plant.__init__(self, move, 4, 8, 10, IMAGE_Potatomine, pos)
        self.initimage = IMAGE_Potatomine_init
        self.blowimage = IMAGE_Potatomine_blow
        self.ready = False
        self.blowing = False

    def draw_on_grass(self):
        grow_pos = (GRASS_POS[0] + self.grassx * GRASS_SIZE[0] + GROW_PLUSX[self.code],
                    GRASS_POS[1] + self.grassy * GRASS_SIZE[1] + GROW_PLUSY[self.code])
        if self.ready:
            zombie_to_blow = self.check_collision()
            if zombie_to_blow is not None:
                grow_pos_v = (grow_pos[0] - 30, grow_pos[1] - 25)
                window.blit(self.blowimage, grow_pos_v)
                self.ready = False
                self.blowing = True
                load_sound(23)
                zombie_to_blow.hurt(1800, 'mine')
                self.cur = 0
            else:
                window.blit(self.images[self.cur % self.index], grow_pos)
        else:
            if self.blowing:
                grow_pos_v = (grow_pos[0] - 40, grow_pos[1] - 60)
                window.blit(self.blowimage, grow_pos_v)
                if self.cur == 8:
                    plant_list.remove(self)
                    remove_plant_in_GRASS(self)
            else:
                grow_pos_v = (grow_pos[0] + 20, grow_pos[1] + 10)
                window.blit(self.initimage, grow_pos_v)
        self.FPSVar = (self.FPSVar + 1) % self.FPSDiv
        if self.FPSVar == 0:
            self.cur += 1
            if not self.blowing and not self.ready and self.cur == 15 * FPS / self.FPSDiv:
                self.ready = True

    def check_collision(self):
        for each in zombie_list:
            temp_posx = GRASS_POS[0] + self.grassx * GRASS_SIZE[0] + GROW_PLUSX[self.code]
            if -90 <= each.posx - temp_posx <= -10 and each.grassy == self.grassy:
                return each
        return None


class DoublePea(Peashooter):
    def __init__(self, move, pos=None):
        Peashooter.__init__(self, move, pos)
        self.code = 5
        self.index = 15
        self.images = IMAGE_Doublepea
        self.alpha_image = self.images[0].copy()
        self.alpha_image.set_alpha(100)

    def next(self):
        self.FPSVar = (self.FPSVar + 1) % self.FPSDiv
        if self.FPSVar == 0:
            self.cur += 1
        if (self.cur % self.index == 2 or self.cur % self.index == 8) and self.FPSVar == 0:
            if discover_zombie(self.grassx, self.grassy):
                return Bullet(self.grassx, self.grassy)
        return None


class Chomper(Plant):
    def __init__(self, move, pos=None):
        Plant.__init__(self, move, 6, (13, 9, 6), 8, IMAGE_Chomper, pos)
        self.attackimages = IMAGE_Chomper_attack
        self.digestimages = IMAGE_Chomper_digest
        self.chewingtime = 42 * FPS / self.FPSDiv
        self.attack = False
        self.ready = True

    def draw_on_grass(self):
        grow_pos = (GRASS_POS[0] + self.grassx * GRASS_SIZE[0] + GROW_PLUSX[self.code],
                    GRASS_POS[1] + self.grassy * GRASS_SIZE[1] + GROW_PLUSY[self.code])
        if not self.attack:
            if self.ready:
                window.blit(self.images[self.cur % self.index[0]], grow_pos)
                if self.check_collision():
                    self.attack = True
                    self.cur = 0
            else:
                window.blit(self.digestimages[self.cur % self.index[2]], grow_pos)
                if self.cur == self.chewingtime:
                    self.cur = 0
                    self.ready = True
        else:
            window.blit(self.attackimages[self.cur], grow_pos)
            if self.cur == 6 and self.FPSVar == 0:
                load_sound(24)
                self.eat()
            if self.cur == self.index[1] - 1:
                self.cur = 0
                self.attack = False
                self.ready = False
        self.FPSVar = (self.FPSVar + 1) % self.FPSDiv
        if self.FPSVar == 0:
            self.cur += 1

    def check_collision(self):
        for each in zombie_list:
            temp_posx = GRASS_POS[0] + self.grassx * GRASS_SIZE[0] + GROW_PLUSX[self.code]
            if -40 <= each.posx - temp_posx <= 80 and self.grassy == each.grassy:
                return True

    def eat(self):
        for each in zombie_list:
            temp_posx = GRASS_POS[0] + self.grassx * GRASS_SIZE[0] + GROW_PLUSX[self.code]
            if -40 <= each.posx - temp_posx <= 80 and self.grassy == each.grassy:
                each.hurt(1800, 'mine')
                return


class Bullet(object):
    def __init__(self, x, start_y):
        self.grassy = start_y
        self.posx = GRASS_POS[0] + x * GRASS_SIZE[0] + BULLET_START_POS[0]
        self.posy = GRASS_POS[1] + start_y * GRASS_SIZE[1] + BULLET_START_POS[1]
        self.speed = GRASS_SIZE[0] * 0.05
        self.image_normal = IMAGE_Pea_bullet
        self.image_explode = IMAGE_Pea_bullet_explode

    def draw(self):
        window.blit(self.image_normal, (self.posx, self.posy))

    def move(self):
        collision_flag = check_collision(self.posx, self.grassy, 20)
        if self.posx <= GRASS_POS[0] + GRASS_NUM[0] * GRASS_SIZE[0] + 5:
            if collision_flag is None:
                self.posx += self.speed
            else:
                if collision_flag.code == 0:
                    load_sound(random.randint(7, 9))
                elif collision_flag.code == 1:
                    load_sound(random.randint(26, 27))
                elif collision_flag.code == 2:
                    load_sound(random.randint(28, 29))
                window.blit(self.image_explode, (self.posx, self.posy))
                bullets.remove(self)
        else:
            bullets.remove(self)


class MinigamesBullet(Bullet):
    def __init__(self, x, start_y):
        Bullet.__init__(self, x, start_y)

    def move(self):
        collision_flag = minigames_check_collision(self.posx, self.grassy, 20)
        if self.posx <= GRASS_POS[0] + GRASS_NUM[0] * GRASS_SIZE[0] + 5:
            if collision_flag is None:
                self.posx += self.speed
            else:
                if collision_flag.code == 0:
                    load_sound(random.randint(7, 9))
                elif collision_flag.code == 1:
                    load_sound(random.randint(26, 27))
                elif collision_flag.code == 2:
                    load_sound(random.randint(28, 29))
                window.blit(self.image_explode, (self.posx, self.posy))
                bullets.remove(self)
        else:
            bullets.remove(self)


class Sun(object):
    sun_size = (78, 78)
    sun_point = 25

    def __init__(self, grassx=None, grassy=None):
        self.index = 22
        self.cur = 0
        self.stop_cur = 0
        self.FPSVar = 0
        self.images = IMAGE_Sun
        self.produced = False
        if grassx is None and grassy is None:
            self.posx = random.randint(GRASS_POS[0] - 40, GRASS_POS[0] + GRASS_NUM[0] * GRASS_SIZE[0] - 40)
            self.posy = -80
            self.endy = random.randint(GRASS_POS[1], GRASS_POS[1] + GRASS_NUM[1] * GRASS_SIZE[1] - Sun.sun_size[1] + 20)
        else:
            self.posx = random.randint(GRASS_POS[0] + grassx * GRASS_SIZE[0] - 40,
                                       GRASS_POS[0] + (grassx + 1) * GRASS_SIZE[0] - 40)
            self.posy = GRASS_POS[1] + grassy * GRASS_SIZE[1] + 10
            self.endy = random.randint(GRASS_POS[1] + grassy * GRASS_SIZE[1] + 30,
                                       GRASS_POS[1] + (grassy + 1) * GRASS_SIZE[1] - 50)
            self.produced = True
        self.speed = 1

    def fall(self):
        if self.posy >= self.endy:
            self.speed = 0
            return
        if self.produced:
            return
        self.posy += self.speed

    def draw(self):
        if self.produced:
            highlight = self.images[0]
            highlight.set_alpha(int(255 * self.cur / 15))
            window.blit(highlight, (self.posx, self.posy))
        else:
            window.blit(self.images[self.cur % self.index], (self.posx, self.posy))
        self.FPSVar = (self.FPSVar + 1) % 3
        if self.FPSVar == 0:
            self.cur += 1
            if self.cur == 15 and self.produced:
                self.produced = False
            if self.speed != 0:
                self.stop_cur = self.cur
        if self.cur - self.stop_cur == 160:
            sun_falling.remove(self)


class SunCollecting(object):

    endx = 20
    endy = 10

    collect_time = FPS

    def __init__(self, initpos):
        self.posx = initpos[0]
        self.posy = initpos[1]
        self.image = IMAGE_Sun[10]
        delta_x = initpos[0] + Sun.sun_size[0] // 2 - SunCollecting.endx
        delta_y = initpos[1] + Sun.sun_size[1] // 2 - SunCollecting.endy
        temp_total = (delta_x ** 2 + delta_y ** 2) ** 0.5
        temp_speed = temp_total / SunCollecting.collect_time * 2
        temp_acc = temp_speed ** 2 / (2 * temp_total)
        self.speed_x = temp_speed * delta_x / temp_total
        self.speed_y = temp_speed * delta_y / temp_total
        self.acc_x = temp_acc * delta_x / temp_total
        self.acc_y = temp_acc * delta_y / temp_total

    def move(self):
        self.posx -= int(self.speed_x)
        self.speed_x -= self.acc_x
        self.posy -= int(self.speed_y)
        self.speed_y -= self.acc_y
        if self.speed_x <= 0.5 and self.speed_y <= 0.5:
            sun_collecting.remove(self)

    def draw(self):
        window.blit(self.image, (self.posx, self.posy))


class Brain(object):
    def __init__(self, grassy):
        self.code = -1
        self.grassy = grassy
        self.image = IMAGE_Brain
        self.health = 300

    def draw_on_grass(self):
        window.blit(self.image, (5, GRASS_POS[1] + self.grassy * GRASS_SIZE[1] + 42))

    def hurt(self, num):
        self.health -= num
        if self.health <= 0:
            load_sound(30)
            brain_list.remove(self.grassy)
            plant_list.remove(self)
            if len(brain_list) == 0:
                global trophy
                trophy = Trophy(GRASS_POS[0], GRASS_POS[1] + GRASS_SIZE[1] * self.grassy)


class Lawnmower(object):
    cross_time = 4 * FPS
    readyx = -26
    endx = WINDOW_WIDTH

    def __init__(self, posx, grassy):
        self.posx = posx
        self.posy = GRASS_POS[1] + grassy * GRASS_SIZE[1] + 35
        self.grassy = grassy
        self.ready = False
        self.set_off = False
        self.speed = (Lawnmower.endx + 26) / Lawnmower.cross_time

    def draw(self):
        window.blit(IMAGE_Lawnmower, (self.posx, self.posy))

    def move(self):
        if not self.ready:
            self.posx += self.speed
            if self.posx >= Lawnmower.readyx:
                self.ready = True
        elif not self.set_off:
            collision_flag = check_collision(self.posx, self.grassy, 0)
            if collision_flag is not None:
                load_sound(19)
                self.set_off = True
        else:
            self.posx += self.speed
            check_collision(self.posx, self.grassy, 10000)
        if self.posx >= Lawnmower.endx:
            lawnmower_list.remove(self)


# 占用的草地
class PlantedGrass(object):
    def __init__(self, pos, code):
        self.code = code
        self.grassx = (pos[0] - GRASS_POS[0]) // GRASS_SIZE[0]
        self.grassy = (pos[1] - GRASS_POS[1]) // GRASS_SIZE[1]


# 选卡动画
class MovingCard(object):
    def __init__(self, image, startpos, endpos, code):
        self.image = image
        self.endpos = endpos
        self.posx = startpos[0]
        self.posy = startpos[1]
        self.movingtime = 0.1 * FPS
        self.code = code

        delta_x = endpos[0] - startpos[0]
        delta_y = endpos[1] - startpos[1]
        total = (delta_x ** 2 + delta_y ** 2) ** 0.5
        speed = total / self.movingtime

        self.speed_x = speed * delta_x / total
        self.speed_y = speed * delta_y / total

    def draw(self):
        window.blit(self.image, (self.posx, self.posy))

    def move(self):
        if -3 <= self.posx - self.endpos[0] <= 3 and -3 <= self.posy - self.endpos[1] <= 3:
            moving_card_list.remove(self)
        self.posx += self.speed_x
        self.posy += self.speed_y


class FlagMeter(object):
    def __init__(self):
        self.cur = 0
        self.FPSVar = 0
        self.images = IMAGE_Flagmeter
        self.index = 37

    def draw(self):
        window.blit(self.images[self.cur], (601, 561))
        if self.cur == 36:
            return
        self.FPSVar = (self.FPSVar + 1) % 300
        if self.FPSVar == 0:
            self.cur += 1


def show_text(textstr1, size, color, pos1, textstr2=None, pos2=None):
    # file = pygame.font.SysFont(font_name, size)
    file = pygame.font.Font(FONT, size)
    text1 = file.render(textstr1, True, color)
    window.blit(text1, pos1)
    if textstr2 is not None:
        text2 = file.render(textstr2, True, color)
        window.blit(text2, pos2)


# 加载素材
def load_peashooter():
    temp_pea = []
    for i in range(13):
        file = pygame.image.load('images/Peashooter/Peashooter_{0}.png'.format(i)).convert_alpha()
        temp_pea.append(file)
    return temp_pea


def load_sunflower():
    temp_flower = []
    for i in range(18):
        file = pygame.image.load('images/Sunflower/Sunflower_{0}.png'.format(i)).convert_alpha()
        temp_flower.append(file)
    return temp_flower


def load_cherrybomb():
    temp_bomb = []
    for i in range(1, 12):
        file = pygame.image.load('images/CherryBomb/CherryBomb-{0}.png'.format(i)).convert_alpha()
        temp_bomb.append(file)
    return temp_bomb


def load_wallnut():
    temp_wallnut = []
    for i in range(3):
        file = pygame.image.load('images/WallNut/Wallnut_{0}.png'.format(i)).convert_alpha()
        file = pygame.transform.rotozoom(file, 0, 0.8)
        temp_wallnut.append(file)
    return temp_wallnut


def load_potatomine():
    temp_mine = []
    for i in range(1, 9):
        file = pygame.image.load('images/PotatoMine/PotatoMine/PotatoMine-{0}.png'.format(i)).convert_alpha()
        temp_mine.append(file)
    return temp_mine


def load_chomper():
    chomper = []
    for i in range(13):
        file = pygame.image.load('images/Chomper/Chomper/Chomper_{0}.png'.format(i)).convert_alpha()
        chomper.append(file)
    return chomper


def load_chomper_attack():
    chomper = []
    for i in range(9):
        file = pygame.image.load('images/Chomper/ChomperAttack/ChomperAttack_{0}.png'.format(i)).convert_alpha()
        chomper.append(file)
    return chomper


def load_chomper_digest():
    chomper = []
    for i in range(6):
        file = pygame.image.load('images/Chomper/ChomperDigest/ChomperDigest_{0}.png'.format(i)).convert_alpha()
        chomper.append(file)
    return chomper


def load_doublepea():
    doublepea = []
    for i in range(15):
        file = pygame.image.load('images/RepeaterPea/RepeaterPea_{0}.png'.format(i)).convert_alpha()
        doublepea.append(file)
    return doublepea


def load_sun():
    temp_sun = []
    for i in range(22):
        file = pygame.image.load('images/Sun/Sun_{0}.png'.format(i)).convert_alpha()
        temp_sun.append(file)
    return temp_sun


def load_normal_zombie():
    temp_zombie = []
    for i in range(22):
        file = pygame.image.load('images/NormalZombie/Zombie/Zombie_{0}.png'.format(i)).convert_alpha()
        temp_zombie.append(file)
    return temp_zombie


def load_eating_zombie():
    temp_zombie = []
    for i in range(11):
        file = pygame.image.load('images/NormalZombie/ZombieAttack/ZombieAttack_{0}.png'.format(i)).convert_alpha()
        temp_zombie.append(file)
    return temp_zombie


def load_conehead_zombie():
    temp_zombie = []
    for i in range(22):
        file = pygame.image.load(
            'images/ConeheadZombie/ConeheadZombie/ConeheadZombie_{0}.png'.format(i)).convert_alpha()
        temp_zombie.append(file)
    return temp_zombie


def load_eating_conehead():
    temp_zombie = []
    for i in range(11):
        file = pygame.image.load(
            'images/ConeheadZombie/ConeheadZombieAttack/ConeheadZombieAttack_{0}.png'.format(i)).convert_alpha()
        temp_zombie.append(file)
    return temp_zombie


def load_buckethead_zombie():
    temp_zombie = []
    for i in range(22):
        file = pygame.image.load(
            'images/BucketheadZombie/BucketheadZombie/BucketheadZombie_{0}.png'.format(i)).convert_alpha()
        temp_zombie.append(file)
    return temp_zombie


def load_eating_buckethead():
    temp_zombie = []
    for i in range(11):
        file = pygame.image.load(
            'images/BucketheadZombie/BucketheadZombieAttack/BucketheadZombieAttack_{0}.png'.format(i)).convert_alpha()
        temp_zombie.append(file)
    return temp_zombie


def load_head():
    temp_head = []
    for i in range(17):
        file = pygame.image.load('images/NormalZombie/ZombieHead/ZombieHead_{0}.png'.format(i)).convert_alpha()
        temp_head.append(file)
    return temp_head


def load_body():
    temp_body = []
    for i in range(17):
        file = pygame.image.load('images/NormalZombie/ZombieDie/ZombieDie_{0}.png'.format(i)).convert_alpha()
        temp_body.append(file)
    return temp_body


def load_body_walking():
    temp_body = []
    for i in range(18):
        file = pygame.image.load('images/NormalZombie/ZombieLostHead/ZombieLostHead_{0}.png'.format(i)).convert_alpha()
        temp_body.append(file)
    return temp_body


def load_body_eating():
    temp_body = []
    for i in range(11):
        file = pygame.image.load(
            'images/NormalZombie/ZombieLostHeadAttack/ZombieLostHeadAttack_{0}.png'.format(i)).convert_alpha()
        temp_body.append(file)
    return temp_body


def load_booming_zombie():
    temp_zombie = []
    for i in range(20):
        file = pygame.image.load('images/NormalZombie/BoomDie/BoomDie_{0}.png'.format(i)).convert_alpha()
        temp_zombie.append(file)
    return temp_zombie


def load_flagmeter():
    temp = []
    for i in range(37):
        file = pygame.image.load('images/FlagMeter/FlagMeter_{0}.png'.format(i)).convert_alpha()
        temp.append(file)
    return temp


def load_trophy():
    trophy_file = []
    for i in range(9):
        file = pygame.image.load('images/Trophy/trophy_{0}.png'.format(i)).convert_alpha()
        trophy_file.append(file)
    return trophy_file


def load_images():
    global IMAGE_Start_menu  # (384, 72)

    global IMAGE_Adventure_button
    global IMAGE_Adventure_button_alpha

    global IMAGE_Minigames_button
    global IMAGE_Minigames_button_alpha

    global IMAGE_Minigames_back
    global IMAGE_Minigames_window
    global IMAGE_Minigames_window_alpha

    global IMAGE_Minigames_imzombie

    global IMAGE_Minigames_back_button
    global IMAGE_Minigames_back_button_alpha

    global IMAGE_Background_night

    global IMAGE_Help_button
    global IMAGE_Help_button_alpha
    global IMAGE_Quit_button
    global IMAGE_Quit_button_alpha
    global IMAGE_Options_button
    global IMAGE_Options_button_alpha

    global IMAGE_Help
    global IMAGE_Back_button_alpha

    global IMAGE_Background
    global IMAGE_Background_full

    global IMAGE_Choose_seeds
    global IMAGE_Ready_button

    global IMAGE_Start_planting

    global IMAGE_Sun_count

    global IMAGE_Pause_button_left
    global IMAGE_Pause_button_middle
    global IMAGE_Pause_button_right
    global IMAGE_Pause_button_alpha

    global IMAGE_Volume_knob
    global IMAGE_Volume

    global IMAGE_Pause_screen

    global IMAGE_Long_button_alpha

    global IMAGE_Back_to_game
    global IMAGE_Back_to_game_alpha

    global IMAGE_Peashooter
    global IMAGE_Card_peashooter
    global IMAGE_Card_peashooter_alpha

    global IMAGE_Sun

    global IMAGE_Lawnmower

    global IMAGE_Sunflower
    global IMAGE_Card_sunflower
    global IMAGE_Card_sunflower_alpha

    global IMAGE_Pea_bullet
    global IMAGE_Pea_bullet_explode

    global IMAGE_Cherrybomb
    global IMAGE_Card_cherrybomb
    global IMAGE_Card_cherrybomb_alpha

    global IMAGE_Wallnut
    global IMAGE_Card_wallnut
    global IMAGE_Card_wallnut_alpha

    global IMAGE_Potatomine
    global IMAGE_Potatomine_init
    global IMAGE_Potatomine_blow
    global IMAGE_Card_potatomine
    global IMAGE_Card_potatomine_alpha

    global IMAGE_Chomper
    global IMAGE_Chomper_attack
    global IMAGE_Chomper_digest
    global IMAGE_Card_chomper
    global IMAGE_Card_chomper_alpha

    global IMAGE_Doublepea
    global IMAGE_Card_doublepea
    global IMAGE_Card_doublepea_alpha

    global IMAGE_Normal_zombie

    global IMAGE_Conehead_zombie

    global IMAGE_Buckethead_zombie

    global IMAGE_Zombie_head
    global IMAGE_Zombie_body
    global IMAGE_Zombie_body_walking
    global IMAGE_Zombie_body_eating

    global IMAGE_Shovel
    global IMAGE_Shovel_bank

    global IMAGE_Flagmeter

    global IMAGE_Huge_wave
    global IMAGE_Final_wave

    global IMAGE_Lost

    global IMAGE_Dialog

    global card_image_list

    global IMAGE_Trophy
    global IMAGE_Trophy_get

    global IMAGE_Card_normal_zombie
    global IMAGE_Card_normal_zombie_alpha

    global IMAGE_Card_cone_zombie
    global IMAGE_Card_cone_zombie_alpha

    global IMAGE_Card_bucket_zombie
    global IMAGE_Card_bucket_zombie_alpha

    global IMAGE_Zombie_line

    global IMAGE_Brain

    IMAGE_Start_menu = pygame.image.load('images/MainMenu.png').convert()

    IMAGE_Adventure_button = pygame.image.load('images/Buttons/SelectorScreen_Adventure_button.png').convert_alpha()
    IMAGE_Adventure_button_alpha = pygame.image.load(
        'images/Buttons/SelectorScreen_Adventure_highlight.png').convert_alpha()

    IMAGE_Minigames_button = pygame.image.load('images/Buttons/SelectorScreen_Survival_button.png').convert_alpha()
    IMAGE_Minigames_button_alpha = pygame.image.load('images/Buttons/SelectorScreen_Survival_highlight.png').convert_alpha()

    IMAGE_Minigames_back = pygame.image.load('images/Buttons/Challenge_Background.jpg').convert_alpha()
    IMAGE_Minigames_window = pygame.image.load('images/Buttons/Challenge_Window.png').convert_alpha()
    IMAGE_Minigames_window_alpha = pygame.image.load('images/Buttons/Challenge_Window_Highlight.png').convert_alpha()

    IMAGE_Minigames_imzombie = pygame.image.load('images/Buttons/minigames_imzombie.png').convert_alpha()

    IMAGE_Minigames_back_button = pygame.image.load('images/Buttons/Almanac_IndexButton.png').convert_alpha()
    IMAGE_Minigames_back_button_alpha = pygame.image.load('images/Buttons/Almanac_IndexButtonHighlight.png').convert_alpha()

    IMAGE_Background_night = pygame.image.load('images/Background_3.png').convert()

    IMAGE_Help_button = pygame.image.load('images/Buttons/SelectorScreen_Help1.png').convert_alpha()
    IMAGE_Help_button_alpha = pygame.image.load('images/Buttons/SelectorScreen_Help2.png').convert_alpha()
    IMAGE_Quit_button = pygame.image.load('images/Buttons/SelectorScreen_Quit1.png').convert_alpha()
    IMAGE_Quit_button_alpha = pygame.image.load('images/Buttons/SelectorScreen_Quit2.png').convert_alpha()
    IMAGE_Options_button = pygame.image.load('images/Buttons/SelectorScreen_Options1.png').convert_alpha()
    IMAGE_Options_button_alpha = pygame.image.load('images/Buttons/SelectorScreen_Options2.png').convert_alpha()

    IMAGE_Help = pygame.image.load('images/Help.png').convert()
    IMAGE_Back_button_alpha = pygame.image.load('images/Buttons/BackButton.png').convert_alpha()

    IMAGE_Background = pygame.image.load('images/Background_0.png').convert()
    IMAGE_Background_full = pygame.image.load('images/Backgroundfull.png').convert()

    IMAGE_Choose_seeds = pygame.image.load('images/SeedChooser_Background.png').convert_alpha()
    IMAGE_Ready_button = [pygame.image.load('images/Buttons/SeedChooser_Button_Disabled.png').convert_alpha(),
                          pygame.image.load('images/Buttons/SeedChooser_Button.png').convert_alpha(),
                          pygame.image.load('images/Buttons/SeedChooser_Button_Glow.png').convert_alpha()]
    for i in range(3):
        IMAGE_Ready_button[i] = pygame.transform.rotozoom(IMAGE_Ready_button[i], 0, 2)

    IMAGE_Start_planting = [pygame.image.load('images/StartReady.png').convert_alpha(),
                            pygame.image.load('images/StartSet.png').convert_alpha(),
                            pygame.image.load('images/StartPlant.png').convert_alpha()]

    IMAGE_Sun_count = pygame.image.load('images/sun_count.png').convert_alpha()  # 76x87

    IMAGE_Pause_button_left = pygame.image.load('images/Buttons/button_left.png').convert_alpha()
    IMAGE_Pause_button_middle = pygame.image.load('images/Buttons/button_middle.png').convert_alpha()
    IMAGE_Pause_button_right = pygame.image.load('images/Buttons/button_right.png').convert_alpha()
    IMAGE_Pause_button_alpha = pygame.image.load('images/Buttons/button.png').convert_alpha()

    IMAGE_Volume = pygame.image.load('images/Buttons/options_sliderslot.png').convert_alpha()
    IMAGE_Volume_knob = pygame.image.load('images/Buttons/options_sliderknob2.png').convert_alpha()

    IMAGE_Pause_screen = pygame.image.load('images/Buttons/PauseScreen.png').convert_alpha()

    IMAGE_Long_button_alpha = pygame.image.load('images/Buttons/long_button2.png').convert_alpha()

    IMAGE_Back_to_game = pygame.image.load('images/Buttons/options_backtogamebutton0.png').convert_alpha()
    IMAGE_Back_to_game_alpha = pygame.image.load('images/Buttons/options_backtogamebutton2.png').convert_alpha()

    IMAGE_Peashooter = load_peashooter()
    IMAGE_Card_peashooter = pygame.image.load('images/Cards/card_peashooter.png').convert_alpha()  # 65x90
    IMAGE_Card_peashooter_alpha = pygame.image.load('images/Cards/card_peashooter_alpha.png').convert_alpha()

    IMAGE_Sun = load_sun()

    IMAGE_Lawnmower = pygame.image.load('images/lawnmower.png').convert_alpha()

    IMAGE_Sunflower = load_sunflower()
    IMAGE_Card_sunflower = pygame.image.load('images/Cards/card_sunflower.png').convert_alpha()
    IMAGE_Card_sunflower_alpha = pygame.image.load('images/Cards/card_sunflower_alpha.png').convert_alpha()

    IMAGE_Pea_bullet = pygame.image.load('images/Peashooter/PeaNormal.png').convert_alpha()
    IMAGE_Pea_bullet_explode = pygame.image.load('images/Peashooter/PeaNormalExplode_0.png').convert_alpha()

    IMAGE_Cherrybomb = load_cherrybomb()
    IMAGE_Card_cherrybomb = pygame.image.load('images/Cards/card_cherrybomb.png').convert_alpha()
    IMAGE_Card_cherrybomb_alpha = pygame.image.load('images/Cards/card_cherrybomb_alpha.png').convert_alpha()

    IMAGE_Wallnut = load_wallnut()
    IMAGE_Card_wallnut = pygame.image.load('images/Cards/card_wallnut.png').convert_alpha()
    IMAGE_Card_wallnut_alpha = pygame.image.load('images/Cards/card_wallnut_alpha.png').convert_alpha()

    IMAGE_Potatomine = load_potatomine()
    IMAGE_Potatomine_init = pygame.image.load('images/PotatoMine/PotatoMineInit.png').convert_alpha()
    IMAGE_Potatomine_blow = pygame.image.load('images/PotatoMine/PotatoMine_mashed.png').convert_alpha()
    IMAGE_Potatomine_blow = pygame.transform.rotozoom(IMAGE_Potatomine_blow, 0, 1.2)
    IMAGE_Card_potatomine = pygame.image.load('images/Cards/card_potatomine.png').convert_alpha()
    IMAGE_Card_potatomine_alpha = pygame.image.load('images/Cards/card_potatomine_alpha.png').convert_alpha()

    IMAGE_Chomper = load_chomper()
    IMAGE_Chomper_attack = load_chomper_attack()
    IMAGE_Chomper_digest = load_chomper_digest()
    IMAGE_Card_chomper = pygame.image.load('images/Cards/card_chomper.png').convert_alpha()
    IMAGE_Card_chomper_alpha = pygame.image.load('images/Cards/card_chomper_alpha.png').convert_alpha()

    IMAGE_Doublepea = load_doublepea()
    IMAGE_Card_doublepea = pygame.image.load('images/Cards/card_doublepea.png').convert_alpha()
    IMAGE_Card_doublepea_alpha = pygame.image.load('images/Cards/card_doublepea_alpha.png').convert_alpha()

    IMAGE_Normal_zombie = [load_normal_zombie(), load_eating_zombie(), load_booming_zombie()]

    IMAGE_Conehead_zombie = [load_conehead_zombie(), load_eating_conehead(), load_booming_zombie()]

    IMAGE_Buckethead_zombie = [load_buckethead_zombie(), load_eating_buckethead(), load_booming_zombie()]

    IMAGE_Zombie_head = load_head()
    IMAGE_Zombie_body = load_body()
    IMAGE_Zombie_body_walking = load_body_walking()
    IMAGE_Zombie_body_eating = load_body_eating()

    IMAGE_Shovel = pygame.image.load('images/Shovel.png').convert_alpha()
    IMAGE_Shovel_bank = pygame.image.load('images/ShovelBank.png').convert_alpha()

    IMAGE_Flagmeter = load_flagmeter()

    IMAGE_Huge_wave = pygame.image.load('images/APPROACHING.png').convert_alpha()
    IMAGE_Final_wave = pygame.image.load('images/FinalWave.png').convert_alpha()

    IMAGE_Lost = pygame.image.load('images/Lost.png').convert_alpha()

    IMAGE_Dialog = pygame.image.load('images/Buttons/Dialog.png').convert_alpha()

    card_image_list = [IMAGE_Card_peashooter, IMAGE_Card_sunflower, IMAGE_Card_cherrybomb,
                       IMAGE_Card_wallnut, IMAGE_Card_potatomine, IMAGE_Card_doublepea, IMAGE_Card_chomper]

    IMAGE_Trophy = load_trophy()
    IMAGE_Trophy_get = pygame.image.load('images/trophy.png').convert_alpha()

    IMAGE_Card_normal_zombie = pygame.image.load('images/Cards/card_normal_zombie.png').convert()
    IMAGE_Card_normal_zombie_alpha = pygame.image.load('images/Cards/card_normal_zombie_alpha.png').convert()

    IMAGE_Card_cone_zombie = pygame.image.load('images/Cards/card_cone_zombie.png').convert()
    IMAGE_Card_cone_zombie_alpha = pygame.image.load('images/Cards/card_cone_zombie_alpha.png').convert()

    IMAGE_Card_bucket_zombie = pygame.image.load('images/Cards/card_bucket_zombie.png').convert()
    IMAGE_Card_bucket_zombie_alpha = pygame.image.load('images/Cards/card_bucket_zombie_alpha.png').convert()

    IMAGE_Zombie_line = pygame.image.load('images/Wallnut_bowlingstripe.png').convert_alpha()

    IMAGE_Brain = pygame.image.load('images/brain.png').convert_alpha()


def load_music(num, times, paused=False, loading_flag=False):
    # print(MUSIC_POS)
    if loading_flag:
        pygame.mixer.music.load('music/start0.mp3')
        pygame.mixer.music.load('music/grasswalk0.mp3')
        pygame.mixer.music.load('music/Choose your seeds.mp3')
        pygame.mixer.music.load('music/mountains.mp3')
        return

    if num == 0:
        music = 'music/start0.mp3'
    elif num == 1:
        music = 'music/grasswalk0.mp3'
    elif num == 2:
        music = 'music/Choose your seeds.mp3'
    elif num == 4:
        music = 'music/mountains.mp3'
    if pygame.mixer.music.get_busy():
        pygame.mixer.music.stop()
    if paused:
        if num == 0:
            music = 'music/start0.mp3'
        elif num == 1:
            music = 'music/grasswalk0.mp3'
        elif num == 2:
            music = 'music/Choose your seeds.mp3'
        elif num == 4:
            music = 'music/mountains.mp3'
    pygame.mixer.music.load(music)
    pygame.mixer.music.set_volume(MUSIC_VOLUME)
    if paused:
        pygame.mixer.music.play(times, MUSIC_POS)
    else:
        pygame.mixer.music.play(times)


def load_sound(num, loading_flag=False):

    file = ['sound/plant.ogg', 'sound/chomp0.ogg', 'sound/chomp1.ogg', 'sound/chomp2.ogg', 'sound/seedlift.ogg',
            'sound/shovel.ogg', 'sound/tap.ogg', 'sound/splat0.ogg', 'sound/splat1.ogg', 'sound/splat2.ogg',
            'sound/limbs_pop.ogg', 'sound/zombie_falling_1.ogg', 'sound/zombie_falling_2.ogg', 'sound/tap2.ogg',
            'sound/buzzer.ogg', 'sound/bleep.ogg', 'sound/paper.ogg', 'sound/gravebutton.ogg', 'sound/pause.ogg',
            'sound/lawnmower.ogg', 'sound/scream.ogg', 'sound/losemusic.ogg', 'sound/cherrybomb.ogg',
            'sound/potato_mine.ogg', 'sound/bigchomp.ogg', 'sound/frozen.ogg', 'sound/plastichit.ogg',
            'sound/plastichit2.ogg', 'sound/shieldhit.ogg', 'sound/shieldhit2.ogg', 'sound/gulp.ogg',
            'sound/readysetplant.ogg', 'sound/finalwave.ogg', 'sound/hugewave.ogg', 'sound/awooga.ogg',
            'sound/winmusic.ogg', 'sound/buttonclick.ogg', 'sound/siren.ogg']

    if loading_flag:
        pygame.mixer.Sound(file[num])
        return
    sound = pygame.mixer.Sound(file[num])
    sound.set_volume(SOUND_VOLUME)
    sound.play()


# 设置部件
def set_background(num, pos=None):
    if num == 0:
        window.blit(IMAGE_Start_menu, POS)
        return
    if num == 1:
        window.blit(IMAGE_Background, POS)
        return
    if num == 2:
        window.blit(IMAGE_Background_full, pos)
        return
    if num == 3:
        window.blit(IMAGE_Background_night, POS)
        return


def set_window(title, size):
    global window
    window = pygame.display.set_mode(size)
    pygame.display.set_caption(title)


def set_shovel(pos=(GRASS_POS[0] + 7 * GRASS_SIZE[0], 0)):
    window.blit(IMAGE_Shovel_bank, pos)


def set_sun(sun, pos=SUN_POS):

    text_pos = (47 - len(sun) * 6, 55)
    if pos != SUN_POS:
        text_pos = (text_pos[0] - SUN_POS[0] + pos[0], text_pos[1] + pos[1] - SUN_POS[1])
    sun_box = Button(pos, IMAGE_Sun_count)
    sun_box.draw()

    show_text(sun, 25, (0, 0, 0), text_pos)


def set_minigames_card(zombie, pos, type=None):
    if zombie == 0:
        if type is None:
            window.blit(IMAGE_Card_normal_zombie, pos)
            return
        window.blit(IMAGE_Card_normal_zombie_alpha, pos)
        return
    if zombie == 1:
        if type is None:
            window.blit(IMAGE_Card_cone_zombie, pos)
            return
        window.blit(IMAGE_Card_cone_zombie_alpha, pos)
        return
    if zombie == 2:
        if type is None:
            window.blit(IMAGE_Card_bucket_zombie, pos)
            return
        window.blit(IMAGE_Card_bucket_zombie_alpha, pos)
        return


def set_cards(plant, pos, type=None):
    if plant == 0:
        if type is None:
            window.blit(IMAGE_Card_peashooter, pos)
            return
        window.blit(IMAGE_Card_peashooter_alpha, pos)
        return
    if plant == 1:
        if type is None:
            window.blit(IMAGE_Card_sunflower, pos)
            return
        window.blit(IMAGE_Card_sunflower_alpha, pos)
        return
    if plant == 2:
        if type is None:
            window.blit(IMAGE_Card_cherrybomb, pos)
            return
        window.blit(IMAGE_Card_cherrybomb_alpha, pos)
        return
    if plant == 3:
        if type is None:
            window.blit(IMAGE_Card_wallnut, pos)
            return
        window.blit(IMAGE_Card_wallnut_alpha, pos)
        return
    if plant == 4:
        if type is None:
            window.blit(IMAGE_Card_potatomine, pos)
            return
        window.blit(IMAGE_Card_potatomine_alpha, pos)
        return
    if plant == 5:
        if type is None:
            window.blit(IMAGE_Card_doublepea, pos)
            return
        window.blit(IMAGE_Card_doublepea_alpha, pos)
        return
    if plant == 6:
        if type is None:
            window.blit(IMAGE_Card_chomper, pos)
            return
        window.blit(IMAGE_Card_chomper_alpha, pos)
        return


def set_frozen_time(code, last_time, cur_time, pos):
    size = CARD_SIZE[1] * (last_time + FROZEN_TIME[code] * FPS - cur_time) / (FROZEN_TIME[code] * FPS)
    if size > 0:
        temp_card = pygame.Surface((CARD_SIZE[0], size))
        temp_card.fill((0, 0, 0))
        temp_card.set_alpha(100)
        window.blit(temp_card, pos)


def set_pause_button(status, pos, lost=False):
    if on_pause(pos) and status == 2:
        window.blit(IMAGE_Pause_button_alpha, PAUSE_BUTTON_ALPHA)
    else:
        window.blit(IMAGE_Pause_button_left, PAUSE_BUTTON[0])
        window.blit(IMAGE_Pause_button_middle, PAUSE_BUTTON[1])
        window.blit(IMAGE_Pause_button_right, PAUSE_BUTTON[2])

    if lost:
        text_pos1 = (712, 2)
        text_pos2 = (715, 1)
        text = '主菜单'
    else:
        text_pos1 = (721, 2)
        text_pos2 = (724, 1)
        text = '菜单'

    if on_pause(pos):
        if status == 2:
            show_text(text, 18, FONT_COLOR[1], text_pos2)
        else:
            show_text(text, 18, FONT_COLOR[1], text_pos1)
    else:
        show_text(text, 18, FONT_COLOR[0], text_pos1)


def set_back_to_game(clicked, pos):
    if 242 <= pos[0] <= 556 and 452 <= pos[1] <= 520:
        if clicked == 1:
            window.blit(IMAGE_Back_to_game_alpha, BACK_TO_GAME_ALPHA)
            show_text('返回游戏', 42, FONT_COLOR[1], (316, 462))
        else:
            window.blit(IMAGE_Back_to_game, BACK_TO_GAME)
            show_text('返回游戏', 42, FONT_COLOR[1], (316, 460))
    else:
        window.blit(IMAGE_Back_to_game, BACK_TO_GAME)
        show_text('返回游戏', 42, FONT_COLOR[0], (316, 460))


def set_option_up(clicked, pos):
    if PAUSE_OPTION_UP[0][0] <= pos[0] <= PAUSE_OPTION_UP[4][0] + 35 and PAUSE_OPTION_UP[0][1] <= pos[1] <= \
            PAUSE_OPTION_UP[0][1] + 46:
        if clicked == 3:
            window.blit(IMAGE_Long_button_alpha, PAUSE_OPTION_UP_ALPHA)
            show_text('主菜单', 18, FONT_COLOR[1], (PAUSE_OPTION_UP[0][0] + 76, PAUSE_OPTION_UP[0][1] + 12))
        else:
            window.blit(IMAGE_Pause_button_left, PAUSE_OPTION_UP[0])
            window.blit(IMAGE_Pause_button_middle, PAUSE_OPTION_UP[1])
            window.blit(IMAGE_Pause_button_middle, PAUSE_OPTION_UP[2])
            window.blit(IMAGE_Pause_button_middle, PAUSE_OPTION_UP[3])
            window.blit(IMAGE_Pause_button_right, PAUSE_OPTION_UP[4])
            show_text('主菜单', 18, FONT_COLOR[1], (PAUSE_OPTION_UP[0][0] + 76, PAUSE_OPTION_UP[0][1] + 10))
    else:
        window.blit(IMAGE_Pause_button_left, PAUSE_OPTION_UP[0])
        window.blit(IMAGE_Pause_button_middle, PAUSE_OPTION_UP[1])
        window.blit(IMAGE_Pause_button_middle, PAUSE_OPTION_UP[2])
        window.blit(IMAGE_Pause_button_middle, PAUSE_OPTION_UP[3])
        window.blit(IMAGE_Pause_button_right, PAUSE_OPTION_UP[4])
        show_text('主菜单', 18, FONT_COLOR[0], (PAUSE_OPTION_UP[0][0] + 76, PAUSE_OPTION_UP[0][1] + 10))


def set_option_down(clicked, pos):
    if PAUSE_OPTION_DOWN[0][0] <= pos[0] <= PAUSE_OPTION_DOWN[4][0] + 35 and PAUSE_OPTION_DOWN[0][1] <= pos[1] <= \
            PAUSE_OPTION_DOWN[0][1] + 46:
        if clicked == 2:
            window.blit(IMAGE_Long_button_alpha, PAUSE_OPTION_DOWN_ALPHA)
            show_text('退出游戏', 18, FONT_COLOR[1], (PAUSE_OPTION_DOWN[0][0] + 67, PAUSE_OPTION_DOWN[0][1] + 12))
        else:
            window.blit(IMAGE_Pause_button_left, PAUSE_OPTION_DOWN[0])
            window.blit(IMAGE_Pause_button_middle, PAUSE_OPTION_DOWN[1])
            window.blit(IMAGE_Pause_button_middle, PAUSE_OPTION_DOWN[2])
            window.blit(IMAGE_Pause_button_middle, PAUSE_OPTION_DOWN[3])
            window.blit(IMAGE_Pause_button_right, PAUSE_OPTION_DOWN[4])
            show_text('退出游戏', 18, FONT_COLOR[1], (PAUSE_OPTION_DOWN[0][0] + 67, PAUSE_OPTION_DOWN[0][1] + 10))
    else:
        window.blit(IMAGE_Pause_button_left, PAUSE_OPTION_DOWN[0])
        window.blit(IMAGE_Pause_button_middle, PAUSE_OPTION_DOWN[1])
        window.blit(IMAGE_Pause_button_middle, PAUSE_OPTION_DOWN[2])
        window.blit(IMAGE_Pause_button_middle, PAUSE_OPTION_DOWN[3])
        window.blit(IMAGE_Pause_button_right, PAUSE_OPTION_DOWN[4])
        show_text('退出游戏', 18, FONT_COLOR[0], (PAUSE_OPTION_DOWN[0][0] + 67, PAUSE_OPTION_DOWN[0][1] + 10))


def set_start_again(clicked, pos):
    text_pos1 = (364, 356)
    text_pos2 = (365, 359)
    if LOST_RESTART[0][0] <= pos[0] <= LOST_RESTART[4][0] + 46 and LOST_RESTART[0][1] <= pos[1] <= LOST_RESTART[0][
        1] + 46:
        if clicked == 1:
            window.blit(IMAGE_Long_button_alpha, LOST_RESTART_ALPHA)
            show_text('重新尝试', 18, FONT_COLOR[1], text_pos2)
        else:
            window.blit(IMAGE_Pause_button_left, LOST_RESTART[0])
            window.blit(IMAGE_Pause_button_middle, LOST_RESTART[1])
            window.blit(IMAGE_Pause_button_middle, LOST_RESTART[2])
            window.blit(IMAGE_Pause_button_middle, LOST_RESTART[3])
            window.blit(IMAGE_Pause_button_right, LOST_RESTART[4])
            show_text('重新尝试', 18, FONT_COLOR[1], text_pos1)
    else:
        window.blit(IMAGE_Pause_button_left, LOST_RESTART[0])
        window.blit(IMAGE_Pause_button_middle, LOST_RESTART[1])
        window.blit(IMAGE_Pause_button_middle, LOST_RESTART[2])
        window.blit(IMAGE_Pause_button_middle, LOST_RESTART[3])
        window.blit(IMAGE_Pause_button_right, LOST_RESTART[4])
        show_text('重新尝试', 18, FONT_COLOR[0], text_pos1)


def on_card(pos):
    if pos[0] < CARD_POS[0] or pos[0] > CARD_POS[0] + CARD_SIZE[0] * len(card_list):
        return -1
    if pos[1] < CARD_POS[1] or pos[1] > CARD_POS[1] + CARD_SIZE[1]:
        return -1
    return (pos[0] - CARD_POS[0]) // CARD_SIZE[0]


def minigames_on_grass(pos):
    if GRASS_POS[0] + 4 * GRASS_SIZE[0] <= pos[0] <= GRASS_POS[0] + GRASS_NUM[0] * GRASS_SIZE[0]:
        if GRASS_POS[1] <= pos[1] <= GRASS_POS[1] + GRASS_NUM[1] * GRASS_SIZE[1]:
            return True
    return False


def on_grass(pos):
    if GRASS_POS[0] <= pos[0] <= GRASS_POS[0] + GRASS_NUM[0] * GRASS_SIZE[0]:
        if GRASS_POS[1] <= pos[1] <= GRASS_POS[1] + GRASS_NUM[1] * GRASS_SIZE[1]:
            return True
    return False


def on_adventure_button(pos):
    if 390 <= pos[0] <= 648 and 102 <= pos[1] <= 198:
        return True
    if 606 <= pos[0] <= 743 and 123 <= pos[1] <= 215:
        return True
    return False


def on_minigames_button(pos):
    if 413 <= pos[0] <= 558 and 193 <= pos[1] <= 251:
        return True
    if 490 <= pos[0] <= 568 and 203 <= pos[1] <= 261:
        return True
    if 561 <= pos[0] <= 625 and 212 <= pos[1] <= 274:
        return True
    if 625 <= pos[0] <= 707 and 224 <= pos[1] <= 292:
        return True
    return False


def on_help_button(pos):
    if 655 <= pos[0] <= 697 and 530 <= pos[1] <= 552:
        return True
    return False


def on_quit_button(pos):
    if 731 <= pos[0] <= 776 and 513 <= pos[1] <= 537:
        return True
    return False


def on_options_button(pos):
    if 572 <= pos[0] <= 628 and 492 <= pos[1] <= 517:
        return True
    return False


def on_shovel(pos):
    if GRASS_POS[0] + 7 * GRASS_SIZE[0] <= pos[0] <= GRASS_POS[0] + 8 * GRASS_SIZE[0] and pos[1] <= 80:
        return True
    return False


def on_pause(pos):
    # if 700 <= pos[0] <= 812 and pos[1] <= 32:
    if 680 <= pos[0] <= 792 and pos[1] <= 32:
        return True
    return False


def on_sun(sun_list, pos):
    for each in sun_list:
        if each.posx + 10 <= pos[0] <= each.posx + 70 and each.posy + 10 <= pos[1] <= each.posy + 70:
            sun_list.remove(each)
            return each
    return None


def can_grow(pos):
    for each in GRASS:
        if GRASS_POS[0] + each.grassx * GRASS_SIZE[0] <= pos[0] <= GRASS_POS[0] + (each.grassx + 1) * GRASS_SIZE[0]:
            if GRASS_POS[1] + each.grassy * GRASS_SIZE[1] <= pos[1] <= GRASS_POS[1] + (each.grassy + 1) * GRASS_SIZE[1]:
                return False
    return True


def remove_plant_in_GRASS(plant):
    for each in GRASS:
        if each.grassx == plant.grassx and each.grassy == plant.grassy:
            GRASS.remove(each)
            return


def exist_plant(pos):
    grass_x = (pos[0] - GRASS_POS[0]) // GRASS_SIZE[0]
    grass_y = (pos[1] - GRASS_POS[1]) // GRASS_SIZE[1]
    for plant in plant_list:
        if plant.grassx == grass_x and plant.grassy == grass_y:
            plant_list.remove(plant)
            remove_plant_in_GRASS(plant)
            return True
    return False


def check_collision(bullet_x, grassy, healthdecrease):
    for each in zombie_list:
        if each.grassy == grassy:
            if -50 < each.posx - bullet_x < -40:
                each.hurt(healthdecrease)
                return each
    return None


def minigames_check_collision(bullet_x, grassy, healthdecrease):
    for each in zombie_list:
        if each.grassy == grassy + 1:
            if -50 < each.posx - bullet_x < -40:
                each.hurt(healthdecrease)
                return each
    return None


def check_eat(posx, posy):
    grassy = (posy - GRASS_POS[1]) // GRASS_SIZE[1]
    for each in plant_list:
        if grassy == each.grassy - 1:
            if each.code != -1:
                temp_grassx = GRASS_POS[0] + each.grassx * GRASS_SIZE[0] - 40
                if -25 <= posx - temp_grassx <= 5:
                    return each
            else:
                if -95 <= posx <= -65:
                    return each
    return None


def minigames_discover_zombie(grassx, grassy):
    for each in zombie_list:
        if each.grassy == grassy + 1 and each.posx > GRASS_POS[0] + grassx * GRASS_SIZE[0]:
            return True
    return False


def discover_zombie(grassx, grassy):
    for each in zombie_list:
        if each.grassy == grassy and each.posx > GRASS_POS[0] + grassx * GRASS_SIZE[0] and not each.boom:
            return True
    return False


def plant_object(card_num, move, pos=None):
    if card_num == 0:
        return Peashooter(move, pos)
    if card_num == 1:
        return Sunflower(move, pos)
    if card_num == 2:
        return CherryBomb(move, pos)
    if card_num == 3:
        return WallNut(move, pos)
    if card_num == 4:
        return PotatoMine(move, pos)
    if card_num == 5:
        return DoublePea(move, pos)
    if card_num == 6:
        return Chomper(move, pos)


def find_moving_card(code):
    for each in moving_card_list:
        if each.code == code:
            return True
    return False


def zombie_object(zombie_num, posx=None, grassy =None):
    if zombie_num == 0:
        return NormalZombie( posx=posx, grassy=grassy)
    if zombie_num == 1:
        return ConeHeadZombie(posx=posx, grassy=grassy)
    if zombie_num == 2:
        return BucketHeadZombie(posx=posx,grassy=grassy)


def minigames_zombie_object(zombie_num, move, pos=None):
    if pos is not None:
        # temp_pos = (pos[0], (pos[1] - GRASS_POS[1]) // GRASS_SIZE[1])
        if zombie_num == 0:
            return MinigamesNormalZombie(move, initpos=pos)
        if zombie_num == 1:
            return MinigamesConeZombie(move, initpos=pos)
        if zombie_num == 2:
            return MinigamesBucketZombie(move, initpos=pos)

    else:
        if zombie_num == 0:
            return MinigamesNormalZombie(move)
        if zombie_num == 1:
            return MinigamesConeZombie(move)
        if zombie_num == 2:
            return MinigamesBucketZombie(move)


def check_files():

    load_font_flag = True
    while load_font_flag:
        try:
            file = pygame.font.Font(FONT, 32)
        except FileNotFoundError:
            loading = True
            while loading:
                font = pygame.font.SysFont('华文宋体', 32)
                text1 = font.render('字体文件gbk.ttf缺失  请检查文件完整性', True, (255, 255, 255))
                text2 = font.render('按a键重新加载', True, (255, 255, 255))
                window.blit(text1, (130, 200))
                window.blit(text2, (296, 400))
                pygame.display.update()
                for event in pygame.event.get():
                    if event.type == pygame.QUIT:
                        pygame.quit()
                        exit()
                    if event.type == pygame.KEYDOWN:
                        if chr(event.key) == 'a':
                            loading = False
        else:
            load_font_flag = False


    load_image_flag = True
    while load_image_flag:
        try:
            load_images()
        except FileNotFoundError:
            text1 = '图片文件或images目录缺失  请检查文件完整性'
            text2 = '按a键重新加载'
            loading = True
            while loading:
                window.fill((0, 0, 0))
                show_text(text1, 32, (255, 255, 255), (70, 200), text2, (296, 400))
                pygame.display.update()
                for event in pygame.event.get():
                    if event.type == pygame.QUIT:
                        pygame.quit()
                        exit()
                    if event.type == pygame.KEYDOWN:
                        if chr(event.key) == 'a':
                            loading = False
        else:
            load_image_flag = False

    load_music_flag = True
    while load_music_flag:
        try:
            load_music(0, 0, loading_flag=True)
        except pygame.error:
            text1 = '音乐文件或music目录缺失  请检查文件完整性'
            text2 = '按a键重新加载'
            loading = True
            while loading:
                window.fill((0, 0, 0))
                show_text(text1, 32, (255, 255, 255), (70, 200), text2, (296, 400))
                pygame.display.update()
                for event in pygame.event.get():
                    if event.type == pygame.QUIT:
                        pygame.quit()
                        exit()
                    if event.type == pygame.KEYDOWN:
                        if chr(event.key) == 'a':
                            loading = False
        else:
            load_music_flag = False

    load_sound_flag = True
    while load_sound_flag:
        try:
            for i in range(38):
                load_sound(0, loading_flag=True)
        except FileNotFoundError:
            text1 = '音效文件或sound目录缺失  请检查文件完整性'
            text2 = '按a键重新加载'
            loading = True
            while loading:
                window.fill((0, 0, 0))
                show_text(text1, 32, (255, 255, 255), (72, 200), text2, (296, 400))
                pygame.display.update()
                for event in pygame.event.get():
                    if event.type == pygame.QUIT:
                        pygame.quit()
                        exit()
                    if event.type == pygame.KEYDOWN:
                        if chr(event.key) == 'a':
                            loading = False
        else:
            load_sound_flag = False
    return

# 选小游戏True 主菜单False
def minigames_screen():

    load_music(2, -1)

    minigames_flag = True
    while minigames_flag:
        clock.tick(FPS)

        window.blit(IMAGE_Minigames_back, POS)
        window.blit(IMAGE_Minigames_imzombie, (59, 108))

        show_text('迷你游戏', 32, FONT_COLOR[6], (336, 32))

        temp_pos = pygame.mouse.get_pos()
        if 22 <= temp_pos[0] <= 258 and 98 <= temp_pos[1] <= 338:
            window.blit(IMAGE_Minigames_window_alpha, (22, 98))
        else:
            window.blit(IMAGE_Minigames_window, (22, 98))
        show_text('我是僵尸', 32, FONT_COLOR[7], (74, 264))

        if 22 <= temp_pos[0] <= 181 and 570 <= temp_pos[1] <= 591:
            window.blit(IMAGE_Minigames_back_button_alpha, (20, 568))
        else:
            window.blit(IMAGE_Minigames_back_button, (20, 568))
        show_text('主菜单', 16, FONT_COLOR[7], (79, 573))

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit()
                exit()

            if event.type == pygame.MOUSEBUTTONDOWN:
                global mode_num
                if 22 <= event.pos[0] <= 258 and 98 <= event.pos[1] <= 338:
                    mode_num = 1
                    load_sound(36)
                    return True

                elif 22 <= event.pos[0] <= 181 and 570 <= event.pos[1] <= 591:
                    load_sound(36)
                    return False

        pygame.display.update()
    return False


def start(fromscreen=None):

    load_music(0, -1)

    on_click = 0

    stay_on_button_flag = 0

    start_flag = True
    while start_flag:
        clock.tick(FPS)

        set_background(0)
        adventure = Button(ADVENTURE_BUTTON, IMAGE_Adventure_button, IMAGE_Adventure_button_alpha)
        minigames = Button(MINIGAMES_BUTTON, IMAGE_Minigames_button, IMAGE_Minigames_button_alpha)

        help_button = Button(HELP_BUTTON, IMAGE_Help_button, IMAGE_Help_button_alpha)
        quit_button = Button(QUIT_BUTTON, IMAGE_Quit_button, IMAGE_Quit_button_alpha)
        options_button = Button(OPTIONS_BUTTON, IMAGE_Options_button, IMAGE_Options_button_alpha)

        temp_pos = pygame.mouse.get_pos()
        set_background(0)
        if on_adventure_button(temp_pos):
            if stay_on_button_flag != 1:
                load_sound(15)
                stay_on_button_flag = 1
            adventure.draw_alpha()
        else:
            if stay_on_button_flag == 1:
                stay_on_button_flag = 0
            adventure.draw()

        if on_minigames_button(temp_pos):
            if stay_on_button_flag != 4:
                load_sound(15)
                stay_on_button_flag = 4
            minigames.draw_alpha()
        else:
            if stay_on_button_flag == 4:
                stay_on_button_flag = 0
            minigames.draw()

        if on_help_button(temp_pos):
            if stay_on_button_flag != 2:
                load_sound(15)
                stay_on_button_flag = 2
            help_button.draw_alpha()
        else:
            if stay_on_button_flag == 2:
                stay_on_button_flag = 0
            help_button.draw()

        if on_quit_button(temp_pos):
            if stay_on_button_flag != 3:
                load_sound(15)
                stay_on_button_flag = 3
            quit_button.draw_alpha()
        else:
            if stay_on_button_flag == 3:
                stay_on_button_flag = 0
            quit_button.draw()

        if on_options_button(temp_pos):
            if stay_on_button_flag != 5:
                load_sound(15)
                stay_on_button_flag = 5
            options_button.draw_alpha()
        else:
            if stay_on_button_flag == 5:
                stay_on_button_flag = 0
            options_button.draw()

        show_text('1', 25, (255, 255, 255), ADVENTURE_TEXT[0], str(LEVEL), ADVENTURE_TEXT[1])
        pygame.display.update()

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit()
                exit()

            elif event.type == pygame.MOUSEBUTTONDOWN:
                if on_quit_button(event.pos):
                    on_click = 1
                elif on_adventure_button(event.pos):
                    on_click = 2
                elif on_help_button(event.pos):
                    on_click = 3
                elif on_minigames_button(event.pos):
                    on_click = 4
                elif on_options_button(event.pos):
                    on_click = 5

            elif event.type == pygame.MOUSEBUTTONUP:
                global mode_num
                if on_quit_button(event.pos) and on_click == 1:
                    load_sound(13)
                    pygame.quit()
                    exit()
                elif on_adventure_button(event.pos) and on_click == 2:
                    mode_num = 0
                    if fromscreen == 'imzombie':
                        return False
                    return True
                elif on_help_button(event.pos) and on_click == 3:
                    pygame.mixer.music.stop()
                    load_sound(13)
                    load_sound(16)
                    help_screen()
                    pygame.mixer.music.play()
                elif on_minigames_button(event.pos) and on_click == 4:
                    load_sound(17)
                    if minigames_screen():
                        mode_num = 1
                        if fromscreen == 'adventure':
                            return False
                        return True
                elif on_options_button(event.pos) and on_click == 5:
                    load_sound(13)
                    if not pause('start'):
                        mode_num = 0
                        return

                on_click = 0

    pygame.mixer.music.stop()


def pause(fromscreen=None):
    global MUSIC_POS
    MUSIC_POS = MUSIC_POS + pygame.mixer.music.get_pos() / 1000
    MUSIC_POS = MUSIC_POS % 300

    global MUSIC_VOLUME
    global SOUND_VOLUME

    pygame.mixer.music.pause()

    temp = window.copy()
    click_flag = 0

    pause_flag = True

    while pause_flag:
        clock.tick(FPS)
        window.blit(temp, POS)
        window.blit(IMAGE_Pause_screen, (194, 58))

        temp_pos = pygame.mouse.get_pos()

        set_back_to_game(click_flag, temp_pos)
        if fromscreen != 'start':
            set_option_up(click_flag, temp_pos)
        set_option_down(click_flag, temp_pos)

        posx = temp_pos[0]
        if posx < 400:
            posx = 400
        if posx > 535:
            posx = 535
        if click_flag == 4:
            MUSIC_VOLUME = (posx - 400) / 135
        elif click_flag == 5:
            SOUND_VOLUME = (posx - 400) / 135

        music_knob_pos = (390 + 135 * MUSIC_VOLUME, 190)
        sound_knob_pos = (390 + 135 * SOUND_VOLUME, 230)

        window.blit(IMAGE_Volume, (400, 200))
        window.blit(IMAGE_Volume_knob, music_knob_pos)
        window.blit(IMAGE_Volume, (400, 240))
        window.blit(IMAGE_Volume_knob, sound_knob_pos)
        show_text('音量:音乐', 20, FONT_COLOR[3], (290, 190), '音量:音效', (290, 230))

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit()
                exit()

            elif event.type == pygame.MOUSEBUTTONDOWN:
                if event.button == 1:
                    if 244 <= event.pos[0] <= 556 and 452 <= event.pos[1] <= 520:
                        click_flag = 1
                    elif PAUSE_OPTION_UP[0][0] <= event.pos[0] <= PAUSE_OPTION_UP[4][0] + 35 and PAUSE_OPTION_DOWN[0][
                        1] <= event.pos[1] <= PAUSE_OPTION_DOWN[0][1] + 35:
                        click_flag = 2
                    elif PAUSE_OPTION_UP[0][0] <= event.pos[0] <= PAUSE_OPTION_UP[4][0] + 35 and PAUSE_OPTION_UP[0][
                        1] <= event.pos[1] <= PAUSE_OPTION_UP[0][1] + 46 and fromscreen != 'start':
                        click_flag = 3
                    elif music_knob_pos[0] <= event.pos[0] <= music_knob_pos[0] + 21 and music_knob_pos[1] + 3 <= \
                            event.pos[1] <= music_knob_pos[1] + 27:
                        # print(MUSIC_VOLUME)
                        click_flag = 4
                    elif sound_knob_pos[0] <= event.pos[0] <= sound_knob_pos[0] + 21 and sound_knob_pos[1] + 3 <= \
                            event.pos[1] <= sound_knob_pos[1] + 27:
                        # print(SOUND_VOLUME)
                        click_flag = 5

            elif event.type == pygame.MOUSEBUTTONUP:
                if event.button == 1 and click_flag != 0:
                    if 242 <= event.pos[0] <= 556 and 452 <= event.pos[1] <= 520:
                        load_sound(17)
                        pause_flag = False
                    elif PAUSE_OPTION_UP[0][0] <= event.pos[0] <= PAUSE_OPTION_UP[4][0] + 35:
                        if PAUSE_OPTION_DOWN[0][1] <= event.pos[1] <= PAUSE_OPTION_DOWN[0][1] + 35 and click_flag == 2:
                            pygame.quit()
                            exit()
                        if PAUSE_OPTION_UP[0][1] <= event.pos[1] <= PAUSE_OPTION_UP[0][1] + 46 and fromscreen != 'start' and click_flag == 3:
                            load_sound(17)
                            global mode_num
                            if fromscreen == 'choose' or fromscreen == 'adventure':
                                if not start('adventure'):
                                    mode_num = 1
                                    return False
                            if fromscreen == 'imzombie':
                                if not start('imzombie'):
                                    return False

                    click_flag = 0

        pygame.display.update()

    if fromscreen is None:
        load_music(1, -1, True)
    if fromscreen == 'start':
        load_music(0, -1, True)
    elif fromscreen == 'choose':
        load_music(2, -1, True)
    elif fromscreen == 'imzombie':
        load_music(4, -1, True)

    return True


# 0 无 1 按下回到游戏 2 按下退出游戏 3 按下主菜单


def fail_screen(fromscreen=None):
    pygame.mixer.music.stop()

    load_sound(21)

    temp_window = window.copy()

    click_flag = 0

    i = 1
    lost_flag = True

    global mode_num

    while lost_flag:
        clock.tick(FPS)
        if fromscreen is None and i <= 3 * FPS and i % FPS == 0:
            if i // FPS == 2:
                load_sound(20)
            load_sound(i // FPS)

        window.blit(temp_window, POS)
        if fromscreen is None and i <= 2 * FPS:
            temp_screen = pygame.transform.rotozoom(IMAGE_Lost, 0, i / (2 * FPS))
            wid, hei = temp_screen.get_size()
            temp_pos = ((WINDOW_WIDTH - wid) / 2, (WINDOW_HEIGHT - hei) / 2)
            window.blit(temp_screen, temp_pos)
            for event in pygame.event.get():
                if event.type == pygame.QUIT:
                    pygame.quit()
                    exit()
        elif fromscreen is None and i <= 8 * FPS:
            temp_back = pygame.Surface(WINDOW_SIZE)
            temp_back.fill((0, 0, 0))
            temp_back.set_alpha(int((150 * i - 300 * FPS) / (6 * FPS)))

            window.blit(temp_back, POS)
            window.blit(IMAGE_Lost, (118, 66))
            for event in pygame.event.get():
                if event.type == pygame.QUIT:
                    pygame.quit()
                    exit()
        else:
            temp_back = pygame.Surface(WINDOW_SIZE)
            temp_back.fill((0, 0, 0))
            temp_back.set_alpha(150)
            window.blit(temp_back, POS)
            window.blit(IMAGE_Dialog, (245, 182))
            show_text('游戏结束', 25, FONT_COLOR[2], (350, 280))

            temp_pos = pygame.mouse.get_pos()

            set_start_again(click_flag, temp_pos)
            set_pause_button(click_flag, temp_pos)

            for event in pygame.event.get():
                if event.type == pygame.QUIT:
                    pygame.quit()
                    exit()

                if event.type == pygame.MOUSEBUTTONDOWN:
                    if event.button == 1:
                        if LOST_RESTART[0][0] <= event.pos[0] <= LOST_RESTART[4][0] + 46 and LOST_RESTART[0][1] <= \
                                event.pos[1] <= LOST_RESTART[0][1] + 46:
                            click_flag = 1
                        elif PAUSE_BUTTON[0][0] <= event.pos[0] <= PAUSE_BUTTON[2][0] + 46:
                            click_flag = 2

                elif event.type == pygame.MOUSEBUTTONUP:
                    if event.button == 1 and click_flag != 0:
                        if LOST_RESTART[0][0] <= event.pos[0] <= LOST_RESTART[4][0] + 204 and LOST_RESTART[0][1] <= \
                                event.pos[1] <= LOST_RESTART[0][1] + 46:
                            load_sound(17)
                            return True

                        elif PAUSE_BUTTON[0][0] <= event.pos[0] <= PAUSE_BUTTON[2][0] + 46 and PAUSE_BUTTON[0][1] <= \
                                event.pos[1] <= PAUSE_BUTTON[0][1] + 46:
                            load_sound(17)
                            if fromscreen == 'adventure':
                                if not start('adventure'):
                                    mode_num = 1
                                    return False
                            if fromscreen == 'imzombie':
                                if not start('imzombie'):
                                    mode_num = 0
                                    return False
                            return True

                        click_flag = 0

        pygame.display.update()
        # 0 no 1 click restart 2 click menu
        i += 1


def winscreen():

    pygame.mixer.music.fadeout(1000)
    load_sound(35)

    timer = 0

    posx = trophy.posx
    posy = trophy.posy + 61

    while True:
        clock.tick(FPS)

        if timer <= 2 * FPS:
            trophy_image = IMAGE_Trophy_get

            temp_screen = pygame.Surface(WINDOW_SIZE)
            temp_screen.fill((255, 255, 255))
            temp_screen.set_alpha(int(50 * timer / (7 * FPS)))
            window.blit(temp_screen, POS)

            window.blit(trophy_image, (posx, posy))

        elif timer <= 7 * FPS:
            trophy_image = IMAGE_Trophy_get

            window.blit(trophy_image, (posx, posy))

            temp_screen = pygame.Surface(WINDOW_SIZE)
            temp_screen.fill((255, 255, 255))
            temp_screen.set_alpha(int(255 * (timer - 2 * FPS) / (5 * FPS)))
            window.blit(temp_screen, POS)

        else:
            return

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit()
                exit()

        pygame.display.update()
        timer += 1


def imzombie():
    load_music(4, -1)
    global card_list

    card_list = [0, 1, 2]

    mouse_zombie = None
    on_click = False

    global plant_list
    plant_list = [MinigamesSunflower(0, 0), MinigamesPeashooter(1, 0),
                  MinigamesSunflower(2, 0), MinigamesPeashooter(3, 0),
                  MinigamesWallNut(0, 1), MinigamesPeashooter(1, 1),
                  MinigamesSunflower(2, 1), MinigamesPeashooter(3, 1),
                  MinigamesChomper(0, 2), MinigamesSunflower(1, 2),
                  MinigamesPeashooter(2, 2), MinigamesSunflower(3, 2),
                  MinigamesSunflower(0, 3), MinigamesWallNut(1, 3),
                  MinigamesSunflower(2, 3), MinigamesDoublePea(3, 3),
                  MinigamesPotatoMine(0, 4), MinigamesSunflower(1, 4),
                  MinigamesPeashooter(2, 4), MinigamesSunflower(3, 4)]

    global brain_list
    brain_list = []

    for i in range(5):
        brain_list.append(i)
        plant_list.append(Brain(i))

    global bullets
    global zombie_list
    global head_list
    global body_list

    bullets = []
    zombie_list = []
    head_list = []
    body_list = []

    global sun_falling
    global sun_collecting
    sun_falling = []
    sun_collecting = []
    initsun = INIT_SUN

    pause_click_flag = 0

    global win
    win = False

    global trophy
    trophy = None

    global mode_num

    while True:
        clock.tick(FPS)

        set_background(3)
        window.blit(IMAGE_Zombie_line, (347, 71))

        set_sun(str(initsun))

        card_pos = CARD_POS
        for i in card_list:
            if initsun < ZOMBIE_SUN_COST[i]:
                set_minigames_card(i, card_pos, 'alpha')
            else:
                set_minigames_card(i, card_pos)
            card_pos = (card_pos[0] + CARD_SIZE[0], card_pos[1])

        for each in plant_list:
            if each.code == 0:
                temp_bullet = each.draw_on_grass()
                if temp_bullet is not None:
                    bullets.append(temp_bullet)
            elif each.code == 5:
                temp_bullet = each.draw_on_grass()
                if temp_bullet is not None:
                    bullets.append(temp_bullet)
            else:
                each.draw_on_grass()

        temp_pos = pygame.mouse.get_pos()

        for each in bullets:
            each.draw()
            each.move()

        for each in zombie_list:
            each.draw_on_grass()

        for each in head_list:
            each.draw()
        for each in body_list:
            each.draw()

        for each in sun_falling:
            each.draw()
            each.fall()
        for each in sun_collecting:
            each.draw()
            each.move()

        if trophy is not None:
            trophy.draw()
            trophy.fall()

        if initsun < 50 and len(brain_list) > 0 and len(zombie_list) == 0:
            fail_screen('imzombie')
            return

        set_pause_button(pause_click_flag, temp_pos)

        if on_click and mouse_zombie is not None:
            if minigames_on_grass(temp_pos):
                alpha = minigames_zombie_object(mouse_zombie.code, False)
                alpha.draw_alpha(temp_pos)
            temp_zombie_size = ZOMBIE_SIZE[mouse_zombie.code]
            temp_pos = (temp_pos[0] - temp_zombie_size[0] * 2 / 3, temp_pos[1] - temp_zombie_size[1] * 2 / 3)
            mouse_zombie.draw(temp_pos)

        pygame.display.update()

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit()
                exit()

            elif event.type == pygame.MOUSEBUTTONDOWN:
                if event.button == 1:

                    card_flag = on_card(event.pos)
                    flag = on_sun(sun_falling, event.pos)

                    if on_pause(event.pos):
                        pause_click_flag = 2

                    elif flag is not None:
                        if not on_click:
                            temp_sun = SunCollecting((flag.posx, flag.posy))
                            sun_collecting.append(temp_sun)
                        initsun += Sun.sun_point

                    elif card_flag != -1:
                        if not on_click:
                            if initsun >= ZOMBIE_SUN_COST[card_list[card_flag]]:
                                load_sound(4)
                                mouse_zombie = minigames_zombie_object(card_list[card_flag], False)
                                on_click = True
                            else:
                                load_sound(14)
                        else:
                            load_sound(6)
                            on_click = False
                            mouse_zombie = None

                    elif minigames_on_grass(event.pos):
                        if on_click:
                            zombie_list.append(minigames_zombie_object(mouse_zombie.code, True, event.pos))
                            load_sound(0)
                            on_click = False
                            initsun -= ZOMBIE_SUN_COST[mouse_zombie.code]

                    if on_grass(event.pos):
                        if trophy is not None:
                            if trophy.posx + 5 < event.pos[0] < trophy.posx + 77 and trophy.posy + 54 < event.pos[1] < trophy.posy + 115:

                                winscreen()
                                if not start('imzombie'):
                                    mode_num = 0
                                    return

            elif event.type == pygame.MOUSEBUTTONUP:
                if event.button == 1 and pause_click_flag == 2:
                    if on_pause(event.pos):
                        load_sound(17)
                        load_sound(18)

                        if not pause('imzombie'):

                            mode_num = 0
                            return

                    pause_click_flag = 0



def game():
    # plant(code) sequence in card bank
    global card_list
    # card_list = [0, 1, 2, 3, 4, 5, 6]
    card_list = []

    mouse_plant = None
    on_click = False

    global plant_list
    plant_list = []

    global lawnmower_list
    lawnmower_list = []

    global bullets
    global zombie_list
    global head_list
    global body_list

    bullets = []
    zombie_list = []
    head_list = []
    body_list = []

    flagmeter = FlagMeter()

    global sun_falling
    global sun_collecting
    sun_falling = []
    sun_collecting = []
    initsun = INIT_SUN

    shovel_flag = False

    pause_click_flag = 0

    timer = 0

    last_selected_time = [4 * FPS, -3.5 * FPS, 4 * FPS, 4 * FPS, 4 * FPS, 4 * FPS, 4 * FPS]
    # last_selected_time = [-30 * FPS] * 7

    global moving_card_list
    moving_card_list = []

    selecting_flag = True

    speed_back = 380 / (1.5 * FPS)
    speed_cards_up = 87 / (0.2 * FPS)
    speed_cards_down = 513 / (0.2 * FPS)
    speed_pause_button = 46 / (0.2 * FPS)

    speed_cards_up_back = 10 / (1.5 * FPS)
    speed_shovel = 80 / (1.5 * FPS)

    global USEREVENT_COUNT

    SUN_FALL = pygame.USEREVENT + USEREVENT_COUNT
    USEREVENT_COUNT += 1

    pygame.time.set_timer(SUN_FALL, 3000)

    zombie_count = 0
    wave_count = 0

    huge_wave = 1e8
    final_wave = 1e8

    ZOMBIE_CRAETE = pygame.USEREVENT + USEREVENT_COUNT
    USEREVENT_COUNT += 1

    ZOMBIE_WAVE = pygame.USEREVENT + USEREVENT_COUNT
    USEREVENT_COUNT += 1

    for i in [4, 3, 2, 1, 0]:
        initpos = i * 20 - 160
        lawnmower = Lawnmower(initpos, i)
        lawnmower_list.append(lawnmower)

    global fail
    global win
    fail = False
    win = False

    global trophy
    trophy = None

    global GRASS
    GRASS = []

    global mode_num

    while True:
        clock.tick(FPS)
        # print(timer)
        # (0, 87) (22, 123) (75, 123)
        if selecting_flag:
            if timer == 0:
                load_music(2, -1)

            if timer <= 2 * FPS:
                set_background(2, POS)

            elif timer <= 3.5 * FPS:
                posx = POS[0] - speed_back * (timer - 2 * FPS)
                set_background(2, (posx, 0))

            elif timer <= 3.7 * FPS:
                posy_up = -87 + speed_cards_up * (timer - 3.5 * FPS)
                posy_down = 600 - speed_cards_down * (timer - 3.5 * FPS)
                posy_cards = 636 - speed_cards_down * (timer - 3.5 * FPS)
                posy_ready = 994 - speed_cards_down * (timer - 3.5 * FPS)
                posy_pause = PAUSE_BUTTON[0][1] - 46 + speed_pause_button * (timer - 3.5 * FPS)
                posy_text = -44 + speed_pause_button * (timer - 3.5 * FPS)

                set_sun(str(initsun), (0, posy_up))
                window.blit(IMAGE_Choose_seeds, (0, posy_down))

                window.blit(IMAGE_Ready_button[0], (76, posy_ready))
                show_text('开始战斗', 36, FONT_COLOR[4], (160, posy_down + 19))

                window.blit(IMAGE_Pause_button_left, (PAUSE_BUTTON[0][0], posy_pause))
                window.blit(IMAGE_Pause_button_middle, (PAUSE_BUTTON[1][0], posy_pause))
                window.blit(IMAGE_Pause_button_right, (PAUSE_BUTTON[2][0], posy_pause))
                show_text('菜单', 18, FONT_COLOR[0], (721, posy_text))

                card_pos = (22, posy_cards)
                for i in range(7):
                    set_cards(i, card_pos)
                    card_pos = (card_pos[0] + CARD_SIZE[0] + 2, posy_cards)

            else:
                set_background(2, (-380, 0))
                set_sun(str(initsun), (0, 0))
                window.blit(IMAGE_Choose_seeds, (0, 87))

                card_pos = (22, 123)
                for i in range(7):
                    if i not in card_list:
                        if not find_moving_card(i):
                            set_cards(i, card_pos)
                    card_pos = (card_pos[0] + CARD_SIZE[0] + 2, card_pos[1])

                card_pos = (80, 8)

                for i in range(len(card_list)):
                    if not find_moving_card(card_list[i]):
                        set_cards(card_list[i], card_pos)
                    card_pos = (card_pos[0] + CARD_SIZE[0], card_pos[1])

                for each in moving_card_list:
                    each.draw()
                    each.move()

                pos = pygame.mouse.get_pos()
                set_pause_button(pause_click_flag, pos)

                # print(pos)

                if len(card_list) < 7:
                    window.blit(IMAGE_Ready_button[0], (76, 481))
                    show_text('开始战斗', 36, FONT_COLOR[4], (160, 500))
                else:
                    window.blit(IMAGE_Ready_button[1], (76, 481))
                    if 80 <= pos[0] <= 383 and 486 <= pos[1] <= 552:
                        window.blit(IMAGE_Ready_button[2], (76, 481))
                    show_text('开始战斗', 36, FONT_COLOR[5], (160, 500))

                for event in pygame.event.get():
                    if event.type == pygame.QUIT:
                        pygame.quit()
                        exit()

                    elif event.type == pygame.MOUSEBUTTONDOWN:
                        if event.button == 1:

                            if on_pause(event.pos):
                                pause_click_flag = 2

                            card_pos = (22, 123)

                            if card_pos[1] <= event.pos[1] <= card_pos[1] + CARD_SIZE[1]:
                                if len(card_list) < 7:

                                    card_pos = (22, 123)

                                    for i in range(7):
                                        if i not in card_list:
                                            if card_pos[0] <= event.pos[0] <= card_pos[0] + CARD_SIZE[0] + 2:
                                                load_sound(6)

                                                endpos = (80 + len(card_list) * CARD_SIZE[0], 8)
                                                card_list.append(i)
                                                moving_card_list.append(MovingCard(card_image_list[i],
                                                                                   card_pos, endpos, i))
                                                break
                                        card_pos = (card_pos[0] + CARD_SIZE[0] + 2, card_pos[1])

                            if 80 <= event.pos[0] <= 383 and 486 <= event.pos[1] <= 552:
                                if len(card_list) == 7:
                                    load_sound(6)

                                    selecting_flag = False
                                    timer = 0
                                    continue

                            if 80 <= event.pos[0] <= 80 + len(card_list) * CARD_SIZE[0]:
                                if 8 <= event.pos[1] <= 8 + CARD_SIZE[1]:

                                    load_sound(6)

                                    removed_num = (event.pos[0] - 80) // CARD_SIZE[0]
                                    plant_removed = card_list[removed_num]

                                    card_pos = (80 + removed_num * CARD_SIZE[0], 8)
                                    endpos = (22 + plant_removed * (CARD_SIZE[0] + 2), 123)

                                    moving_card_list.append(MovingCard(card_image_list[plant_removed], card_pos,
                                                                       endpos, plant_removed))


                                    card_pos = (80 + (removed_num + 1) * CARD_SIZE[0], 8)
                                    endpos = (80 + removed_num * CARD_SIZE[0], 8)

                                    for i in range(removed_num + 1, len(card_list)):
                                        moving_card_list.append(MovingCard(card_image_list[card_list[i]],
                                                                           card_pos, endpos, card_list[i]))
                                        card_pos = (card_pos[0] + CARD_SIZE[0], 8)
                                        endpos = (endpos[0] + CARD_SIZE[0], 8)

                                    card_list.remove(plant_removed)
                                    # print(card_list)

                    elif event.type == pygame.MOUSEBUTTONUP:
                        if event.button == 1:
                            if pause_click_flag == 2:
                                if on_pause(event.pos):
                                    load_sound(17)
                                    load_sound(18)

                                    if not pause('choose'):

                                        mode_num = 1
                                        return
                                        # return False

                                pause_click_flag = 0

            for event in pygame.event.get():
                if event.type == pygame.QUIT:
                    pygame.quit()
                    exit()

            pygame.display.update()
            timer += 1
            continue


        if timer == 1:
            # pygame.mixer.music.stop()
            pygame.mixer.music.fadeout(1500)
        if timer == 1.5 * FPS:
            load_sound(31)

        if timer == 4 * FPS:

            load_music(1, -1)


        if timer <= 1.5 * FPS:
            posx = -380 + speed_back * timer
            set_background(2, (posx, 0))
        else:

            set_background(1)

            for each in lawnmower_list:
                each.draw()
                each.move()

        if timer <= 0.2 * FPS:

            posy_down = 87 + speed_cards_down * timer
            posy_cards = 123 + speed_cards_down * timer
            posy_ready = 481 + speed_cards_down * timer

            window.blit(IMAGE_Choose_seeds, (0, posy_down))

            window.blit(IMAGE_Ready_button[0], (76, posy_ready))
            show_text('开始战斗', 36, FONT_COLOR[4], (160, posy_ready + 19))

            card_pos = (22, posy_cards)
            for i in range(7):
                if i not in card_list:
                    set_cards(i, card_pos)
                card_pos = (card_pos[0] + CARD_SIZE[0] + 2, posy_cards)

        if timer <= 1.5 * FPS:

            posx_up = speed_cards_up_back * timer
            posy_shovel = -80 + speed_shovel * timer

            set_sun(str(initsun), (posx_up, 0))
            set_shovel((GRASS_POS[0] + 7 * GRASS_SIZE[0], posy_shovel))
            window.blit(IMAGE_Shovel, (GRASS_POS[0] + 7 * GRASS_SIZE[0], posy_shovel))

            card_pos = (posx_up + 80, 8)

            # print(card_list)

            for i in card_list:
                set_cards(i, card_pos)
                temp_alpha = pygame.Surface(CARD_SIZE)
                temp_alpha.fill((0, 0, 0))
                temp_alpha.set_alpha(int(100 * timer / (1.5 * FPS)))
                window.blit(temp_alpha, card_pos)
                card_pos = (card_pos[0] + CARD_SIZE[0], card_pos[1])

            pygame.display.update()

        elif timer <= 4 * FPS:
            set_sun(str(initsun), SUN_POS)
            set_shovel((GRASS_POS[0] + 7 * GRASS_SIZE[0], 0))
            window.blit(IMAGE_Shovel, (GRASS_POS[0] + 7 * GRASS_SIZE[0], 0))

            card_pos = (90, 8)

            for i in card_list:
                set_cards(i, card_pos)
                temp_alpha = pygame.Surface(CARD_SIZE)
                temp_alpha.fill((0, 0, 0))
                temp_alpha.set_alpha(100)
                window.blit(temp_alpha, card_pos)
                card_pos = (card_pos[0] + CARD_SIZE[0], card_pos[1])

            if 1.5 * FPS <= timer <= 2 * FPS:
                image_size = (int(28.8 + 1.92 * (timer - 1.5 * FPS)), int(11.55 + 0.77 * (timer - 1.5 * FPS)))
                ready_image = pygame.transform.scale(IMAGE_Start_planting[0], image_size)
                window.blit(ready_image, ((WINDOW_WIDTH - image_size[0]) / 2, (WINDOW_HEIGHT - image_size[1]) / 2))

            elif 2 * FPS < timer <= 2.5 * FPS:
                image_size = (int(24.45 + 1.63 * (timer - 2 * FPS)), int(14.4 + 0.96 * (timer - 2 * FPS)))
                set_image = pygame.transform.scale(IMAGE_Start_planting[1], image_size)
                window.blit(set_image, ((WINDOW_WIDTH - image_size[0]) / 2, (WINDOW_HEIGHT - image_size[1]) / 2))

            elif timer <= 3.5 * FPS:
                window.blit(IMAGE_Start_planting[2], (295, 251))

            pygame.display.update()
            if timer == 4 * FPS:
                pygame.time.set_timer(ZOMBIE_CRAETE, 5000)  # zombie_create_time()
                pygame.time.set_timer(ZOMBIE_WAVE, 60000)

        else:

            set_sun(str(initsun))

            set_shovel()

            flagmeter.draw()

            card_pos = CARD_POS
            for i in card_list:
                if initsun < SUN_COST[i]:
                    set_cards(i, card_pos, 'alpha')
                else:
                    set_cards(i, card_pos)
                set_frozen_time(i, last_selected_time[i], timer, card_pos)
                card_pos = (card_pos[0] + CARD_SIZE[0], card_pos[1])

            for each in plant_list:
                if each.code == 0:
                    temp_bullet = each.draw_on_grass()
                    if temp_bullet is not None:
                        bullets.append(temp_bullet)
                elif each.code == 5:
                    temp_bullet = each.draw_on_grass()
                    if temp_bullet is not None:
                        bullets.append(temp_bullet)
                else:
                    each.draw_on_grass()

            for each in lawnmower_list:
                each.draw()
                each.move()

            temp_pos = pygame.mouse.get_pos()

            if not shovel_flag:
                window.blit(IMAGE_Shovel, (GRASS_POS[0] + 7 * GRASS_SIZE[0], 0))
            else:
                window.blit(IMAGE_Shovel, (temp_pos[0] - 40, temp_pos[1] - 40))

            for each in bullets:
                each.draw()
                each.move()

            for each in zombie_list:
                each.draw()

            for each in head_list:
                each.draw()
            for each in body_list:
                each.draw()

            for each in sun_falling:
                each.draw()
                each.fall()
            for each in sun_collecting:
                each.draw()
                each.move()

            if trophy is not None:
                trophy.draw()
                trophy.fall()

            if fail:
                fail_screen()
                return

            if timer >= final_wave:
                if timer == final_wave:
                    load_sound(32)

                    for i in range(10):
                        zombie_list.append(zombie_object(random.randint(0, 2)))

                if 0 <= final_wave - timer <= FPS:
                    image_size = (int(341 + 34.1 * (timer - final_wave)), int(80 + 8 * (timer - final_wave)))
                    final_image = pygame.transform.scale(IMAGE_Final_wave, image_size)
                    window.blit(final_image, ((WINDOW_WIDTH - image_size[0])/2, (WINDOW_HEIGHT - image_size[1])/2))
                elif 0 <= timer - final_wave <= FPS * 1.5:
                    image_size = (341, 80)
                    final_image = pygame.transform.scale(IMAGE_Final_wave, image_size)
                    window.blit(final_image, ((WINDOW_WIDTH - image_size[0]) / 2, (WINDOW_HEIGHT - image_size[1]) / 2))

            if timer >= huge_wave:

                if timer - huge_wave == 1:
                    load_sound(33)
                if timer - huge_wave == FPS:
                    load_sound(37)

                    for i in range(10):
                        zombie_list.append(zombie_object(random.randint(0, 2)))

                if 0 <= huge_wave - timer <= FPS:
                    image_size = (int(492 + 49.2 * (timer - huge_wave)), int(80 + 8 * (timer - huge_wave)))
                    wave_image = pygame.transform.scale(IMAGE_Huge_wave, image_size)
                    window.blit(wave_image,
                                ((WINDOW_WIDTH - image_size[0]) / 2, (WINDOW_HEIGHT - image_size[1]) / 2))
                elif 0 <= timer - huge_wave <= FPS * 1.5:
                    image_size = (492, 80)
                    wave_image = pygame.transform.scale(IMAGE_Huge_wave, image_size)
                    window.blit(wave_image,
                                ((WINDOW_WIDTH - image_size[0]) / 2, (WINDOW_HEIGHT - image_size[1]) / 2))
                elif timer - huge_wave > FPS * 1.5:
                    huge_wave = 1e8

            set_pause_button(pause_click_flag, temp_pos)

            if on_click and mouse_plant is not None:
                if on_grass(temp_pos) and can_grow(temp_pos):
                    alpha = plant_object(mouse_plant.code, False)
                    alpha.draw_alpha(temp_pos)
                temp_plant_size = PLANT_SIZE[mouse_plant.code]
                temp_pos = (temp_pos[0] - temp_plant_size[0] // 2, temp_pos[1] - temp_plant_size[1] // 2)
                mouse_plant.draw(temp_pos)

            pygame.display.update()

            for event in pygame.event.get():
                if event.type == pygame.QUIT:
                    pygame.quit()
                    exit()

                elif event.type == SUN_FALL:
                    sun_falling.append(Sun())

                elif event.type == ZOMBIE_CRAETE:
                    if zombie_count == 0:
                        load_sound(34)
                    if zombie_count < TOTAL_ZOMBIE:
                        zombie_list.append(zombie_object(random.randint(0, 2)))
                        zombie_count += 1
                    if zombie_count == TOTAL_ZOMBIE:
                        win = True

                elif event.type == ZOMBIE_WAVE:
                    wave_count += 1

                    huge_wave = timer + 1
                    if wave_count == 2:
                        final_wave = timer + 66 * FPS

                elif event.type == pygame.MOUSEBUTTONDOWN:
                    if event.button == 1:

                        card_flag = on_card(event.pos)
                        flag = on_sun(sun_falling, event.pos)

                        if on_pause(event.pos):
                            pause_click_flag = 2

                        elif flag is not None:
                            if not on_click and not shovel_flag:
                                temp_sun = SunCollecting((flag.posx, flag.posy))
                                sun_collecting.append(temp_sun)
                            initsun += Sun.sun_point

                        elif card_flag != -1:
                            if not on_click:
                                if initsun >= SUN_COST[card_list[card_flag]] and timer - last_selected_time[card_list[card_flag]] >= FROZEN_TIME[card_list[card_flag]] * FPS:
                                    load_sound(4)
                                    mouse_plant = plant_object(card_list[card_flag], False)
                                    on_click = True
                                else:
                                    load_sound(14)
                            else:
                                load_sound(6)
                                on_click = False
                                mouse_plant = None

                        elif on_shovel(event.pos):
                            if not on_click:
                                if shovel_flag:
                                    load_sound(6)
                                    shovel_flag = False
                                else:
                                    load_sound(5)
                                    shovel_flag = True

                        elif on_grass(event.pos):
                            if on_click:
                                if can_grow(event.pos):
                                    last_selected_time[mouse_plant.code] = timer
                                    plant_list.append(plant_object(mouse_plant.code, True, event.pos))
                                    GRASS.append(PlantedGrass(event.pos, mouse_plant.code))
                                    load_sound(0)
                                    on_click = False
                                    initsun -= SUN_COST[mouse_plant.code]
                            elif shovel_flag:
                                if exist_plant(event.pos):
                                    load_sound(0)
                                    shovel_flag = False

                            elif trophy is not None:
                                if trophy.posx + 5 < event.pos[0] < trophy.posx + 77 and trophy.posy + 54 < event.pos[1] < trophy.posy + 115:
                                    winscreen()
                                    if not start('adventure'):
                                        mode_num = 1
                                    return
                                    # print('win')

                elif event.type == pygame.MOUSEBUTTONUP:
                    if event.button == 1 and pause_click_flag == 2:
                        if on_pause(event.pos):
                            load_sound(17)
                            load_sound(18)


                            if not pause('adventure'):
                                mode_num = 1
                                return

                        pause_click_flag = 0

        timer += 1


BACK_BUTTON = (325, 520)


def help_screen():
    help_flag = True
    while help_flag:
        clock.tick(FPS)

        back_button = Button(BACK_BUTTON, IMAGE_Back_button_alpha)

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit()
                exit()

            if event.type == pygame.MOUSEBUTTONDOWN:
                if 325 <= event.pos[0] <= 480 and 520 <= event.pos[1] <= 562:
                    load_sound(13)
                    help_flag = False

        temp_pos = pygame.mouse.get_pos()
        window.blit(IMAGE_Help, POS)
        if 325 <= temp_pos[0] <= 480 and 520 <= temp_pos[1] <= 562:
            back_button.draw()

        pygame.display.update()


def choose_game(num):
    if num == 0:
        game()
    elif num == 1:
        imzombie()


def main():
    pygame.init()
    global clock
    clock = pygame.time.Clock()
    global mode_num
    mode_num = 0

    set_window('Python PVZ', WINDOW_SIZE)

    check_files()

    start()

    while True:
        choose_game(mode_num)


if __name__ == '__main__':
    main()

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204
  • 205
  • 206
  • 207
  • 208
  • 209
  • 210
  • 211
  • 212
  • 213
  • 214
  • 215
  • 216
  • 217
  • 218
  • 219
  • 220
  • 221
  • 222
  • 223
  • 224
  • 225
  • 226
  • 227
  • 228
  • 229
  • 230
  • 231
  • 232
  • 233
  • 234
  • 235
  • 236
  • 237
  • 238
  • 239
  • 240
  • 241
  • 242
  • 243
  • 244
  • 245
  • 246
  • 247
  • 248
  • 249
  • 250
  • 251
  • 252
  • 253
  • 254
  • 255
  • 256
  • 257
  • 258
  • 259
  • 260
  • 261
  • 262
  • 263
  • 264
  • 265
  • 266
  • 267
  • 268
  • 269
  • 270
  • 271
  • 272
  • 273
  • 274
  • 275
  • 276
  • 277
  • 278
  • 279
  • 280
  • 281
  • 282
  • 283
  • 284
  • 285
  • 286
  • 287
  • 288
  • 289
  • 290
  • 291
  • 292
  • 293
  • 294
  • 295
  • 296
  • 297
  • 298
  • 299
  • 300
  • 301
  • 302
  • 303
  • 304
  • 305
  • 306
  • 307
  • 308
  • 309
  • 310
  • 311
  • 312
  • 313
  • 314
  • 315
  • 316
  • 317
  • 318
  • 319
  • 320
  • 321
  • 322
  • 323
  • 324
  • 325
  • 326
  • 327
  • 328
  • 329
  • 330
  • 331
  • 332
  • 333
  • 334
  • 335
  • 336
  • 337
  • 338
  • 339
  • 340
  • 341
  • 342
  • 343
  • 344
  • 345
  • 346
  • 347
  • 348
  • 349
  • 350
  • 351
  • 352
  • 353
  • 354
  • 355
  • 356
  • 357
  • 358
  • 359
  • 360
  • 361
  • 362
  • 363
  • 364
  • 365
  • 366
  • 367
  • 368
  • 369
  • 370
  • 371
  • 372
  • 373
  • 374
  • 375
  • 376
  • 377
  • 378
  • 379
  • 380
  • 381
  • 382
  • 383
  • 384
  • 385
  • 386
  • 387
  • 388
  • 389
  • 390
  • 391
  • 392
  • 393
  • 394
  • 395
  • 396
  • 397
  • 398
  • 399
  • 400
  • 401
  • 402
  • 403
  • 404
  • 405
  • 406
  • 407
  • 408
  • 409
  • 410
  • 411
  • 412
  • 413
  • 414
  • 415
  • 416
  • 417
  • 418
  • 419
  • 420
  • 421
  • 422
  • 423
  • 424
  • 425
  • 426
  • 427
  • 428
  • 429
  • 430
  • 431
  • 432
  • 433
  • 434
  • 435
  • 436
  • 437
  • 438
  • 439
  • 440
  • 441
  • 442
  • 443
  • 444
  • 445
  • 446
  • 447
  • 448
  • 449
  • 450
  • 451
  • 452
  • 453
  • 454
  • 455
  • 456
  • 457
  • 458
  • 459
  • 460
  • 461
  • 462
  • 463
  • 464
  • 465
  • 466
  • 467
  • 468
  • 469
  • 470
  • 471
  • 472
  • 473
  • 474
  • 475
  • 476
  • 477
  • 478
  • 479
  • 480
  • 481
  • 482
  • 483
  • 484
  • 485
  • 486
  • 487
  • 488
  • 489
  • 490
  • 491
  • 492
  • 493
  • 494
  • 495
  • 496
  • 497
  • 498
  • 499
  • 500
  • 501
  • 502
  • 503
  • 504
  • 505
  • 506
  • 507
  • 508
  • 509
  • 510
  • 511
  • 512
  • 513
  • 514
  • 515
  • 516
  • 517
  • 518
  • 519
  • 520
  • 521
  • 522
  • 523
  • 524
  • 525
  • 526
  • 527
  • 528
  • 529
  • 530
  • 531
  • 532
  • 533
  • 534
  • 535
  • 536
  • 537
  • 538
  • 539
  • 540
  • 541
  • 542
  • 543
  • 544
  • 545
  • 546
  • 547
  • 548
  • 549
  • 550
  • 551
  • 552
  • 553
  • 554
  • 555
  • 556
  • 557
  • 558
  • 559
  • 560
  • 561
  • 562
  • 563
  • 564
  • 565
  • 566
  • 567
  • 568
  • 569
  • 570
  • 571
  • 572
  • 573
  • 574
  • 575
  • 576
  • 577
  • 578
  • 579
  • 580
  • 581
  • 582
  • 583
  • 584
  • 585
  • 586
  • 587
  • 588
  • 589
  • 590
  • 591
  • 592
  • 593
  • 594
  • 595
  • 596
  • 597
  • 598
  • 599
  • 600
  • 601
  • 602
  • 603
  • 604
  • 605
  • 606
  • 607
  • 608
  • 609
  • 610
  • 611
  • 612
  • 613
  • 614
  • 615
  • 616
  • 617
  • 618
  • 619
  • 620
  • 621
  • 622
  • 623
  • 624
  • 625
  • 626
  • 627
  • 628
  • 629
  • 630
  • 631
  • 632
  • 633
  • 634
  • 635
  • 636
  • 637
  • 638
  • 639
  • 640
  • 641
  • 642
  • 643
  • 644
  • 645
  • 646
  • 647
  • 648
  • 649
  • 650
  • 651
  • 652
  • 653
  • 654
  • 655
  • 656
  • 657
  • 658
  • 659
  • 660
  • 661
  • 662
  • 663
  • 664
  • 665
  • 666
  • 667
  • 668
  • 669
  • 670
  • 671
  • 672
  • 673
  • 674
  • 675
  • 676
  • 677
  • 678
  • 679
  • 680
  • 681
  • 682
  • 683
  • 684
  • 685
  • 686
  • 687
  • 688
  • 689
  • 690
  • 691
  • 692
  • 693
  • 694
  • 695
  • 696
  • 697
  • 698
  • 699
  • 700
  • 701
  • 702
  • 703
  • 704
  • 705
  • 706
  • 707
  • 708
  • 709
  • 710
  • 711
  • 712
  • 713
  • 714
  • 715
  • 716
  • 717
  • 718
  • 719
  • 720
  • 721
  • 722
  • 723
  • 724
  • 725
  • 726
  • 727
  • 728
  • 729
  • 730
  • 731
  • 732
  • 733
  • 734
  • 735
  • 736
  • 737
  • 738
  • 739
  • 740
  • 741
  • 742
  • 743
  • 744
  • 745
  • 746
  • 747
  • 748
  • 749
  • 750
  • 751
  • 752
  • 753
  • 754
  • 755
  • 756
  • 757
  • 758
  • 759
  • 760
  • 761
  • 762
  • 763
  • 764
  • 765
  • 766
  • 767
  • 768
  • 769
  • 770
  • 771
  • 772
  • 773
  • 774
  • 775
  • 776
  • 777
  • 778
  • 779
  • 780
  • 781
  • 782
  • 783
  • 784
  • 785
  • 786
  • 787
  • 788
  • 789
  • 790
  • 791
  • 792
  • 793
  • 794
  • 795
  • 796
  • 797
  • 798
  • 799
  • 800
  • 801
  • 802
  • 803
  • 804
  • 805
  • 806
  • 807
  • 808
  • 809
  • 810
  • 811
  • 812
  • 813
  • 814
  • 815
  • 816
  • 817
  • 818
  • 819
  • 820
  • 821
  • 822
  • 823
  • 824
  • 825
  • 826
  • 827
  • 828
  • 829
  • 830
  • 831
  • 832
  • 833
  • 834
  • 835
  • 836
  • 837
  • 838
  • 839
  • 840
  • 841
  • 842
  • 843
  • 844
  • 845
  • 846
  • 847
  • 848
  • 849
  • 850
  • 851
  • 852
  • 853
  • 854
  • 855
  • 856
  • 857
  • 858
  • 859
  • 860
  • 861
  • 862
  • 863
  • 864
  • 865
  • 866
  • 867
  • 868
  • 869
  • 870
  • 871
  • 872
  • 873
  • 874
  • 875
  • 876
  • 877
  • 878
  • 879
  • 880
  • 881
  • 882
  • 883
  • 884
  • 885
  • 886
  • 887
  • 888
  • 889
  • 890
  • 891
  • 892
  • 893
  • 894
  • 895
  • 896
  • 897
  • 898
  • 899
  • 900
  • 901
  • 902
  • 903
  • 904
  • 905
  • 906
  • 907
  • 908
  • 909
  • 910
  • 911
  • 912
  • 913
  • 914
  • 915
  • 916
  • 917
  • 918
  • 919
  • 920
  • 921
  • 922
  • 923
  • 924
  • 925
  • 926
  • 927
  • 928
  • 929
  • 930
  • 931
  • 932
  • 933
  • 934
  • 935
  • 936
  • 937
  • 938
  • 939
  • 940
  • 941
  • 942
  • 943
  • 944
  • 945
  • 946
  • 947
  • 948
  • 949
  • 950
  • 951
  • 952
  • 953
  • 954
  • 955
  • 956
  • 957
  • 958
  • 959
  • 960
  • 961
  • 962
  • 963
  • 964
  • 965
  • 966
  • 967
  • 968
  • 969
  • 970
  • 971
  • 972
  • 973
  • 974
  • 975
  • 976
  • 977
  • 978
  • 979
  • 980
  • 981
  • 982
  • 983
  • 984
  • 985
  • 986
  • 987
  • 988
  • 989
  • 990
  • 991
  • 992
  • 993
  • 994
  • 995
  • 996
  • 997
  • 998
  • 999
  • 1000
  • 1001
  • 1002
  • 1003
  • 1004
  • 1005
  • 1006
  • 1007
  • 1008
  • 1009
  • 1010
  • 1011
  • 1012
  • 1013
  • 1014
  • 1015
  • 1016
  • 1017
  • 1018
  • 1019
  • 1020
  • 1021
  • 1022
  • 1023
  • 1024
  • 1025
  • 1026
  • 1027
  • 1028
  • 1029
  • 1030
  • 1031
  • 1032
  • 1033
  • 1034
  • 1035
  • 1036
  • 1037
  • 1038
  • 1039
  • 1040
  • 1041
  • 1042
  • 1043
  • 1044
  • 1045
  • 1046
  • 1047
  • 1048
  • 1049
  • 1050
  • 1051
  • 1052
  • 1053
  • 1054
  • 1055
  • 1056
  • 1057
  • 1058
  • 1059
  • 1060
  • 1061
  • 1062
  • 1063
  • 1064
  • 1065
  • 1066
  • 1067
  • 1068
  • 1069
  • 1070
  • 1071
  • 1072
  • 1073
  • 1074
  • 1075
  • 1076
  • 1077
  • 1078
  • 1079
  • 1080
  • 1081
  • 1082
  • 1083
  • 1084
  • 1085
  • 1086
  • 1087
  • 1088
  • 1089
  • 1090
  • 1091
  • 1092
  • 1093
  • 1094
  • 1095
  • 1096
  • 1097
  • 1098
  • 1099
  • 1100
  • 1101
  • 1102
  • 1103
  • 1104
  • 1105
  • 1106
  • 1107
  • 1108
  • 1109
  • 1110
  • 1111
  • 1112
  • 1113
  • 1114
  • 1115
  • 1116
  • 1117
  • 1118
  • 1119
  • 1120
  • 1121
  • 1122
  • 1123
  • 1124
  • 1125
  • 1126
  • 1127
  • 1128
  • 1129
  • 1130
  • 1131
  • 1132
  • 1133
  • 1134
  • 1135
  • 1136
  • 1137
  • 1138
  • 1139
  • 1140
  • 1141
  • 1142
  • 1143
  • 1144
  • 1145
  • 1146
  • 1147
  • 1148
  • 1149
  • 1150
  • 1151
  • 1152
  • 1153
  • 1154
  • 1155
  • 1156
  • 1157
  • 1158
  • 1159
  • 1160
  • 1161
  • 1162
  • 1163
  • 1164
  • 1165
  • 1166
  • 1167
  • 1168
  • 1169
  • 1170
  • 1171
  • 1172
  • 1173
  • 1174
  • 1175
  • 1176
  • 1177
  • 1178
  • 1179
  • 1180
  • 1181
  • 1182
  • 1183
  • 1184
  • 1185
  • 1186
  • 1187
  • 1188
  • 1189
  • 1190
  • 1191
  • 1192
  • 1193
  • 1194
  • 1195
  • 1196
  • 1197
  • 1198
  • 1199
  • 1200
  • 1201
  • 1202
  • 1203
  • 1204
  • 1205
  • 1206
  • 1207
  • 1208
  • 1209
  • 1210
  • 1211
  • 1212
  • 1213
  • 1214
  • 1215
  • 1216
  • 1217
  • 1218
  • 1219
  • 1220
  • 1221
  • 1222
  • 1223
  • 1224
  • 1225
  • 1226
  • 1227
  • 1228
  • 1229
  • 1230
  • 1231
  • 1232
  • 1233
  • 1234
  • 1235
  • 1236
  • 1237
  • 1238
  • 1239
  • 1240
  • 1241
  • 1242
  • 1243
  • 1244
  • 1245
  • 1246
  • 1247
  • 1248
  • 1249
  • 1250
  • 1251
  • 1252
  • 1253
  • 1254
  • 1255
  • 1256
  • 1257
  • 1258
  • 1259
  • 1260
  • 1261
  • 1262
  • 1263
  • 1264
  • 1265
  • 1266
  • 1267
  • 1268
  • 1269
  • 1270
  • 1271
  • 1272
  • 1273
  • 1274
  • 1275
  • 1276
  • 1277
  • 1278
  • 1279
  • 1280
  • 1281
  • 1282
  • 1283
  • 1284
  • 1285
  • 1286
  • 1287
  • 1288
  • 1289
  • 1290
  • 1291
  • 1292
  • 1293
  • 1294
  • 1295
  • 1296
  • 1297
  • 1298
  • 1299
  • 1300
  • 1301
  • 1302
  • 1303
  • 1304
  • 1305
  • 1306
  • 1307
  • 1308
  • 1309
  • 1310
  • 1311
  • 1312
  • 1313
  • 1314
  • 1315
  • 1316
  • 1317
  • 1318
  • 1319
  • 1320
  • 1321
  • 1322
  • 1323
  • 1324
  • 1325
  • 1326
  • 1327
  • 1328
  • 1329
  • 1330
  • 1331
  • 1332
  • 1333
  • 1334
  • 1335
  • 1336
  • 1337
  • 1338
  • 1339
  • 1340
  • 1341
  • 1342
  • 1343
  • 1344
  • 1345
  • 1346
  • 1347
  • 1348
  • 1349
  • 1350
  • 1351
  • 1352
  • 1353
  • 1354
  • 1355
  • 1356
  • 1357
  • 1358
  • 1359
  • 1360
  • 1361
  • 1362
  • 1363
  • 1364
  • 1365
  • 1366
  • 1367
  • 1368
  • 1369
  • 1370
  • 1371
  • 1372
  • 1373
  • 1374
  • 1375
  • 1376
  • 1377
  • 1378
  • 1379
  • 1380
  • 1381
  • 1382
  • 1383
  • 1384
  • 1385
  • 1386
  • 1387
  • 1388
  • 1389
  • 1390
  • 1391
  • 1392
  • 1393
  • 1394
  • 1395
  • 1396
  • 1397
  • 1398
  • 1399
  • 1400
  • 1401
  • 1402
  • 1403
  • 1404
  • 1405
  • 1406
  • 1407
  • 1408
  • 1409
  • 1410
  • 1411
  • 1412
  • 1413
  • 1414
  • 1415
  • 1416
  • 1417
  • 1418
  • 1419
  • 1420
  • 1421
  • 1422
  • 1423
  • 1424
  • 1425
  • 1426
  • 1427
  • 1428
  • 1429
  • 1430
  • 1431
  • 1432
  • 1433
  • 1434
  • 1435
  • 1436
  • 1437
  • 1438
  • 1439
  • 1440
  • 1441
  • 1442
  • 1443
  • 1444
  • 1445
  • 1446
  • 1447
  • 1448
  • 1449
  • 1450
  • 1451
  • 1452
  • 1453
  • 1454
  • 1455
  • 1456
  • 1457
  • 1458
  • 1459
  • 1460
  • 1461
  • 1462
  • 1463
  • 1464
  • 1465
  • 1466
  • 1467
  • 1468
  • 1469
  • 1470
  • 1471
  • 1472
  • 1473
  • 1474
  • 1475
  • 1476
  • 1477
  • 1478
  • 1479
  • 1480
  • 1481
  • 1482
  • 1483
  • 1484
  • 1485
  • 1486
  • 1487
  • 1488
  • 1489
  • 1490
  • 1491
  • 1492
  • 1493
  • 1494
  • 1495
  • 1496
  • 1497
  • 1498
  • 1499
  • 1500
  • 1501
  • 1502
  • 1503
  • 1504
  • 1505
  • 1506
  • 1507
  • 1508
  • 1509
  • 1510
  • 1511
  • 1512
  • 1513
  • 1514
  • 1515
  • 1516
  • 1517
  • 1518
  • 1519
  • 1520
  • 1521
  • 1522
  • 1523
  • 1524
  • 1525
  • 1526
  • 1527
  • 1528
  • 1529
  • 1530
  • 1531
  • 1532
  • 1533
  • 1534
  • 1535
  • 1536
  • 1537
  • 1538
  • 1539
  • 1540
  • 1541
  • 1542
  • 1543
  • 1544
  • 1545
  • 1546
  • 1547
  • 1548
  • 1549
  • 1550
  • 1551
  • 1552
  • 1553
  • 1554
  • 1555
  • 1556
  • 1557
  • 1558
  • 1559
  • 1560
  • 1561
  • 1562
  • 1563
  • 1564
  • 1565
  • 1566
  • 1567
  • 1568
  • 1569
  • 1570
  • 1571
  • 1572
  • 1573
  • 1574
  • 1575
  • 1576
  • 1577
  • 1578
  • 1579
  • 1580
  • 1581
  • 1582
  • 1583
  • 1584
  • 1585
  • 1586
  • 1587
  • 1588
  • 1589
  • 1590
  • 1591
  • 1592
  • 1593
  • 1594
  • 1595
  • 1596
  • 1597
  • 1598
  • 1599
  • 1600
  • 1601
  • 1602
  • 1603
  • 1604
  • 1605
  • 1606
  • 1607
  • 1608
  • 1609
  • 1610
  • 1611
  • 1612
  • 1613
  • 1614
  • 1615
  • 1616
  • 1617
  • 1618
  • 1619
  • 1620
  • 1621
  • 1622
  • 1623
  • 1624
  • 1625
  • 1626
  • 1627
  • 1628
  • 1629
  • 1630
  • 1631
  • 1632
  • 1633
  • 1634
  • 1635
  • 1636
  • 1637
  • 1638
  • 1639
  • 1640
  • 1641
  • 1642
  • 1643
  • 1644
  • 1645
  • 1646
  • 1647
  • 1648
  • 1649
  • 1650
  • 1651
  • 1652
  • 1653
  • 1654
  • 1655
  • 1656
  • 1657
  • 1658
  • 1659
  • 1660
  • 1661
  • 1662
  • 1663
  • 1664
  • 1665
  • 1666
  • 1667
  • 1668
  • 1669
  • 1670
  • 1671
  • 1672
  • 1673
  • 1674
  • 1675
  • 1676
  • 1677
  • 1678
  • 1679
  • 1680
  • 1681
  • 1682
  • 1683
  • 1684
  • 1685
  • 1686
  • 1687
  • 1688
  • 1689
  • 1690
  • 1691
  • 1692
  • 1693
  • 1694
  • 1695
  • 1696
  • 1697
  • 1698
  • 1699
  • 1700
  • 1701
  • 1702
  • 1703
  • 1704
  • 1705
  • 1706
  • 1707
  • 1708
  • 1709
  • 1710
  • 1711
  • 1712
  • 1713
  • 1714
  • 1715
  • 1716
  • 1717
  • 1718
  • 1719
  • 1720
  • 1721
  • 1722
  • 1723
  • 1724
  • 1725
  • 1726
  • 1727
  • 1728
  • 1729
  • 1730
  • 1731
  • 1732
  • 1733
  • 1734
  • 1735
  • 1736
  • 1737
  • 1738
  • 1739
  • 1740
  • 1741
  • 1742
  • 1743
  • 1744
  • 1745
  • 1746
  • 1747
  • 1748
  • 1749
  • 1750
  • 1751
  • 1752
  • 1753
  • 1754
  • 1755
  • 1756
  • 1757
  • 1758
  • 1759
  • 1760
  • 1761
  • 1762
  • 1763
  • 1764
  • 1765
  • 1766
  • 1767
  • 1768
  • 1769
  • 1770
  • 1771
  • 1772
  • 1773
  • 1774
  • 1775
  • 1776
  • 1777
  • 1778
  • 1779
  • 1780
  • 1781
  • 1782
  • 1783
  • 1784
  • 1785
  • 1786
  • 1787
  • 1788
  • 1789
  • 1790
  • 1791
  • 1792
  • 1793
  • 1794
  • 1795
  • 1796
  • 1797
  • 1798
  • 1799
  • 1800
  • 1801
  • 1802
  • 1803
  • 1804
  • 1805
  • 1806
  • 1807
  • 1808
  • 1809
  • 1810
  • 1811
  • 1812
  • 1813
  • 1814
  • 1815
  • 1816
  • 1817
  • 1818
  • 1819
  • 1820
  • 1821
  • 1822
  • 1823
  • 1824
  • 1825
  • 1826
  • 1827
  • 1828
  • 1829
  • 1830
  • 1831
  • 1832
  • 1833
  • 1834
  • 1835
  • 1836
  • 1837
  • 1838
  • 1839
  • 1840
  • 1841
  • 1842
  • 1843
  • 1844
  • 1845
  • 1846
  • 1847
  • 1848
  • 1849
  • 1850
  • 1851
  • 1852
  • 1853
  • 1854
  • 1855
  • 1856
  • 1857
  • 1858
  • 1859
  • 1860
  • 1861
  • 1862
  • 1863
  • 1864
  • 1865
  • 1866
  • 1867
  • 1868
  • 1869
  • 1870
  • 1871
  • 1872
  • 1873
  • 1874
  • 1875
  • 1876
  • 1877
  • 1878
  • 1879
  • 1880
  • 1881
  • 1882
  • 1883
  • 1884
  • 1885
  • 1886
  • 1887
  • 1888
  • 1889
  • 1890
  • 1891
  • 1892
  • 1893
  • 1894
  • 1895
  • 1896
  • 1897
  • 1898
  • 1899
  • 1900
  • 1901
  • 1902
  • 1903
  • 1904
  • 1905
  • 1906
  • 1907
  • 1908
  • 1909
  • 1910
  • 1911
  • 1912
  • 1913
  • 1914
  • 1915
  • 1916
  • 1917
  • 1918
  • 1919
  • 1920
  • 1921
  • 1922
  • 1923
  • 1924
  • 1925
  • 1926
  • 1927
  • 1928
  • 1929
  • 1930
  • 1931
  • 1932
  • 1933
  • 1934
  • 1935
  • 1936
  • 1937
  • 1938
  • 1939
  • 1940
  • 1941
  • 1942
  • 1943
  • 1944
  • 1945
  • 1946
  • 1947
  • 1948
  • 1949
  • 1950
  • 1951
  • 1952
  • 1953
  • 1954
  • 1955
  • 1956
  • 1957
  • 1958
  • 1959
  • 1960
  • 1961
  • 1962
  • 1963
  • 1964
  • 1965
  • 1966
  • 1967
  • 1968
  • 1969
  • 1970
  • 1971
  • 1972
  • 1973
  • 1974
  • 1975
  • 1976
  • 1977
  • 1978
  • 1979
  • 1980
  • 1981
  • 1982
  • 1983
  • 1984
  • 1985
  • 1986
  • 1987
  • 1988
  • 1989
  • 1990
  • 1991
  • 1992
  • 1993
  • 1994
  • 1995
  • 1996
  • 1997
  • 1998
  • 1999
  • 2000
  • 2001
  • 2002
  • 2003
  • 2004
  • 2005
  • 2006
  • 2007
  • 2008
  • 2009
  • 2010
  • 2011
  • 2012
  • 2013
  • 2014
  • 2015
  • 2016
  • 2017
  • 2018
  • 2019
  • 2020
  • 2021
  • 2022
  • 2023
  • 2024
  • 2025
  • 2026
  • 2027
  • 2028
  • 2029
  • 2030
  • 2031
  • 2032
  • 2033
  • 2034
  • 2035
  • 2036
  • 2037
  • 2038
  • 2039
  • 2040
  • 2041
  • 2042
  • 2043
  • 2044
  • 2045
  • 2046
  • 2047
  • 2048
  • 2049
  • 2050
  • 2051
  • 2052
  • 2053
  • 2054
  • 2055
  • 2056
  • 2057
  • 2058
  • 2059
  • 2060
  • 2061
  • 2062
  • 2063
  • 2064
  • 2065
  • 2066
  • 2067
  • 2068
  • 2069
  • 2070
  • 2071
  • 2072
  • 2073
  • 2074
  • 2075
  • 2076
  • 2077
  • 2078
  • 2079
  • 2080
  • 2081
  • 2082
  • 2083
  • 2084
  • 2085
  • 2086
  • 2087
  • 2088
  • 2089
  • 2090
  • 2091
  • 2092
  • 2093
  • 2094
  • 2095
  • 2096
  • 2097
  • 2098
  • 2099
  • 2100
  • 2101
  • 2102
  • 2103
  • 2104
  • 2105
  • 2106
  • 2107
  • 2108
  • 2109
  • 2110
  • 2111
  • 2112
  • 2113
  • 2114
  • 2115
  • 2116
  • 2117
  • 2118
  • 2119
  • 2120
  • 2121
  • 2122
  • 2123
  • 2124
  • 2125
  • 2126
  • 2127
  • 2128
  • 2129
  • 2130
  • 2131
  • 2132
  • 2133
  • 2134
  • 2135
  • 2136
  • 2137
  • 2138
  • 2139
  • 2140
  • 2141
  • 2142
  • 2143
  • 2144
  • 2145
  • 2146
  • 2147
  • 2148
  • 2149
  • 2150
  • 2151
  • 2152
  • 2153
  • 2154
  • 2155
  • 2156
  • 2157
  • 2158
  • 2159
  • 2160
  • 2161
  • 2162
  • 2163
  • 2164
  • 2165
  • 2166
  • 2167
  • 2168
  • 2169
  • 2170
  • 2171
  • 2172
  • 2173
  • 2174
  • 2175
  • 2176
  • 2177
  • 2178
  • 2179
  • 2180
  • 2181
  • 2182
  • 2183
  • 2184
  • 2185
  • 2186
  • 2187
  • 2188
  • 2189
  • 2190
  • 2191
  • 2192
  • 2193
  • 2194
  • 2195
  • 2196
  • 2197
  • 2198
  • 2199
  • 2200
  • 2201
  • 2202
  • 2203
  • 2204
  • 2205
  • 2206
  • 2207
  • 2208
  • 2209
  • 2210
  • 2211
  • 2212
  • 2213
  • 2214
  • 2215
  • 2216
  • 2217
  • 2218
  • 2219
  • 2220
  • 2221
  • 2222
  • 2223
  • 2224
  • 2225
  • 2226
  • 2227
  • 2228
  • 2229
  • 2230
  • 2231
  • 2232
  • 2233
  • 2234
  • 2235
  • 2236
  • 2237
  • 2238
  • 2239
  • 2240
  • 2241
  • 2242
  • 2243
  • 2244
  • 2245
  • 2246
  • 2247
  • 2248
  • 2249
  • 2250
  • 2251
  • 2252
  • 2253
  • 2254
  • 2255
  • 2256
  • 2257
  • 2258
  • 2259
  • 2260
  • 2261
  • 2262
  • 2263
  • 2264
  • 2265
  • 2266
  • 2267
  • 2268
  • 2269
  • 2270
  • 2271
  • 2272
  • 2273
  • 2274
  • 2275
  • 2276
  • 2277
  • 2278
  • 2279
  • 2280
  • 2281
  • 2282
  • 2283
  • 2284
  • 2285
  • 2286
  • 2287
  • 2288
  • 2289
  • 2290
  • 2291
  • 2292
  • 2293
  • 2294
  • 2295
  • 2296
  • 2297
  • 2298
  • 2299
  • 2300
  • 2301
  • 2302
  • 2303
  • 2304
  • 2305
  • 2306
  • 2307
  • 2308
  • 2309
  • 2310
  • 2311
  • 2312
  • 2313
  • 2314
  • 2315
  • 2316
  • 2317
  • 2318
  • 2319
  • 2320
  • 2321
  • 2322
  • 2323
  • 2324
  • 2325
  • 2326
  • 2327
  • 2328
  • 2329
  • 2330
  • 2331
  • 2332
  • 2333
  • 2334
  • 2335
  • 2336
  • 2337
  • 2338
  • 2339
  • 2340
  • 2341
  • 2342
  • 2343
  • 2344
  • 2345
  • 2346
  • 2347
  • 2348
  • 2349
  • 2350
  • 2351
  • 2352
  • 2353
  • 2354
  • 2355
  • 2356
  • 2357
  • 2358
  • 2359
  • 2360
  • 2361
  • 2362
  • 2363
  • 2364
  • 2365
  • 2366
  • 2367
  • 2368
  • 2369
  • 2370
  • 2371
  • 2372
  • 2373
  • 2374
  • 2375
  • 2376
  • 2377
  • 2378
  • 2379
  • 2380
  • 2381
  • 2382
  • 2383
  • 2384
  • 2385
  • 2386
  • 2387
  • 2388
  • 2389
  • 2390
  • 2391
  • 2392
  • 2393
  • 2394
  • 2395
  • 2396
  • 2397
  • 2398
  • 2399
  • 2400
  • 2401
  • 2402
  • 2403
  • 2404
  • 2405
  • 2406
  • 2407
  • 2408
  • 2409
  • 2410
  • 2411
  • 2412
  • 2413
  • 2414
  • 2415
  • 2416
  • 2417
  • 2418
  • 2419
  • 2420
  • 2421
  • 2422
  • 2423
  • 2424
  • 2425
  • 2426
  • 2427
  • 2428
  • 2429
  • 2430
  • 2431
  • 2432
  • 2433
  • 2434
  • 2435
  • 2436
  • 2437
  • 2438
  • 2439
  • 2440
  • 2441
  • 2442
  • 2443
  • 2444
  • 2445
  • 2446
  • 2447
  • 2448
  • 2449
  • 2450
  • 2451
  • 2452
  • 2453
  • 2454
  • 2455
  • 2456
  • 2457
  • 2458
  • 2459
  • 2460
  • 2461
  • 2462
  • 2463
  • 2464
  • 2465
  • 2466
  • 2467
  • 2468
  • 2469
  • 2470
  • 2471
  • 2472
  • 2473
  • 2474
  • 2475
  • 2476
  • 2477
  • 2478
  • 2479
  • 2480
  • 2481
  • 2482
  • 2483
  • 2484
  • 2485
  • 2486
  • 2487
  • 2488
  • 2489
  • 2490
  • 2491
  • 2492
  • 2493
  • 2494
  • 2495
  • 2496
  • 2497
  • 2498
  • 2499
  • 2500
  • 2501
  • 2502
  • 2503
  • 2504
  • 2505
  • 2506
  • 2507
  • 2508
  • 2509
  • 2510
  • 2511
  • 2512
  • 2513
  • 2514
  • 2515
  • 2516
  • 2517
  • 2518
  • 2519
  • 2520
  • 2521
  • 2522
  • 2523
  • 2524
  • 2525
  • 2526
  • 2527
  • 2528
  • 2529
  • 2530
  • 2531
  • 2532
  • 2533
  • 2534
  • 2535
  • 2536
  • 2537
  • 2538
  • 2539
  • 2540
  • 2541
  • 2542
  • 2543
  • 2544
  • 2545
  • 2546
  • 2547
  • 2548
  • 2549
  • 2550
  • 2551
  • 2552
  • 2553
  • 2554
  • 2555
  • 2556
  • 2557
  • 2558
  • 2559
  • 2560
  • 2561
  • 2562
  • 2563
  • 2564
  • 2565
  • 2566
  • 2567
  • 2568
  • 2569
  • 2570
  • 2571
  • 2572
  • 2573
  • 2574
  • 2575
  • 2576
  • 2577
  • 2578
  • 2579
  • 2580
  • 2581
  • 2582
  • 2583
  • 2584
  • 2585
  • 2586
  • 2587
  • 2588
  • 2589
  • 2590
  • 2591
  • 2592
  • 2593
  • 2594
  • 2595
  • 2596
  • 2597
  • 2598
  • 2599
  • 2600
  • 2601
  • 2602
  • 2603
  • 2604
  • 2605
  • 2606
  • 2607
  • 2608
  • 2609
  • 2610
  • 2611
  • 2612
  • 2613
  • 2614
  • 2615
  • 2616
  • 2617
  • 2618
  • 2619
  • 2620
  • 2621
  • 2622
  • 2623
  • 2624
  • 2625
  • 2626
  • 2627
  • 2628
  • 2629
  • 2630
  • 2631
  • 2632
  • 2633
  • 2634
  • 2635
  • 2636
  • 2637
  • 2638
  • 2639
  • 2640
  • 2641
  • 2642
  • 2643
  • 2644
  • 2645
  • 2646
  • 2647
  • 2648
  • 2649
  • 2650
  • 2651
  • 2652
  • 2653
  • 2654
  • 2655
  • 2656
  • 2657
  • 2658
  • 2659
  • 2660
  • 2661
  • 2662
  • 2663
  • 2664
  • 2665
  • 2666
  • 2667
  • 2668
  • 2669
  • 2670
  • 2671
  • 2672
  • 2673
  • 2674
  • 2675
  • 2676
  • 2677
  • 2678
  • 2679
  • 2680
  • 2681
  • 2682
  • 2683
  • 2684
  • 2685
  • 2686
  • 2687
  • 2688
  • 2689
  • 2690
  • 2691
  • 2692
  • 2693
  • 2694
  • 2695
  • 2696
  • 2697
  • 2698
  • 2699
  • 2700
  • 2701
  • 2702
  • 2703
  • 2704
  • 2705
  • 2706
  • 2707
  • 2708
  • 2709
  • 2710
  • 2711
  • 2712
  • 2713
  • 2714
  • 2715
  • 2716
  • 2717
  • 2718
  • 2719
  • 2720
  • 2721
  • 2722
  • 2723
  • 2724
  • 2725
  • 2726
  • 2727
  • 2728
  • 2729
  • 2730
  • 2731
  • 2732
  • 2733
  • 2734
  • 2735
  • 2736
  • 2737
  • 2738
  • 2739
  • 2740
  • 2741
  • 2742
  • 2743
  • 2744
  • 2745
  • 2746
  • 2747
  • 2748
  • 2749
  • 2750
  • 2751
  • 2752
  • 2753
  • 2754
  • 2755
  • 2756
  • 2757
  • 2758
  • 2759
  • 2760
  • 2761
  • 2762
  • 2763
  • 2764
  • 2765
  • 2766
  • 2767
  • 2768
  • 2769
  • 2770
  • 2771
  • 2772
  • 2773
  • 2774
  • 2775
  • 2776
  • 2777
  • 2778
  • 2779
  • 2780
  • 2781
  • 2782
  • 2783
  • 2784
  • 2785
  • 2786
  • 2787
  • 2788
  • 2789
  • 2790
  • 2791
  • 2792
  • 2793
  • 2794
  • 2795
  • 2796
  • 2797
  • 2798
  • 2799
  • 2800
  • 2801
  • 2802
  • 2803
  • 2804
  • 2805
  • 2806
  • 2807
  • 2808
  • 2809
  • 2810
  • 2811
  • 2812
  • 2813
  • 2814
  • 2815
  • 2816
  • 2817
  • 2818
  • 2819
  • 2820
  • 2821
  • 2822
  • 2823
  • 2824
  • 2825
  • 2826
  • 2827
  • 2828
  • 2829
  • 2830
  • 2831
  • 2832
  • 2833
  • 2834
  • 2835
  • 2836
  • 2837
  • 2838
  • 2839
  • 2840
  • 2841
  • 2842
  • 2843
  • 2844
  • 2845
  • 2846
  • 2847
  • 2848
  • 2849
  • 2850
  • 2851
  • 2852
  • 2853
  • 2854
  • 2855
  • 2856
  • 2857
  • 2858
  • 2859
  • 2860
  • 2861
  • 2862
  • 2863
  • 2864
  • 2865
  • 2866
  • 2867
  • 2868
  • 2869
  • 2870
  • 2871
  • 2872
  • 2873
  • 2874
  • 2875
  • 2876
  • 2877
  • 2878
  • 2879
  • 2880
  • 2881
  • 2882
  • 2883
  • 2884
  • 2885
  • 2886
  • 2887
  • 2888
  • 2889
  • 2890
  • 2891
  • 2892
  • 2893
  • 2894
  • 2895
  • 2896
  • 2897
  • 2898
  • 2899
  • 2900
  • 2901
  • 2902
  • 2903
  • 2904
  • 2905
  • 2906
  • 2907
  • 2908
  • 2909
  • 2910
  • 2911
  • 2912
  • 2913
  • 2914
  • 2915
  • 2916
  • 2917
  • 2918
  • 2919
  • 2920
  • 2921
  • 2922
  • 2923
  • 2924
  • 2925
  • 2926
  • 2927
  • 2928
  • 2929
  • 2930
  • 2931
  • 2932
  • 2933
  • 2934
  • 2935
  • 2936
  • 2937
  • 2938
  • 2939
  • 2940
  • 2941
  • 2942
  • 2943
  • 2944
  • 2945
  • 2946
  • 2947
  • 2948
  • 2949
  • 2950
  • 2951
  • 2952
  • 2953
  • 2954
  • 2955
  • 2956
  • 2957
  • 2958
  • 2959
  • 2960
  • 2961
  • 2962
  • 2963
  • 2964
  • 2965
  • 2966
  • 2967
  • 2968
  • 2969
  • 2970
  • 2971
  • 2972
  • 2973
  • 2974
  • 2975
  • 2976
  • 2977
  • 2978
  • 2979
  • 2980
  • 2981
  • 2982
  • 2983
  • 2984
  • 2985
  • 2986
  • 2987
  • 2988
  • 2989
  • 2990
  • 2991
  • 2992
  • 2993
  • 2994
  • 2995
  • 2996
  • 2997
  • 2998
  • 2999
  • 3000
  • 3001
  • 3002
  • 3003
  • 3004
  • 3005
  • 3006
  • 3007
  • 3008
  • 3009
  • 3010
  • 3011
  • 3012
  • 3013
  • 3014
  • 3015
  • 3016
  • 3017
  • 3018
  • 3019
  • 3020
  • 3021
  • 3022
  • 3023
  • 3024
  • 3025
  • 3026
  • 3027
  • 3028
  • 3029
  • 3030
  • 3031
  • 3032
  • 3033
  • 3034
  • 3035
  • 3036
  • 3037
  • 3038
  • 3039
  • 3040
  • 3041
  • 3042
  • 3043
  • 3044
  • 3045
  • 3046
  • 3047
  • 3048
  • 3049
  • 3050
  • 3051
  • 3052
  • 3053
  • 3054
  • 3055
  • 3056
  • 3057
  • 3058
  • 3059
  • 3060
  • 3061
  • 3062
  • 3063
  • 3064
  • 3065
  • 3066
  • 3067
  • 3068
  • 3069
  • 3070
  • 3071
  • 3072
  • 3073
  • 3074
  • 3075
  • 3076
  • 3077
  • 3078
  • 3079
  • 3080
  • 3081
  • 3082
  • 3083
  • 3084
  • 3085
  • 3086
  • 3087
  • 3088
  • 3089
  • 3090
  • 3091
  • 3092
  • 3093
  • 3094
  • 3095
  • 3096
  • 3097
  • 3098
  • 3099
  • 3100
  • 3101
  • 3102
  • 3103
  • 3104
  • 3105
  • 3106
  • 3107
  • 3108
  • 3109
  • 3110
  • 3111
  • 3112
  • 3113
  • 3114
  • 3115
  • 3116
  • 3117
  • 3118
  • 3119
  • 3120
  • 3121
  • 3122
  • 3123
  • 3124
  • 3125
  • 3126
  • 3127
  • 3128
  • 3129
  • 3130
  • 3131
  • 3132
  • 3133
  • 3134
  • 3135
  • 3136
  • 3137
  • 3138
  • 3139
  • 3140
  • 3141
  • 3142
  • 3143
  • 3144
  • 3145
  • 3146
  • 3147
  • 3148
  • 3149
  • 3150
  • 3151
  • 3152
  • 3153
  • 3154
  • 3155
  • 3156
  • 3157
  • 3158
  • 3159
  • 3160
  • 3161
  • 3162
  • 3163
  • 3164
  • 3165
  • 3166
  • 3167
  • 3168
  • 3169
  • 3170
  • 3171
  • 3172
  • 3173
  • 3174
  • 3175
  • 3176
  • 3177
  • 3178
  • 3179
  • 3180
  • 3181
  • 3182
  • 3183
  • 3184
  • 3185
  • 3186
  • 3187
  • 3188
  • 3189
  • 3190
  • 3191
  • 3192
  • 3193
  • 3194
  • 3195
  • 3196
  • 3197
  • 3198
  • 3199
  • 3200
  • 3201
  • 3202
  • 3203
  • 3204
  • 3205
  • 3206
  • 3207
  • 3208
  • 3209
  • 3210
  • 3211
  • 3212
  • 3213
  • 3214
  • 3215
  • 3216
  • 3217
  • 3218
  • 3219
  • 3220
  • 3221
  • 3222
  • 3223
  • 3224
  • 3225
  • 3226
  • 3227
  • 3228
  • 3229
  • 3230
  • 3231
  • 3232
  • 3233
  • 3234
  • 3235
  • 3236
  • 3237
  • 3238
  • 3239
  • 3240
  • 3241
  • 3242
  • 3243
  • 3244
  • 3245
  • 3246
  • 3247
  • 3248
  • 3249
  • 3250
  • 3251
  • 3252
  • 3253
  • 3254
  • 3255
  • 3256
  • 3257
  • 3258
  • 3259
  • 3260
  • 3261
  • 3262
  • 3263
  • 3264
  • 3265
  • 3266
  • 3267
  • 3268
  • 3269
  • 3270
  • 3271
  • 3272
  • 3273
  • 3274
  • 3275
  • 3276
  • 3277
  • 3278
  • 3279
  • 3280
  • 3281
  • 3282
  • 3283
  • 3284
  • 3285
  • 3286
  • 3287
  • 3288
  • 3289
  • 3290
  • 3291
  • 3292
  • 3293
  • 3294
  • 3295
  • 3296
  • 3297
  • 3298
  • 3299
  • 3300
  • 3301
  • 3302
  • 3303
  • 3304
  • 3305
  • 3306
  • 3307
  • 3308
  • 3309
  • 3310
  • 3311
  • 3312
  • 3313
  • 3314
  • 3315
  • 3316
  • 3317
  • 3318
  • 3319
  • 3320
  • 3321
  • 3322
  • 3323
  • 3324
  • 3325
  • 3326
  • 3327
  • 3328
  • 3329
  • 3330
  • 3331
  • 3332
  • 3333
  • 3334
  • 3335
  • 3336
  • 3337
  • 3338
  • 3339
  • 3340
  • 3341
  • 3342
  • 3343
  • 3344
  • 3345
  • 3346
  • 3347
  • 3348
  • 3349
  • 3350
  • 3351
  • 3352
  • 3353
  • 3354
  • 3355
  • 3356
  • 3357
  • 3358
  • 3359
  • 3360
  • 3361
  • 3362
  • 3363
  • 3364
  • 3365
  • 3366
  • 3367
  • 3368
  • 3369
  • 3370
  • 3371
  • 3372
  • 3373
  • 3374
  • 3375
  • 3376
  • 3377
  • 3378
  • 3379
  • 3380
  • 3381
  • 3382
  • 3383
  • 3384
  • 3385
  • 3386
  • 3387
  • 3388
  • 3389
  • 3390
  • 3391
  • 3392
  • 3393
  • 3394
  • 3395
  • 3396
  • 3397
  • 3398
  • 3399
  • 3400
  • 3401
  • 3402
  • 3403
  • 3404
  • 3405
  • 3406
  • 3407
  • 3408
  • 3409
  • 3410
  • 3411
  • 3412
  • 3413
  • 3414
  • 3415
  • 3416
  • 3417
  • 3418
  • 3419
  • 3420
  • 3421
  • 3422
  • 3423
  • 3424
  • 3425
  • 3426
  • 3427
  • 3428
  • 3429
  • 3430
  • 3431
  • 3432
  • 3433
  • 3434
  • 3435
  • 3436
  • 3437
  • 3438
  • 3439
  • 3440
  • 3441
  • 3442
  • 3443
  • 3444
  • 3445
  • 3446
  • 3447
  • 3448
  • 3449
  • 3450
  • 3451
  • 3452
  • 3453
  • 3454
  • 3455
  • 3456
  • 3457
  • 3458
  • 3459
  • 3460
  • 3461
  • 3462
  • 3463
  • 3464
  • 3465
  • 3466
  • 3467
  • 3468
  • 3469
  • 3470
  • 3471
  • 3472
  • 3473
  • 3474
  • 3475
  • 3476
  • 3477
  • 3478
  • 3479
  • 3480
  • 3481
  • 3482
  • 3483
  • 3484
  • 3485
  • 3486
  • 3487
  • 3488
  • 3489
  • 3490
  • 3491
  • 3492
  • 3493
  • 3494
  • 3495
  • 3496
  • 3497
  • 3498
  • 3499
  • 3500
  • 3501
  • 3502
  • 3503
  • 3504
  • 3505
  • 3506
  • 3507
  • 3508
  • 3509
  • 3510
  • 3511
  • 3512
  • 3513
  • 3514
  • 3515
  • 3516
  • 3517
  • 3518
  • 3519
  • 3520
  • 3521
  • 3522
  • 3523
  • 3524
  • 3525
  • 3526
  • 3527
  • 3528
  • 3529
  • 3530
本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/Cpp五条/article/detail/413840
推荐阅读
相关标签
  

闽ICP备14008679号