Ejemplo n.º 1
0
    def __init__(self, killcount, score, level):
        State.__init__(self)
        self.next = StartMenu()
        self.screen = pygame.display.get_surface()

        alpha_bg = self.screen.copy()
        alpha_bg.set_alpha(99)
        self.bg = pygame.Surface((800, 600))
        self.bg.fill((0, 0, 0))
        self.bg.blit(alpha_bg, (0, 0))

        img = data.load_image("gameover.png")
        pos = utils.center(img.get_size(), (800, 600))
        self.bg.blit(img, pos)
        img = TextLine("You killed " + str(killcount) + " zombies.", 30)
        pos = utils.center(img.get_size(), (800, 600))
        self.bg.blit(img, (pos[0], 325))

        scorelist = HIGHSCORE.keys()
        scorelist.sort()
        for s in scorelist:
            if score > s:
                self.next = EnterHighscore(score, level)
                break

        self.update_scr = True
Ejemplo n.º 2
0
 def __init__(self):
     State.__init__(self)
     self.next = StartScreen()
     self.screen.fill((40, 40, 40))
     self.image = pygame.image.load("img/gamequit/gameover.png")
     self.image = pygame.transform.scale(self.image, self.screen.get_size())
     self.image_pos = center(self.image.get_size(), self.screen.get_size())
Ejemplo n.º 3
0
 def __init__(self):
     State.__init__(self)
     self.next = StartScreen()
     self.screen.fill((40,40,40))
     self.image = pygame.image.load("img/gamequit/gameover.png")
     self.image = pygame.transform.scale(self.image, self.screen.get_size())
     self.image_pos = center(self.image.get_size(), self.screen.get_size())
Ejemplo n.º 4
0
    def __init__(self, score="00000001", level="1"):
        State.__init__(self)
        self.next = StartMenu()
        self.screen = pygame.display.get_surface()
        alpha_bg = self.screen.copy()
        alpha_bg.set_alpha(99)

        self.bg = pygame.Surface((800, 600))
        self.bg.fill((0, 0, 0))
        self.bg.blit(alpha_bg, (0, 0))

        img = data.load_image("newhighscore.png")
        pos = utils.center(img.get_size(), (800, 600))
        self.bg.blit(img, pos)

        self.level = level

        self.score = score
        self.score_img = TextLine(score)
        self.score_img.set_position((470, 250))

        self.entry = TextEntry()
        self.entry.set_position((190, 250))
        self.entry.gen_image()

        self.update_scr = True
        self.play_snd = True
Ejemplo n.º 5
0
    def __init__(self, req_tree, level=1):
        State.__init__(self)
        self.screen = pygame.display.get_surface()
        self.bg = self.screen.copy()
        images = data.load_gfx(["deathblossom.png"])
        self.cursor = Cursor(images["deathblossom.png"])
        self.sprites = pygame.sprite.RenderUpdates()
        self.sprites.add(self.cursor)

        img = data.load_image("perkboard.png")
        self.offset = utils.center(img.get_size(), (800, 600))
        self.bg.blit(img, self.offset)

        img = TextLine("Level: " + str(level))
        self.bg.blit(img, (600, 400))

        self.highlight = []
        for p in req_tree.keys():
            if req_tree[p] is True:
                ppos = perk[p]["pos"]
                x = self.offset[0] + ppos[0]
                y = self.offset[1] + ppos[1]
                self.bg.blit(perk[p]["img_p"], (x, y))
                self.highlight.append(ToolTipArea([x, y, 32, 32], p))
        self.tooltip = ToolTip()
        self.update_scr = True
Ejemplo n.º 6
0
    def __init__(self):
        State.__init__(self)
        self.update_scr = True
        self.screen = pygame.display.get_surface()
        gfx = data.load_gfx(
            ["highscore.png", "donateblood.png", "cursor3.png"])
        self.bg = gfx["highscore.png"]
        self.sprites = pygame.sprite.RenderUpdates()
        cursor = Cursor(gfx["cursor3.png"])
        self.sprites.add(cursor)
        self.next = StartMenu()
        deco = gfx["donateblood.png"]
        self.back = ClickArea([300, 565, 196, 27], (285, 565), deco,
                              (495, 565))

        lines = HIGHSCORE.keys()
        lines.sort(reverse=True)

        pos = (50, 145)
        x, y = pos
        for line in lines:
            t = TextLine(str(HIGHSCORE[line]["name"]))
            self.bg.blit(t, (x, y))
            t2 = TextLine(str(HIGHSCORE[line]["level"]).strip())
            self.bg.blit(t2, (x + 270, y))
            t3 = HighscoreText(line)
            self.bg.blit(t3, (x + 450, y))

            y += 40
Ejemplo n.º 7
0
 def __init__(self):
    State.__init__(self)
    self.kill_prev = True
    self.done = False
    self.screen.fill((40,40,50))
    self.image = pygame.image.load('img/optionscreen/optionsscreen.png')
    self.image = pygame.transform.scale(self.image, self.screen.get_size())
    self.image_pos = center(self.image.get_size(), self.screen.get_size())
    self.ups = True
Ejemplo n.º 8
0
 def __init__(self):
     State.__init__(self)
     self.kill_prev = True
     self.done = False
     self.screen.fill((40, 40, 50))
     self.image = pygame.image.load('img/optionscreen/optionsscreen.png')
     self.image = pygame.transform.scale(self.image, self.screen.get_size())
     self.image_pos = center(self.image.get_size(), self.screen.get_size())
     self.ups = True
Ejemplo n.º 9
0
 def __init__(self):
     State.__init__(self)
     self.next = StartScreen()
     self.screen.fill((0, 0, 0))
     self.image = get_image("img/logo.png")
     self.alpha = 0
     self.image.set_alpha(0)
     self.image = pygame.transform.scale(self.image, self.screen.get_size())
     self.image_pos = center(self.image.get_size(), self.screen.get_size())
     self.fade = False
     self.lifetime = Timer(5)
     self.update_s = True
Ejemplo n.º 10
0
 def __init__(self, next_state):
     State.__init__(self)
     self.next_state = next_state
     self.screen.fill((0,0,0))
     self.image = get_image("img/trans/transition.png")
     self.image = pygame.transform.scale(self.image, self.screen.get_size())
     self.image_pos = center(self.image.get_size(), self.screen.get_size())
     self.loading_bar = Loading_animated()
     self.loading_bar_pos = (600, 440)
     self.update_s = True
     self.length = 90
     self.count = 0
Ejemplo n.º 11
0
 def __init__(self):
     State.__init__(self)
     self.next = StartScreen()
     self.screen.fill((0,0,0))
     self.image = get_image("img/logo.png")
     self.alpha = 0
     self.image.set_alpha(0)
     self.image = pygame.transform.scale(self.image, self.screen.get_size())
     self.image_pos = center(self.image.get_size(), self.screen.get_size())
     self.fade = False
     self.lifetime = Timer(5)
     self.update_s = True
Ejemplo n.º 12
0
 def __init__(self):
     State.__init__(self)
     self.next = None
     self.screen.fill((200, 200, 200))
     self.image = pygame.image.load("img/gamequit/quitscreen.png")
     self.alpha = 0
     self.image.set_alpha(0)
     self.image = pygame.transform.scale(self.image, self.screen.get_size())
     self.image_pos = center(self.image.get_size(), self.screen.get_size())
     self.fade = False
     self.lifetime = Timer(1)
     self.update_s = True
Ejemplo n.º 13
0
 def __init__(self):
     State.__init__(self)
     self.next = None
     self.screen.fill((200,200,200))
     self.image = pygame.image.load("img/gamequit/quitscreen.png")
     self.alpha = 0
     self.image.set_alpha(0)
     self.image = pygame.transform.scale(self.image, self.screen.get_size())
     self.image_pos = center(self.image.get_size(), self.screen.get_size())
     self.fade = False
     self.lifetime = Timer(1)
     self.update_s = True
Ejemplo n.º 14
0
 def __init__(self, next_state):
     State.__init__(self)
     self.next_state = next_state
     self.screen.fill((0, 0, 0))
     self.image = get_image("img/trans/transition.png")
     self.image = pygame.transform.scale(self.image, self.screen.get_size())
     self.image_pos = center(self.image.get_size(), self.screen.get_size())
     self.loading_bar = Loading_animated()
     self.loading_bar_pos = (600, 440)
     self.update_s = True
     self.length = 90
     self.count = 0
Ejemplo n.º 15
0
 def __init__(self):
     State.__init__(self)
     self.kill_prev = True
     self.done = False
     self.next = Game()
     self.screen.fill((200, 200, 200))
     self.image = get_image('img/startscreen/title.png')
     self.image = pygame.transform.scale(self.image, self.screen.get_size())
     self.image_pos = center(self.image.get_size(), self.screen.get_size())
     self.ups = True
     self.set_up_buttons()
     music = 'sounds/startscreen.wav'
     self.music = pygame.mixer.Sound(music)
Ejemplo n.º 16
0
 def __init__(self):
     State.__init__(self)
     self.kill_prev = True
     self.done = False
     self.next = Game()
     self.screen.fill((200,200,200))
     self.image = get_image('img/startscreen/title.png')
     self.image = pygame.transform.scale(self.image, self.screen.get_size())
     self.image_pos = center(self.image.get_size(), self.screen.get_size())
     self.ups = True
     self.set_up_buttons()
     music = 'sounds/startscreen.wav'
     self.music = pygame.mixer.Sound(music)
Ejemplo n.º 17
0
    def __init__(self, screen, msg):
        State.__init__(self)
        self.screen = pygame.display.get_surface()
        self.msg = msg
        self.msg_pos = utils.center(self.msg.get_size(), self.screen.get_size())

        if not screen:
            self.bg = pygame.Surface((800,600))
        else:
            self.bg = screen.copy()
        self.bg.set_alpha(100)

        self.scr_update = 1
Ejemplo n.º 18
0
 def __init__(self):
     #blam, initiate that parent class
     State.__init__(self)
     self.kill_prev = True
     self.screen.fill((0,0,0))
     self.show_debug = False
     self.canvas = pygame.image.load('img/blankcanvas.png').convert()
     self.canvas = pygame.transform.scale(self.canvas, self.screen.get_size())
     self.canvas_pos = center(self.canvas.get_size(), self.screen.get_size())
     self.current_room = StartRoom()
     self.player = Player()
     self.player.set_position(self.current_room.player_pos_left)
     self.current_room.player = self.player
     self.heads_up_display = HUD(self.player)
Ejemplo n.º 19
0
    def __init__(self):
        State.__init__(self)
        self.next = StartMenu()
        self.screen = pygame.display.get_surface()
        self.gfx = data.load_gfx(
            ["credits.png", "cursor3.png", "creditssh.png"])

        self.bg = self.gfx["credits.png"]
        cursor = Cursor(self.gfx["cursor3.png"])
        self.sprites = pygame.sprite.RenderUpdates()
        self.sprites.add(cursor)
        self.crd = pygame.rect.Rect([375, 497, 50, 50])

        if SH_MODE[0]:
            self.bg.blit(self.gfx["creditssh.png"], (371, 493))
        self.update_scr = True
Ejemplo n.º 20
0
 def __init__(self):
     #blam, initiate that parent class
     State.__init__(self)
     self.kill_prev = True
     self.screen.fill((0, 0, 0))
     self.show_debug = False
     self.canvas = pygame.image.load('img/blankcanvas.png').convert()
     self.canvas = pygame.transform.scale(self.canvas,
                                          self.screen.get_size())
     self.canvas_pos = center(self.canvas.get_size(),
                              self.screen.get_size())
     self.current_room = StartRoom()
     self.player = Player()
     self.player.set_position(self.current_room.player_pos_left)
     self.current_room.player = self.player
     self.heads_up_display = HUD(self.player)
Ejemplo n.º 21
0
    def __init__(self):
        State.__init__(self)
        self.next = StartMenu()

        self.screen = pygame.display.get_surface()
        self.screen.fill((0, 0, 0))

        self.logo = data.load_image("logo.png")
        self.alpha = 0
        self.logo.set_alpha(0)
        self.logopos = utils.center(self.logo.get_size(), (800, 600))

        self.fadeout = False
        self.anim_timer = utils.Timer(1)

        data.set_music("logovoices.ogg")
        pygame.mixer.music.play()
        self.update_scr = True
Ejemplo n.º 22
0
    def __init__(self, name="Scavenger"):
        State.__init__(self)
        self.screen = pygame.display.get_surface()
        alpha_bg = self.screen.copy()
        alpha_bg.set_alpha(99)
        self.bg = pygame.Surface((800, 600))
        self.bg.fill((0, 0, 0))
        self.bg.blit(alpha_bg, (0, 0))
        self.perk = perk[name]

        gfx = data.load_gfx(
            ["newperk.png", "deathblossom.png", "donateblood.png"])
        deco = gfx["donateblood.png"]

        img = gfx["newperk.png"]
        pos = utils.center(img.get_size(), (800, 600))
        self.bg.blit(img, pos)

        img = self.perk["img_t"]
        x = utils.center(img.get_size(), (800, 600))[0]
        self.bg.blit(img, (x, pos[1] + 50))

        img = self.perk["img_p"]
        x = utils.center(img.get_size(), (800, 600))[0]
        self.bg.blit(img, (x, pos[1] + 75))

        img = TextArea(self.perk["desc"])
        x = utils.center(img.get_size(), (800, 600))[0]
        self.bg.blit(img, (x, pos[1] + 110))

        img = data.load_image("pause.png")
        self.bg.blit(img, (335, 525))

        self.update_scr = True
        cursor = Cursor(gfx["deathblossom.png"])
        self.sprites = pygame.sprite.RenderUpdates()
        self.sprites.add(cursor)
        self.cont = ClickArea([334, 408, 125, 25], (320, 408), deco,
                              (463, 408))
Ejemplo n.º 23
0
    def __init__(self):
        State.__init__(self)
        self.screen = pygame.display.get_surface()
        gfx = data.load_gfx([
            "donateblood.png", "titlescreen.png", "deathblossom.png",
            "cursor3.png"
        ])
        self.bg = gfx["titlescreen.png"]
        self.deco = gfx["donateblood.png"]

        self.sprites = pygame.sprite.RenderUpdates()
        cursor = Cursor(gfx["cursor3.png"])
        self.sprites.add(cursor)

        self.start = ClickArea([15, 15, 212, 30], (230, 15), self.deco)
        self.quitgame = ClickArea([604, 559, 184, 30], (582, 563), self.deco)
        self.help = ClickArea([12, 560, 80, 27], (100, 563), self.deco)
        self.highscore = ClickArea([602, 13, 188, 30], (580, 15), self.deco)
        self.crd = pygame.rect.Rect([385, 352, 112, 116])

        self.buttons = [self.start, self.quitgame, self.help, self.highscore]
        self.update_scr = True
Ejemplo n.º 24
0
    def __init__(self, req_tree, level):
        State.__init__(self)
        self.screen = pygame.display.get_surface()
        self.req_tree = req_tree
        self.level = level

        alpha_bg = self.screen.copy()
        alpha_bg.set_alpha(99)
        self.bg = pygame.Surface((800, 600))
        self.bg.fill((0, 0, 0))
        self.bg.blit(alpha_bg, (0, 0))

        img_names = [
            "escmenu.png", "deathblossom.png", "donateblood.png", "pause.png"
        ]
        images = data.load_gfx(img_names)

        img = data.load_image("pause.png")
        self.bg.blit(img, (335, 525))
        self.deco = images["donateblood.png"]
        self.menu = images["escmenu.png"]
        self.menu_pos = utils.center(self.menu.get_size(), (800, 600))
        self.bg.blit(self.menu, self.menu_pos)
        self.cursor = Cursor(images["deathblossom.png"])

        self.sprites = pygame.sprite.RenderUpdates()
        self.sprites.add(self.cursor)
        self.update_scr = True

        self.cont = ClickArea([311, 217, 178, 25], (325, 220), self.deco,
                              (459, 220))
        self.perk = ClickArea([311, 278, 178, 25], (310, 280), self.deco,
                              (476, 280))
        self.surr = ClickArea([311, 339, 178, 25], (315, 342), self.deco,
                              (470, 342))
        self.buttons = [self.cont, self.perk, self.surr]
Ejemplo n.º 25
0
 def __init__(self):
     State.__init__(self)
     self.kill_prev = False
Ejemplo n.º 26
0
 def __init__(self):
     State.__init__(self)
     self.next = StartMenu()
     self.screen = pygame.display.get_surface()
     self.bg = data.load_image("help.png")
     self.update_scr = True
Ejemplo n.º 27
0
 def __init__(self):
     State.__init__(self)
     self.kill_prev = False
Ejemplo n.º 28
0
    def __init__(self):
        State.__init__(self)
        pygame.key.set_repeat(20, 50)
        Zombie.hp_max = 5
        Zombie.dam = 2
        self.screen = pygame.display.get_surface()
        self.screen.fill((0, 0, 0))
        self.killcount = 0

        #zombies
        self.zombie_timer = utils.Timer(100)
        self.zombie_spawn = 1
        self.max_zombies = 150
        self.ztrack = 9
        self.zombie_wave = 0
        self.moan_timer = utils.Timer(random.randint(20, 60))
        self.zombie_sndlist = SND_MOAN

        #load graphics
        self.dc_gfx = data.load_game_gfx()

        #set bg
        self.bg = self.dc_gfx["bg.png"]
        self.lawn = self.screen.subsurface([0, 35, 800, 565])
        self.update_bg()

        #spritegroups
        self.bullets = pygame.sprite.Group()
        self.powerups = pygame.sprite.Group()
        self.on_bottom = pygame.sprite.Group()
        self.zombies = pygame.sprite.Group()
        self.on_top = pygame.sprite.Group()
        self.all_sprites = pygame.sprite.Group()

        #generate zombie imagelist
        self.zombie_namelist = []

        for i in xrange(1, 11):
            nr = str(i)
            if len(nr) == 1:
                nr = "0" + nr
            name = "zombie" + nr + ".png"
            self.zombie_namelist.append(name)

        if SH_MODE == [True]:
            self.zombie_namelist = ["sheep.png"]
            self.zombie_sndlist = {"sheep": SND_MAIN["zombiesheep.ogg"]}
            self.zombie_spawn = 7
            self.moan_timer.set_interval(40)

        #cursor
        animlist = data.load_grid("reload.png")
        self.cursor = AnimCursor(self.dc_gfx["deathblossom.png"], animlist)
        pos = utils.center((60, 60), self.lawn.get_size())
        pygame.mouse.set_pos(pos)
        self.on_top.add(self.cursor)
        self.hover_hp = HoverHP()

        #player
        self.player = Player(self.dc_gfx["mcgrumpington.png"], self.cursor)
        self.player.center(self.screen)
        self.all_sprites.add(self.player)
        self.gen_zombies(self.zombie_spawn)

        data.set_music("bgm.xm")
        pygame.mixer.music.play(-1)