Beispiel #1
0
class Level(LevelBase):
    prevlevel = 0
    dialog = 0
    pdialog = 0
    timer = 0
    oldPos = (0, 0)
    dialog = 0
    btimer = 0
    lockedatmessage = 0
    inbattle = 0

    def __init__(self, g, player_new, dimentions, p=0):
        LevelBase.__init__(self, g, player_new, dimentions)
        self.prevlevel = p
        self.title = "Airport"
        # current level
        TW, TH = 32, 32

        # load tile set
        g.tga_load_tiles(os.path.join("textures", "tiles5.png"), (TW, TH), self.tdata)
        g.tga_load_level(os.path.join("levels", "level29.tga"), 1)
        g.bounds = pygame.Rect(TW, TH, (len(g.tlayer[0]) - 2) * TW, (len(g.tlayer) - 2) * TH)
        g.code_events(self.edata)

        self.g.player.hidden = 0
        self.pan_camera(None)

        self.doctor = Character("monster3a.png", "monster3a.png", self.g, "doctor")
        self.doctor.pos((25, 20))  # 25, 20
        self.doctor.health = 0
        self.doctor.dead = 1

        self.movie = 0
        self.assistant = Character("assistant.png", "faceassistant.png", g)
        self.assistant.pos((33, 27))
        self.assistant.feeling = "coma"
        self.nurse = Character("monster4.png", "facenurse.png", self.g, "nurse")
        self.nurse.pos((29, 27))
        self.nurse.direction = 0
        if not "scene14" in g.saveData:
            self.nurse.feeling = "dead"
        g.run_codes(self.cdata, (0, 0, g.dimentions[0], g.dimentions[1]))

    # upon moving
    def playerMove(self, g, r, a):
        print "player move"

    # draw back of level
    def draw_back(self):
        test = self.draw_gradent((105, 70, 70), (0, 30, 255))
        self.g.screen.blit(test, (0, 0))

    # when you're over a change level tile
    def change_level(self, g, r, a):
        if a.__class__.__name__ != "Player":
            return

        print g.player.pos

    # level events
    def level_loop(self):
        g = self.g

        if g.player.pos == (29, 27):
            if self.dialog == 0:
                if g.event:
                    g.intermission = 1
                    self.dialog = 1
            else:
                if self.dialog <= 4:
                    g.player.staylooking = 1
                if g.keyup:
                    if self.dialog != 4:  # walking
                        self.dialog += 1
                        self.contains_msg_box_counter = 0

        if self.dialog == 2:
            g.player.direction = 1
            str = "I've set up the computer ready for the tape. All I need now"
            str += "\nis her tape."
            str += "\n"
            self.info_box(str, self.nurse)
        elif self.dialog == 3:
            str = "You have it? That's great!"
            str += "\n Give it here and I'll set it up"
            str += "\n"
            self.info_box(str, self.nurse)
        elif self.dialog == 4:
            self.nurse.walkto((31, 27))
            if self.nurse.hasWalkedTo((31, 27)):
                self.dialog = 5
                g.player.staylooking = 0
                g.player.direction = 0
        elif self.dialog == 5:
            str = "Lemmie start up the transfer"
            str += "\n"
            self.info_box(str, self.nurse)
        elif self.dialog == 6:
            if (self.timer / 4) % 2 == 0:
                self.nurse.feeling = "look0"
            else:
                self.nurse.feeling = "look1"
        elif self.dialog == 7:
            self.nurse.feeling = ""
            str = "Hmmm...."
            str += "\n"
            self.info_box(str, self.nurse)
        elif self.dialog == 8:
            str = "arrg..."
            str += "\n"
            self.assistant.feeling = "coma2"
            self.info_box(str, self.assistant)
        elif self.dialog == 9:
            str = "She's awake!"
            str += "\n"
            self.info_box(str, self.nurse)
        elif self.dialog == 10:
            g.shake_screen()
            g.exp2.play()
            self.dialog = 11
        elif self.dialog == 11:
            str = "???"
            str += "\n"
            self.info_box(str, self.nurse)
        elif self.dialog == 12:
            g.intermission = 0

        self.timer += 1
        if self.oldPos != g.player.pos:
            self.dialog = 0
            self.oldPos = g.player.pos
            self.timer = 0
Beispiel #2
0
class Level(LevelBase):
    prevlevel = 0
    dialog = 0
    pdialog = 0
    timer = 0
    oldPos = (0, 0)
    dialog = 0
    btimer = 0
    fadein = 0
    watertimer = 0
    
    def __init__(self, g, player_new, dimentions, p = 0):
        LevelBase.__init__(self, g, player_new, dimentions)
        self.prevlevel = p
        self.title = 'Office'

        # current level
        currentLevel = os.path.join("levels",  "level13.tga")

        TW,TH = 32,32

        # load tile set
        tileTexture = os.path.join("textures",  "tiles4.png")
        g.tga_load_tiles(tileTexture, (TW,TH), self.tdata)
        g.tga_load_level(currentLevel, 1)
        g.bounds = pygame.Rect(TW,TH,(len(g.tlayer[0])-2)*TW,(len(g.tlayer)-2)*TH)
        g.code_events(self.edata)
        g.run_codes(self.cdata,(0,0,g.dimentions[0],g.dimentions[1]))

        # intermission!
        self.fox = Character("fox.png","facefox.tga", g, 'fox')
        self.fox.pos((27, 13))
        self.fox.direction = 0
        self.fox.hidden = 1

        self.assistant = Character("assistant.png","faceassistant.png", g)
        self.assistant.pos((28, 9))
        self.assistant.direction = 0
        self.assistant.feeling = 'pulled'
        self.assistant.hidden = 1

        self.director = Character("director.png","facedirector.png", g, 'director')
        self.director.pos((32, 14))
        self.director.direction = 1
        self.director.feeling = 'sit'

        if 'scene18' in g.saveData:
            self.director.hidden = 1
            self.dialog = 15
            g.intermission = 0
            self.switches[0].open = 1

        
    # ugly, ugly monsters
    def add_monster (self,g,r,a):
        print 'add_monster ',r.rect
        #Enemy(self.g, (r.rect.x, r.rect.y), 'monster0')
        Monster0(self.g, (r.rect.x, r.rect.y))

    # upon moving
    def playerMove(self, g,r,a):
        if self.prevlevel == 14:
            g.player.rect.x,g.player.rect.y = r.rect.x,r.rect.y
            g.view.x = r.rect.x
            g.view.y = r.rect.y

            # you also wake up here if you've just killed robot
            if 'scene18' in g.saveData:
                self.fadein = 1


    # when you're over a change level tile
    def change_level(self, g,r,a):
        if a.__class__.__name__ != 'Player':
            return
        print g.player.pos
        if g.player.pos[1] == 23:
            g.currentLevel = 12

    # level events
    def level_loop(self):
        g = self.g

        if g.keyup and self.timer > 30:
            if self.dialog > 0 and self.dialog != 10 and self.dialog != 9 and self.dialog != 11 and self.dialog != 15:
                self.dialog += 1
                self.contains_msg_box_counter = 0

        if g.player.pos == (24, 11) or g.player.pos == (24, 12) or g.player.pos == (24, 13) or g.player.pos == (24, 14):
            if self.dialog == 0:
                self.dialog = 1
                g.intermission = 1
                self.pan_camera(self.fox)
                self.fox.pos((27, 8))
                self.timer = 0
        if self.dialog == 1:
            str = "Fox:"
            str += "\nI got her"
            self.info_box(str, self.fox)
            self.fox.walkto((28, 13))
            self.assistant.walkto((29, 14))
            self.fox.hidden = 0
            self.assistant.hidden = 0
            if self.switches[0].open:
                self.switches[0].pull_switch()
        elif self.dialog == 2:
            self.assistant.feeling = 'worried'
            str = "..."
            str += "\nGood. "
            self.director.feeling = 'sitawake'
            self.info_box(str, self.director)
        elif self.dialog == 3:
            str = "Take her to the prison."
            self.info_box(str, self.director)
        elif self.dialog == 4:
            str = "What is this?"
            self.info_box(str, self.director)
            self.fox.feeling = 'sad'
        elif self.dialog == 5:
            str = "Fox:"
            str += "\nAh..."
            self.info_box(str, self.fox)
            self.fox.direction = 1
        elif self.dialog == 6:
            str = "Fox:"
            str += "\nIt's her clone she made, Director Victoria"
            self.info_box(str, self.fox)
            self.fox.direction = 1
        elif self.dialog == 7:
            str = "Director Victoria:"
            str += "\nI can see that! You failed to get rid of her illegal friend? Useless!"
            self.info_box(str, self.director)
            self.director.feeling = 'sitangry'
            self.fox.direction = 0
        elif self.dialog == 8:
            str = "Director Victoria:"
            str += "\nThis time get rid of him. Put her in the incarceration hole."
            self.info_box(str, self.director)
            self.fox.feeling = 'normal'
            self.director.feeling = 'normal'
        elif self.dialog == 9:
            self.fox.faceup = 1
            self.assistant.hidden = 1
            self.btimer += 1
            if self.btimer > 40:
                self.director.walkto((36, 14))
                self.fox.faceup = 0
                self.dialog = 10
                self.director.direction = 0
                self.pan_camera(g.player)
        elif self.dialog == 10:
            self.btimer += 1
            if self.btimer > 40:
                # start another boss battle
                self.fox.attacking = 2
                self.fox.health = 50
                self.fox.healthmax = 50
                self.dialog = 11
                g.intermission = 0
        elif self.dialog == 11:
            if self.fox.attacking != 0: # kill the fox!
                self.fox.draw_health_meter()
            else:
                self.dialog = 12
                self.timer = 0
        elif self.dialog == 12:
            str = "Fox:"
            str += "\nNot again!"
            self.info_box(str, self.fox)
            self.pan_camera(self.fox)
            g.intermission = 1
        elif self.dialog == 13:
            str = "Fox:"
            str += "\nWhatever. I'm out of here"
            self.info_box(str, self.fox)
        elif self.dialog == 14:
            g.intermission = 0
            self.fox.jump_out()
            self.dialog = 15
            self.btimer = 0
        elif self.dialog == 15:
            self.btimer += 1
            if self.btimer >= 30:
                self.fox.hidden = 1




        # give a wee message that director locked the door behind her. bitch.
        if g.player.pos == (36, 14):
            if g.event:
                self.pdialog = 1
            if self.pdialog == 1:
                if 'i_jailkey' in g.saveData:
                    g.currentLevel = 34
                else:
                    str = "\nThe door is locked."
                    self.info_box(str)

        
        # the tunnel to the jail pit (prompt player for option)
        if not 'scene18' in g.saveData:
            # director f***s off
            if self.director.hasWalkedTo((36, 14)):
                self.director.hidden = 1
                self.g.tlayer[14][36] = 42
            if g.player.pos == (29, 14) and self.fox.hidden == 1:
                if g.event and g.level.option_gui == 0:
                    g.level.option_gui = 1
                    g.intermission = 1
                    self.contains_msg_box_counter = 0
                    self.pan_camera(None)
            if g.level.option_gui != 0: # dialog open
                str = "\nJump in the pipe?"
                self.info_box(str)
            if g.level.option_gui == 3: #selected yes
                g.level.option_gui = 0
                self.g.currentLevel = 14
                g.intermission = 0
            if g.level.option_gui == 4: #selected no
                g.level.option_gui = 0
                g.intermission = 0
        else:
            self.g.tlayer[14][36] = 42
            self.watertimer += 1
            if self.watertimer % 2 == 0:
                Effect(self.g, 'water', (29 * 32, 14* 32 + 3))

            
        #(7, 14)
        if self.switches[0].open:
           self.g.clayer[14][7] = 0
           self.g.tlayer[14][7] = 7
        else:
           self.g.clayer[14][7] = 1
           self.g.tlayer[14][7] = 9

        # fade in 
        if self.fadein!=0:
            self.fadein += 1
            if self.fadein < 64:
                self.g.player.animation = 1
                self.g.player.dieanimation = 1
                g.intermission = 1
                alpha = self.fadein * 4
                self.g.screen.fill((alpha,alpha,alpha), None, BLEND_MULT)
            else:
                self.g.player.animation = 0
                self.g.player.dieanimation = 0
                g.intermission = 0
                self.fadein = 0

        # if you're moving
        if self.oldPos != g.player.pos:
            self.pdialog = 0
        self.oldPos = g.player.pos
        self.timer += 1

        
Beispiel #3
0
class Level(LevelBase):
    prevlevel = 0
    dialog = 0
    pdialog = 0
    timer = 0
    oldPos = (0, 0)
    dialog = 0
    btimer = 0
    lockedatmessage = 0
    inbattle = 0
    
    def __init__(self, g, player_new, dimentions, p = 0):
        LevelBase.__init__(self, g, player_new, dimentions)
        self.prevlevel = p
        self.title = 'Airport'
        # current level
        TW,TH = 32,32

        # load tile set
        g.tga_load_tiles(os.path.join("textures",  "tiles6.png"), (TW,TH), self.tdata)
        g.tga_load_level(os.path.join("levels",  "level28.tga"), 1)
        g.bounds = pygame.Rect(TW,TH,(len(g.tlayer[0])-2)*TW,(len(g.tlayer)-2)*TH)
        g.code_events(self.edata)

        self.vats = Inventory(g, 'plane')
        self.vats.pos((18, 9))

        g.run_codes(self.cdata,(0,0,g.dimentions[0],g.dimentions[1]))
        self.g.player.hidden = 0
        self.pan_camera(None)
        self.initBack('bg3.png', 190, 512)
        self.effect = GameEffect(g,'wind')
        pygame.mixer.music.load(os.path.join("ambient",  "amb15.ogg"))
        pygame.mixer.music.play(40000)
        
        self.fox = Character("fox.png","facefox.tga", g, 'fox')
        self.fox.pos((31, 15))
        self.fox.direction = 0
        self.fox.health = 40
        self.fox.healthmax = 40

        self.director = Character("director.png","facedirector.png", g, 'director')
        self.director.pos((36, 16))
        self.director.direction = 1
        
        if 'scene16' in g.saveData:
            self.fox.hidden = 1
        if 'scene17' in g.saveData:
            self.fox.feeling = 'dead'
            self.director.hidden = 1
        # plane is gone if you got imas backup tape
        if 'i_tape' in g.saveData:
            self.vats.removeself()
        self.invbox = 0


    # ugly, ugly monsters
    def add_monster (self,g,r,a):
        Monster5(self.g, (r.rect.x, r.rect.y))

    # upon moving
    def playerMove(self, g,r,a):
        print 'player move'
        if self.prevlevel == 29:
            g.player.rect.x,g.player.rect.y = r.rect.x,r.rect.y - 2
            g.view.x = r.rect.x
            g.view.y = r.rect.y


    # draw back of level
    def draw_back(self):
        test = self.draw_gradent((105,70,70), (0, 30, 255))
        self.g.screen.blit(test, (0,0))

    # when you're over a change level tile
    def change_level(self, g,r,a):
        if a.__class__.__name__ != 'Player':
            return
        if g.player.pos[0] == 64:
            g.currentLevel = 29
        if g.player.pos[0] == 1:
            g.currentLevel = 27
        print g.player.pos

    # level events
    def level_loop(self):
        g = self.g

        if self.g.player.pos[0] > 24:
            if not 'scene16' in g.saveData:
                g.intermission = 1
                self.pan_camera(self.fox)
                if self.dialog == 0:
                    self.dialog = 1

                if self.dialog != 0:
                    if g.keyup:
                        self.dialog += 1
                        self.contains_msg_box_counter = 0
                if self.dialog == 2:
                    g.intermission = 1
                    str = "The plane is ready. "
                    self.info_box(str,self.director)
                if self.dialog == 3:
                    str = "Him, again?"
                    self.fox.direction = 1
                    self.fox.feeling = 'sad'
                    self.info_box(str,self.director)
                if self.dialog == 4:
                    str = "You still havn't killed him?"
                    self.info_box(str,self.director)
                    self.fox.direction = 0
                if self.dialog == 5:
                    str = "This is your last chance. Finish him!"
                    self.info_box(str,self.director)
                    self.director.walkto((35, 16))
                if self.dialog == 6:
                    g.intermission = 0
                    g.saveData['scene16'] = 1
                    self.dialog = 0
                    self.fox.attacking = 3

        if self.director.hasWalkedTo((35,16)):
            self.director.hidden = 1
        if self.fox.attacking != 0 and self.fox.feeling != 'dead':
            self.fox.draw_health_meter()
            self.g.clayer[16][6] = 1
            self.g.tlayer[16][6] = 30
        else:
            if self.fox.health <= 0:
                self.fox.rect.y += 2 # gravity
            self.g.clayer[16][6] = 0
            self.g.tlayer[16][6] = 0
            if g.player.pos == (35, 16):
                if g.event:
                    g.currentLevel = 29

        # make the last health increase
        if self.fox.feeling == 'dead':
            if not 'scene17' in g.saveData:
                self.invbox = Inventory(g, 'healthincrease5', (self.fox.rect.x, self.fox.rect.y))
            g.saveData['scene17'] = 1
            if self.invbox:
                self.invbox.rect.y += 3



           
        if self.oldPos != g.player.pos:
            self.dialog = 0
            self.oldPos = g.player.pos
            self.timer = 0
Beispiel #4
0
class Level(LevelBase):
    prevlevel = 0
    dialog = 0
    pdialog = 0
    timer = 0
    oldPos = (0, 0)

    def __init__(self, g, player_new, dimentions, p=0):
        LevelBase.__init__(self, g, player_new, dimentions)
        self.prevlevel = p
        self.title = "Clock Tower"

        # current level
        currentLevel = os.path.join("levels", "level4.tga")

        TW, TH = 32, 32

        # load tile set
        tileTexture = os.path.join("textures", "tiles1.png")
        g.tga_load_tiles(tileTexture, (TW, TH), self.tdata)
        g.tga_load_level(currentLevel, 1)
        g.bounds = pygame.Rect(TW, TH, (len(g.tlayer[0]) - 2) * TW, (len(g.tlayer) - 2) * TH)
        g.code_events(self.edata)

        self.assistant = Character("assistant.png", "faceassistant.png", g)
        self.assistant.pos((3, 24))
        self.assistant.direction = 0

        g.run_codes(self.cdata, (0, 0, g.dimentions[0], g.dimentions[1]))
        if "scene3" in g.saveData:
            self.dialog = 4
            self.g.sprites.remove(self.assistant)

    # upon moving
    def playerMove(self, g, r, a):
        print g, r, a
        pass

    # when you're over a change level tile
    def change_level(self, g, r, a):
        if not g.event or a.__class__.__name__ != "Player":
            return

        if r == Rect(128, 768, 32, 32):
            self.g.currentLevel = 3

    # draw back of level
    def draw_back(self):
        test = self.draw_gradent((18, 217, 255), (255, 255, 255))
        test = test.subsurface((0, 0, 480, test.get_rect().height))
        self.g.screen.blit(test, (80, 0))

    # level events
    def level_loop(self):
        g = self.g

        # if you have the microwave and get to the top
        if self.dialog == 0 and "i_microwave" in g.saveData:
            # self.assistant.walkto((g.player.pos[0],g.player.pos[1]))
            # self.assistant.direction = g.player.direction
            g.following = self.assistant
            if g.player.pos == (6, 4) or g.player.pos == (5, 4):
                self.dialog = 1
                self.timer = 0
        elif self.dialog == 1:
            self.assistant.walkto((4, 4))
            str = "Ima:"
            str += "\nThis is where we transmit a things."
            str += "\nIt's our job to make sure it keeps working."
            self.info_box(str, self.assistant)
            g.intermission = 1
            if g.keyup and self.timer > 40:
                self.dialog += 1
        elif self.dialog == 2:
            self.assistant.walkto((3, 4))
            g.intermission = 0
            if g.player.pos == (1, 4):
                if g.event:
                    self.timer = 0
                    self.dialog = 3
                    g.saveData["i_" + "microwave"] = 0
        elif self.dialog == 3:
            str = "\nPlaced the transmitter in the slot!"
            self.assistant.following = g.player
            g.intermission = 1
            g.player.staylooking = 1
            self.info_box(str)
            if g.keyup and self.timer > 40:
                self.dialog += 1
                self.timer = 0
        elif self.dialog == 4:
            g.player.staylooking = 0
            self.assistant.walkto((2, 4))
            if self.assistant.hasWalkedTo((2, 4)):
                if g.keyup and self.timer > 40:
                    self.dialog += 1
                g.player.direction = 0
                self.assistant.direction = 1
                str = "Ima:"
                str += "\nThe building where you woke up"
                str += "\nI woke up there too."
                self.info_box(str, self.assistant)
                g.saveData["scene3"] = 1
        elif self.dialog == 5:
            g.intermission = 0
            if self.assistant in g.sprites:
                g.following = self.assistant

        # if you're moving
        if self.oldPos != g.player.pos:
            self.pdialog = 0
        self.oldPos = g.player.pos
        self.timer += 1
Beispiel #5
0
class Level(LevelBase):
    prevlevel = 0
    dialog = 1
    pdialog = 0
    timer = 0
    
    def __init__(self, g, player_new, dimentions, p = 0):
        LevelBase.__init__(self, g, player_new, dimentions)
        self.prevlevel = p
        self.title = 'Water of Leith'

        # current level
        currentLevel = os.path.join("levels",  "level3.tga")

        TW,TH = 32,32

        # load tile set
        tileTexture = os.path.join("textures",  "tiles0.png")
        g.tga_load_tiles(tileTexture, (TW,TH), self.tdata)
        g.tga_load_level(currentLevel, 1)
        g.bounds = pygame.Rect(TW,TH,(len(g.tlayer[0])-2)*TW,(len(g.tlayer)-2)*TH)
        g.code_events(self.edata)

        self.assistant = Character("assistant.png","faceassistant.png", g)
        self.assistant.pos((3, 10))
        self.assistant.direction = 0
        g.intermission = 1
        
        g.run_codes(self.cdata,(0,0,g.dimentions[0],g.dimentions[1]))

        # already done the cut scene
        if 'scene2' in g.saveData:
            self.dialog = 5
        if 'scene4' in g.saveData:
            self.g.sprites.remove(self.assistant)
        self.initBack('bg0.png', 180)

        

    # upon moving
    def playerMove(self, g,r,a):
        if self.prevlevel == 4:
            g.player.rect.x,g.player.rect.y = r.rect.x,r.rect.y
            g.view.x = r.rect.x
            #g.view.y = r.rect.y # meh...
            self.assistant.pos((54, 10))

    # when you're over a change level tile
    def change_level(self, g,r,a):
        if not g.event or a.__class__.__name__ != 'Player':
            return

        #back to castle st
        if self.g.player.pos == (1, 10):
            self.g.currentLevel = 2
        if self.g.player.pos == (56, 10):
            self.g.currentLevel = 4



    # draw back of level
    def draw_back(self):
        test = self.draw_gradent((18,217,255), (255, 255, 255))
        self.g.screen.blit(test, (0,0))

        # sparkling water
        if self.timer % 7 == 0:
            w,h = self.g.dimentions[0], self.g.dimentions[1]
            for y in range(0,h):
                for x in range(0,w):
                    if self.g.tlayer[y][x] == 26:
                        self.g.tlayer[y][x] = 34
                    elif self.g.tlayer[y][x] == 34:
                        self.g.tlayer[y][x] = 26

    # level events
    def level_loop(self):
        g = self.g

        # if the key is up
        if g.keyup and self.timer > 40 and self.dialog < 4:
            self.dialog += 1
            self.timer = 0
            self.contains_msg_box_counter = 0

        if self.dialog == 1:
            self.assistant.walkto((7, 10))
            if self.assistant.hasWalkedTo((7, 10)):
                self.assistant.faceup = 1
                str = "Ima:"
                str += "\nYou can see old shopping trolleys in the Leith."
                self.info_box(str, self.assistant)
        elif self.dialog == 2:
            self.assistant.faceup = 0
            self.assistant.direction = 1
            str = "Ima:"
            str += "\nIf they weren't rusted I'd ride down hills in them"
            self.info_box(str, self.assistant)
        elif self.dialog == 3:
            str = "Ima:"
            str += "\nLet's get to the tower. "
            self.info_box(str, self.assistant)
        elif self.dialog == 4:
            self.assistant.walkto((3, 10))
            if self.assistant.hasWalkedTo((3,10)):
                self.dialog = 5
        elif self.dialog == 5:
            g.intermission = 0
            # Ima follows the player
            #if g.player.direction == 0:
            #    self.assistant.walkto((g.player.pos[0]-1,g.player.pos[1]))
            #    self.assistant.direction = 0
            #else:
            #    self.assistant.walkto((g.player.pos[0]+1,g.player.pos[1]))
            #    self.assistant.direction = 1
            g.following = self.assistant
            g.saveData['scene2'] = 1
            if g.player.pos == (52, 10):
                if g.event:
                    self.pdialog = 1
                if self.pdialog == 1:
                    str = "Clock Tower"
                    str += "\nGracefully reconstructed by News Corporation"
                    self.info_box(str)

        # if you're moving
        if self.oldPos != g.player.pos:
            self.pdialog = 0
        self.oldPos = g.player.pos
        self.timer += 1

        
Beispiel #6
0
class Level(LevelBase):
    prevlevel = 0
    dialog = 0
    pdialog = 0
    timer = 0
    oldPos = (0, 0)
    dialog = 0
    
    def __init__(self, g, player_new, dimentions, p = 0):
        LevelBase.__init__(self, g, player_new, dimentions)
        self.prevlevel = p
        self.title = "Tree House"

        # current level
        currentLevel = os.path.join("levels",  "level7.tga")

        TW,TH = 32,32

        # load tile set
        tileTexture = os.path.join("textures",  "tiles2.png")
        g.tga_load_tiles(tileTexture, (TW,TH), self.tdata)
        g.tga_load_level(currentLevel, 1)
        g.bounds = pygame.Rect(TW,TH,(len(g.tlayer[0])-2)*TW,(len(g.tlayer)-2)*TH)
        g.code_events(self.edata)

        self.fox = Character("fox.png","facefox.tga", g, 'fox')
        self.fox.pos((3, 9))
        self.fox.direction = 0
        self.fox.hidden = 1

        self.assistant = Character("assistant.png","faceassistant.png", g)
        self.assistant.pos((9, 10))
        self.assistant.direction = 0
        
        g.run_codes(self.cdata,(0,0,g.dimentions[0],g.dimentions[1]))
        self.g.player.direction = 1
        g.intermission = 1
        if 'scene5' in g.saveData:
            self.assistant.hidden = 1
            self.fox.hidden = 1
            self.dialog = 10

    # adds a monster. in this level they're rats, and one bird
    def add_monster (self,g,r,a):
        if r.rect == Rect(640, 416, 32, 32):
            Bird(self.g, (r.rect.x, r.rect.y))
        else:
            Rat(self.g, (r.rect.x, r.rect.y))

    # upon moving
    def playerMove(self, g,r,a):
        print g, r, a
        pass

    # when you're over a change level tile
    def change_level(self, g,r,a):
        if a.__class__.__name__ != 'Player':
            return

        # going back to the train tracks
        if g.event:
            if g.player.pos == (11, 10) and self.dialog == 10:
                g.currentLevel = 6
        

    # draw back of level
    def draw_back(self):
        test = self.draw_gradent((60,40,30), (0, 0, 0))
        self.g.screen.blit(test, (0,0))

    # level events
    def level_loop(self):
        g = self.g

        if g.keyup and self.timer > 30:
            if self.dialog < 6:
                self.dialog += 1
                self.contains_msg_box_counter = 0
            if self.dialog == 6 and g.intermission == 1:
                self.dialog += 1
                self.contains_msg_box_counter = 0
            if self.dialog == 9 or self.dialog == 7:
                self.dialog += 1
                self.contains_msg_box_counter = 0

            self.timer = 0

        if self.dialog == 0:
            str = "Ima:"
            str += "\nWelcome to my home"
            self.info_box(str, self.assistant)
        elif self.dialog == 1:
            self.g.player.direction = 1
            self.assistant.direction = 1
            self.fox.hidden = 0
            str = "\nhello!"
            self.info_box(str, self.fox)
        elif self.dialog == 2:
            self.fox.feeling = 'sad'
            str = "I came here to inform you that you Ima broke your "
            str += "\ncontractual obligations. This means I have to take you away."
            self.info_box(str, self.fox)
        elif self.dialog == 3:
            self.fox.feeling = 'normal'
            str = "Who are you?"
            self.info_box(str, self.fox)
        elif self.dialog == 4:
            str = "You must be why I'm here!"
            str += "\nThat means I can squash you!"
            self.info_box(str, self.fox)
        elif self.dialog == 5:
            self.fox.attacking = 1
            self.timer = 0
            self.dialog = 6
            g.intermission = 0
        elif self.dialog == 6:
            if self.fox.attacking != 0: # finishing the battle. Ima gets kidnapped
                self.fox.draw_health_meter()
            else:
                g.intermission = 1
                self.dialog = 7
                self.timer = 0
        elif self.dialog == 7:
            str = "Ah! my face!"
            str += "\nI'm getting out of here."
            self.fox.feeling = 'angry'
            self.info_box(str, self.fox)

        elif self.dialog == 8:
            self.fox.walktorect((self.assistant.rect.x, self.assistant.rect.y))
            self.fox.direction = 0
            if self.fox.rect == Rect(320, 288, 96, 64) or self.fox.rect == Rect(288, 288, 96, 64):
                self.fox.direction = 1
                self.fox.walkto((10, 2))
                self.assistant.walkto((10, 2))
                self.dialog = 9
                self.timer = 0
        elif self.dialog == 9:
            str = "Ima:"
            str += "\nEeeeek!"
            self.assistant.feeling = 'scared'
            self.info_box(str, self.assistant)
            if self.timer > 25:
                self.fox.hidden = 1
                self.assistant.hidden = 1
        elif self.dialog == 10:
            self.dialog = 10
            g.intermission = 0
            g.saveData['scene5'] = 1


        # if you're moving
        if self.oldPos != g.player.pos:
            self.pdialog = 0
        self.oldPos = g.player.pos
        self.timer += 1

        
Beispiel #7
0
class Level(LevelBase):
    prevlevel = 0
    dialog = 0
    pdialog = 0
    timer = 10
    ticker = 0
    
    def __init__(self, g, player_new, dimentions, p = 0):
        LevelBase.__init__(self, g, player_new,dimentions)
        self.prevlevel = p
        self.title = 'Engineers Lab'

        # current level
        currentLevel = os.path.join("levels",  "level2.tga")

        TW,TH = 32,32

        # load tile set
        tileTexture = os.path.join("textures",  "tiles0.png")
        g.tga_load_tiles(tileTexture, (TW,TH), self.tdata)
        g.tga_load_level(currentLevel, 1)
        g.bounds = pygame.Rect(TW,TH,(len(g.tlayer[0])-2)*TW,(len(g.tlayer)-2)*TH)
        g.code_events(self.edata)

        self.microwave = Inventory(g, 'microwave')
        self.microwave.pos((6, 9))

        self.professor = Character("professor.png","faceprofessor.tga", g)
        self.professor.pos((6, 9))
        self.professor.direction = 0

        self.assistant = Character("assistant.png","faceassistant.png", g)
        self.assistant.pos((12, 9))
        self.assistant.direction = 1
        
        g.intermission = 1

        # already done the cut scene
        if 'scene1' in g.saveData:
            g.intermission = 0
            self.professor.pos((11, 9))
            self.dialog = 9
            self.g.sprites.remove(self.assistant)

        # if you've put the transmitter in
        if 'scene3' in g.saveData:
            self.assistant = Character("assistant.png","faceassistant.png", g)
            self.assistant.pos((13, 9))
            self.professor.pos((8, 9))
            self.assistant.direction = 1
            self.dialog = 10
            g.intermission = 1
        
        # already had the talk after putting in the transmitter
        if 'scene4' in g.saveData:
            self.dialog = 19
            g.intermission = 0
            self.g.sprites.remove(self.assistant)

        if 'scene5' in g.saveData:
            self.dialog = 20
            self.professor.pos((11,9))
            self.professor.faceup = 1

        g.run_codes(self.cdata,(0,0,g.dimentions[0],g.dimentions[1]))

    # upon moving
    def playerMove(self, g,r,a):
        if self.prevlevel == 3:
            g.player.rect.x = r.rect.x
            g.player.rect.y = r.rect.y
        if self.prevlevel == 5:
            # why do you eat so much chicken?
            pop = g.tile_to_screen((6,9))
            g.player.rect.x = pop[0]
            g.player.rect.y = pop[1]

    # when you're over a change level tile
    def change_level(self, g,r,a):
        if not g.event or a.__class__.__name__ != 'Player':
            return

        #back to castle st
        if g.player.pos == (1, 9):
            self.g.currentLevel = 1
        if g.player.pos == (13, 9):
            self.g.currentLevel = 3

        # The door is open
        if 'scene4' in g.saveData:
            if g.player.pos == (7, 9):
                g.currentLevel = 5


    # draw back of level
    def draw_back(self):
        test = self.draw_gradent((18,20,34), (0, 0, 0))
        self.g.screen.blit(test, (0,0))

        # blinking machines
        if self.ticker % 7 == 0:
            w,h = self.g.dimentions[0], self.g.dimentions[1]
            for y in range(0,h):
                for x in range(0,w):
                    if self.g.tlayer[y][x] == 47:
                        self.g.tlayer[y][x] = 63
                    elif self.g.tlayer[y][x] == 63:
                        self.g.tlayer[y][x] = 47


        # open the door
        if 'scene4' in self.g.saveData:
            w,h = self.g.dimentions[0], self.g.dimentions[1]
            for y in range(0,h):
                for x in range(0,w):
                    if self.g.tlayer[y][x] == 1:
                        self.g.tlayer[y][x] = 55



    # level events
    def level_loop(self):
        g = self.g
        # if the key is up
        if g.keyup and self.timer > 30 and self.dialog != 9 and self.dialog != 19 and self.dialog != 20:
            self.dialog += 1
            self.timer = 0
            self.contains_msg_box_counter = 0

        # dialog bs
        if self.dialog == 0:
            self.professor.faceup = 1
        elif self.dialog == 1:
            self.professor.faceup = 0
            str = "I've completed the testing of the microwave transmitter."
            str += "\nI'll put the cover on it and it will be fixed."
            self.info_box(str, self.professor)
        elif self.dialog == 2 :
            self.professor.walkto((11, 9))
            if self.professor.hasWalkedTo((11, 9)):
                self.professor.faceup = 1
                str = "I don't know how I'll manage to fix it again; "
                str += "\nThe solder is rusted and the components have decayed. If"
                str += "\nthey want us to do it again they'll need to supply us correctly."
                self.info_box(str, self.professor)
        elif self.dialog == 3:
            self.professor.faceup = 0
            str = "Hehe!"
            str += "\nThere's a visitor in the door"
            self.info_box(str, self.assistant)
        elif self.dialog == 4:
            str = "A visitor?"
            self.professor.direction = 1
            self.info_box(str, self.professor)
        elif self.dialog == 5:
            self.professor.walkto((3, 9))
            self.assistant.walkto((4, 9))
            if self.professor.hasWalkedTo((3, 9)):
                str = "You're a face I haven't seen before..."
                self.info_box(str, self.professor)
        elif self.dialog == 6:
            str = "The ID sown to your speed suit is GARD01 2454"
            self.info_box(str, self.professor)
        elif self.dialog == 7:
            self.professor.direction = 0
            str = "You wouldn't happen to know where this man came from,"
            str += "\ndo you, Ima?"
            str += "\n"
            self.info_box(str, self.professor)
        elif self.dialog == 8:
            self.professor.direction = 1
            str = "Well I'm sure you wouldn't helping her take the microwave "
            str += "\ntransmitter to the clock tower and install it. It shouldn't"
            str += "\ntake long."
            self.info_box(str, self.professor)
        elif self.dialog == 9:
            # enable walking
            g.intermission = 0

            # professor goes back to working
            self.professor.direction = 0
            self.professor.walkto((11, 9))

            if self.professor.hasWalkedTo((11, 9)):
                self.professor.faceup = 1

            if self.assistant in self.g.sprites:
                g.following = self.assistant
            g.saveData['scene1'] = 1
            
            # asking the professor what to do
            if g.player.pos == (11,9) and g.event:
                self.pdialog = 1
            if self.pdialog == 1:
                str = "You can get to the tower using the door to my right."
                str += "\nMake sure to take the transmitter!"
                self.info_box(str, self.professor)
        elif self.dialog == 10:
            self.assistant.walkto((11, 9))
            self.professor.walkto((10, 9))
            g.player.direction = 1
            if self.assistant.hasWalkedTo((11, 9)):
                self.professor.faceup = 0
                str = "Back already?"
                self.info_box(str, self.professor)
        elif self.dialog == 11:
            str = "Good work. This means we can go home for the day."
            self.info_box(str, self.professor)
        elif self.dialog == 12:
            self.assistant.walkto((10, 9))
            self.professor.walkto((11, 9))
            if self.professor.hasWalkedTo((11, 9)):
                self.assistant.direction = 0
                str = "What about you?"
                self.info_box(str, self.professor)
        elif self.dialog == 13:
            str = "The last thing you remember is getting paid for a medical trail?"
            str += "\nAh yes. To be an undergraduate again..."
            str += "\nWonderful times!"
            self.info_box(str, self.professor)
        elif self.dialog == 14:
            str = "Ima:"
            str += "\nEngineer?"
            self.info_box(str, self.assistant)
        elif self.dialog == 15:
            str = "Engineer:"
            self.professor.direction = 1
            str += "\nI'd imagine you have the responsibility of caring for your"
            str += "\nnew friend."
            self.info_box(str, self.professor)
        elif self.dialog == 16:
            self.professor.direction = 0
            str = "Engineer:"
            str += "\nTake this, you can use it to protect yourself."
            str += "\nI made it myself."
            self.info_box(str, self.professor)
        elif self.dialog == 17:
            str = "\nReceived the Crux!"
            g.saveData['weapon'] = 1
            g.saveData['displayhealth'] = 1
            self.info_box(str)
        elif self.dialog == 18:
            str = "Engineer:"
            str += "\nI'll open the door."
            self.info_box(str, self.professor)
            self.assistant.direction = 1
        elif self.dialog == 19:
            g.intermission = 0
            g.saveData['scene4'] = 1
            self.professor.walkto((11, 9))
            # walk the assistant to the door and remove her.
            if self.assistant in self.g.sprites:
                self.assistant.walkto((7, 9))
                if self.assistant.hasWalkedTo((7, 9)):
                    self.g.sprites.remove(self.assistant)

            # a small message to the player about the monsters outside
            if g.player.pos == (11,9) and g.event:
                self.pdialog = 1
            if self.pdialog == 1:
                str = "Engineer:"
                str += "\nThe weapon works by locating erroneous DNA left by"
                str += "\nmodified creatures, and storing it for reproduction."
                self.info_box(str, self.professor)
        elif self.dialog == 20: # if you've killed the fox, and Ima's been kidnapped
            if g.player.pos == (11,9) and g.event:
                g.intermission = 1
                self.dialog = 21
                self.timer = 0
        elif self.dialog == 21: # if you've killed the fox, and Ima's been kidnapped
            str = "Engineer:"
            str += "\nWhat? Ima's been kidnapped?! By a giant pumpkin?"
            self.professor.walkto((12,9))
            self.professor.direction = 1
            self.info_box(str, self.professor)
            self.professor.faceup = 0
            g.player.direction = 0
        elif self.dialog == 22:
            str = "Engineer:"
            str += "\nI know who he is. His name is Fox. "
            self.info_box(str, self.professor)
        elif self.dialog == 23:
            str = "Engineer:"
            str += "\nHe was made by terrorists, but found work with the "
            str += "\nNews Corperation."
            self.info_box(str, self.professor)
        elif self.dialog == 24:
            str = "Engineer:"
            str += "\n...The world has changed since you were last awake. A long time "
            str += "\nago terrorists got their hands on genetic manipulation equipment."
            self.info_box(str, self.professor)
        elif self.dialog == 25:
            str = "Engineer:"
            str += "\nAcross the globe people were attacked with cheap explosives,"
            str += "\npoisons and modified creatures."
            self.info_box(str, self.professor)
        elif self.dialog == 26:
            str = "Engineer:"
            str += "\nPeople found refuge underground. The only people on top"
            str += "\nare maintainers to their system they live in."
            self.info_box(str, self.professor)
        elif self.dialog == 27:
            str = "Engineer:"
            str += "\nLaw does not permit us to copy people, and Ima copied you. "
            str += "\nSo News Corp. must have sent someone take her..."
            self.info_box(str, self.professor)
        elif self.dialog == 28:
            str = "Engineer:"
            str += "\nYou'll have to go and get her. They probably just want"
            str += "\nto set an example anyway."
            self.info_box(str, self.professor)
        elif self.dialog == 29:
            str = "Engineer:"
            str += "\nGet to the Octagon were their office is and take her back."
            self.info_box(str, self.professor)
        elif self.dialog == 30:
            g.intermission = 0
            g.saveData['scene6'] = 1




        self.timer += 1
        self.ticker += 1
        # remmber last pos so I can remove old dialoge boxes
        if self.oldPos != g.player.pos:
            self.pdialog = 0
        self.oldPos = g.player.pos
Beispiel #8
0
class Level(LevelBase):
    prevlevel = 0
    dialog = 0
    pdialog = 0
    timer = 0
    oldPos = (0, 0)
    dialog = 0
    btimer = 0
    lockedatmessage = 0
    inbattle = 0
    
    def __init__(self, g, player_new, dimentions, p = 0):
        LevelBase.__init__(self, g, player_new, dimentions)
        self.prevlevel = p
        self.title = 'Flooded Lab'
        # current level
        TW,TH = 32,32

        # load tile set
        g.tga_load_tiles(os.path.join("textures",  "tiles6.png"), (TW,TH), self.tdata)
        g.tga_load_level(os.path.join("levels",  "level33.tga"), 1)
        g.bounds = pygame.Rect(TW,TH,(len(g.tlayer[0])-2)*TW,(len(g.tlayer)-2)*TH)
        g.code_events(self.edata)

        self.stygian = Character('stygian.png', 'facestygian.png', g)
        self.stygian.pos((8, 9))
        self.stygian.direction = 1
        self.boat = Character('boat.png', 'facestygian.png', g, 'boat')
        self.boat.pos((9, 11))
        
        self.professor = Character("professor.png","faceprofessor.tga", g)
        self.professor.pos((5, 9))
        self.professor.direction = 0
        
        g.run_codes(self.cdata,(0,0,g.dimentions[0],g.dimentions[1]))
        self.initBack('bg0.png', 140)


    # upon moving
    def playerMove(self, g,r,a):
        print 'player move'

    # draw back of level
    def draw_back(self):
        test = self.draw_gradent((105,70,70), (0, 30, 255))
        self.g.screen.blit(test, (0,0))

    # when you're over a change level tile
    def change_level(self, g,r,a):
        if a.__class__.__name__ != 'Player':
            return
        print g.player.pos
        if g.player.pos[0] == 8:
            g.currentLevel = 32

    # level events
    def level_loop(self):
        g = self.g


        # professor will talk to you and give you a key to go underground
        if g.player.pos == self.professor.get_pos():
            if g.event and self.pdialog == 0:
                self.pdialog = 2
                self.timer = 0
                g.intermission = 1
                self.contains_msg_box_counter = 0
                self.professor.walkto((4, 9))

        if g.keyup and self.timer > 30:
            if self.pdialog >= 2:
                self.pdialog += 1
                self.contains_msg_box_counter = 0
                self.timer = 0

        if self.pdialog == 2:
            str = "My workshop was flooded...\nI don't suppose you know do did that?"
            self.info_box(str, self.professor)
            self.g.player.direction = 1
        elif self.pdialog == 3:
            str = "You met the doctor?"
            self.info_box(str, self.professor)
        elif self.pdialog == 4:
            str = "I'm surprised you lived through that. Not many people do."
            self.info_box(str, self.professor)
        elif self.pdialog == 5:
            str = "Here, take this key. It's a shortcut to see the doctor."
            self.info_box(str, self.professor)
        elif self.pdialog == 6:
            str = "\nGot jail key!"
            self.info_box(str)
            g.saveData['i_jailkey'] = 1
        elif self.pdialog == 7:
            g.intermission = 0
                
        if self.oldPos != g.player.pos:
            self.pdialog = 0
        self.oldPos = g.player.pos

        self.timer += 1
        
Beispiel #9
0
class Level(LevelBase):
    prevlevel = 0
    dialog = 0
    pdialog = 0
    timer = 0
    oldPos = (0, 0)
    dialog = 0
    btimer = 0
    
    def __init__(self, g, player_new, dimentions, p = 0):
        LevelBase.__init__(self, g, player_new, dimentions)
        self.prevlevel = p
        self.title = 'Jail'
        # current level
        TW,TH = 32,32

        # load tile set
        g.tga_load_tiles(os.path.join("textures",  "tiles5.png"), (TW,TH), self.tdata)
        g.tga_load_level(os.path.join("levels",  "level19.tga"), 1)
        g.bounds = pygame.Rect(TW,TH,(len(g.tlayer[0])-2)*TW,(len(g.tlayer)-2)*TH)
        g.code_events(self.edata)

        # and an odd object called flutter box. flutter shutter (37, 13) 
        self.terrorist = Character("terrorist.png","faceterrorist.tga", g)
        self.terrorist.pos((3, 20))
        self.terrorist.direction = 0
        self.terrorist.faceup = 1

        self.flutterbox = Inventory(g, 'flutterbox')
        self.flutterbox.pos((37, 13))
        self.flutterswitch = Inventory(g, 'flutterswitch')
        self.flutterswitch.pos((37, 20))

        g.run_codes(self.cdata,(0,0,g.dimentions[0],g.dimentions[1]))

    # ugly, ugly monsters
    def add_monster (self,g,r,a):
        print 'add_monster ',r.rect
        e = Monster1(self.g, (r.rect.x, r.rect.y))

    # upon moving
    def playerMove(self, g,r,a):
        if self.prevlevel == 20:
            g.player.rect.x,g.player.rect.y = r.rect.x,r.rect.y
            g.view.x = r.rect.x
            g.view.y = r.rect.y

    # when you're over a change level tile
    def change_level(self, g,r,a):
        if a.__class__.__name__ != 'Player':
            return
        if g.player.pos[1] == 1:
            g.currentLevel = 18

        if g.player.pos == (39, 27) or g.player.pos == (39, 28):
            g.currentLevel = 20

    # level events
    def level_loop(self):
        g = self.g



        # 16, 13
        if self.switches[0].open:
           self.g.clayer[13][16] = 0
           self.g.tlayer[13][16] = 2
        else:
           self.g.clayer[13][16] = 1
           self.g.tlayer[13][16] = 25

        #(26, 13)
        if self.switches[1].open:
           self.g.clayer[13][26] = 0
           self.g.tlayer[13][26] = 2
        else:
           self.g.clayer[13][26] = 1
           self.g.tlayer[13][26] = 25

        # opened up the flutter box (13, 20)
        if 'scene10' in g.saveData:
           self.g.clayer[20][11] = 0
           self.g.tlayer[20][11] = 2
        else:
           self.g.clayer[20][11] = 1
           self.g.tlayer[20][11] = 25

        # door to leave (38, 27)
        if 'scene11' in g.saveData:
           self.g.clayer[27][38] = 0
           self.g.tlayer[27][38] = 2
        else:
           self.g.clayer[27][38] = 1
           self.g.tlayer[27][38] = 25
        

        if g.player.pos == (37, 20):
            if 'i_flutterbox' in g.saveData:
                if g.event:
                    self.pdialog = 1
                    g.saveData['scene10'] = 1
                if self.pdialog == 1:
                    str = "\nPlaced the flutter box inside the holder"
                    self.info_box(str)
                    
        # talking to the terrorist
        if g.player.pos == (3, 20):
            if g.keyup and self.timer > 30:
                if self.pdialog > 0:
                    self.pdialog += 1
                    self.timer = 0
                    self.contains_msg_box_counter = 0
            if g.event and self.pdialog < 2:
                self.pdialog = 1
            if self.pdialog == 2:
                g.intermission = 1
                str = "Ah?"
                str += "\nYou interrupted me!"
                self.info_box(str, self.terrorist)
                self.terrorist.walkto((4, 20))
                self.terrorist.direction = 1
                self.terrorist.faceup = 0
                g.player.direction = 0
            elif self.pdialog == 3:
                str = "What do you want, baldy?"
                self.info_box(str, self.terrorist)
            elif self.pdialog == 4:
                str = "Ah, you must be the one who was sent down here. I guess the robot "
                str += "\ndidn't think you'd live past the Monotane. "
                str += "\nShe didn't think much of me either. "
                self.info_box(str, self.terrorist)
            elif self.pdialog == 5:
                str = "Most people don't think much of my group."
                self.info_box(str, self.terrorist)
            elif self.pdialog == 6:
                str = "They called us terrorists, after they ruined the economy. They "
                str += "\nlobbied our leaders against the people, and when the people turned "
                str += "\nto crime to put food on their table they put them in prison."
                self.info_box(str, self.terrorist)
            elif self.pdialog == 7:
                str = "We found salvation. A company called News Corp financed us "
                str += "\nso we could fight back. "
                self.info_box(str, self.terrorist)
            elif self.pdialog == 8:
                str = "The government stepped in and sold the people  "
                str += "\nEntertainment Devices that protected them completely.  "
                str += "\nThose blue things behind me, there are people in them.  "
                self.info_box(str, self.terrorist)
            elif self.pdialog == 9:
                str = "I've hacked the Entertainment network. The girl you're looking for "
                str += "\nwas inserted into the system, but got rejected due to an  "
                str += "\nincompatible brain. She's going to be flown out of the city soon. "
                self.info_box(str, self.terrorist)
            elif self.pdialog == 10:
                str = "Take my card with my location. The airport is down to the right; "
                str += "\nif you ever want to  continue the fight against the power,"
                str += "\nyou know where to find me.  "
                self.info_box(str, self.terrorist)
            elif self.pdialog == 11:
                str = "\nReceived the location card!"
                self.info_box(str)
                g.saveData['i_locationcard'] = 1
            elif self.pdialog == 12:
                g.intermission = 0
                g.saveData['scene11'] = 1



        self.timer += 1
        if self.oldPos != g.player.pos:
            self.pdialog = 0
            self.oldPos = g.player.pos
Beispiel #10
0
class Level(LevelBase):
    prevlevel = 0
    dialog = 0
    pdialog = 0
    timer = 0
    oldPos = (0, 0)
    dialog = 0
    btimer = 0
    lockedatmessage = 0
    inbattle = 0
    
    def __init__(self, g, player_new, dimentions, p = 0):
        LevelBase.__init__(self, g, player_new, dimentions)
        self.prevlevel = p
        self.title = 'Office Complex Top'
        # current level
        TW,TH = 32,32

        # load tile set
        g.tga_load_tiles(os.path.join("textures",  "tiles6.png"), (TW,TH), self.tdata)
        g.tga_load_level(os.path.join("levels",  "level31.tga"), 1)
        g.bounds = pygame.Rect(TW,TH,(len(g.tlayer[0])-2)*TW,(len(g.tlayer)-2)*TH)
        g.code_events(self.edata)
        self.initBack('bg1.png', 730)

        self.backuptape = Inventory(g, 'tape', (37, 22))
        self.backuptape.pos((37, 22))
        self.backup = Character('backup.png', 'facebackup.png', g, 'backup')
        self.backup.pos((28, 25))
        self.backup.direction = 0
        if 'scene21' in g.saveData:
            self.backup.hidden = 1
        # coming back and saying high to the guy.
        if 'scene20' in g.saveData and not 'scene21' in g.saveData:
            del g.saveData['scene20']

        g.run_codes(self.cdata,(0,0,g.dimentions[0],g.dimentions[1]))
        self.coins = 0


    # upon moving
    def playerMove(self, g,r,a):
        print 'player move'

    # draw back of level
    def draw_back(self):
        test = self.draw_gradent((105,70,70), (0, 30, 255))
        self.g.screen.blit(test, (0,0))

    # when you're over a change level tile
    def change_level(self, g,r,a):
        if a.__class__.__name__ != 'Player':
            return
        print g.player.pos
        if g.player.pos[0] == 1:
            g.currentLevel = 30

    # level events
    def level_loop(self):
        g = self.g



        # Some hints as to the past
        if g.player.pos == (28, 25) and not 'scene20' in g.saveData:
            if self.pdialog != 0:
                if g.keyup:
                    self.contains_msg_box_counter = 0
                    self.pdialog += 1
            if g.event and self.pdialog == 0:
                self.backup.face_the_player()
                g.intermission = 1
                self.pdialog = 1
                self.backup.walkto((29, 25))
                self.backup.direction = 1
                g.player.direction = 0

            if self.pdialog == 2:
                str = "Hello"
                self.info_box(str, self.backup)
            elif self.pdialog == 3:
                str = "You don't know me..."
                str += "\nbut I know you, ha. Haha!"
                self.info_box(str, self.backup)
            elif self.pdialog == 4:
                str = "Who knows if I'm myself, when I am who what's on a tape? "
                str += "\nSeveral times I've been built because of a timer."
                str += "\nWhat happened in between these gaps is anyone's guess."
                self.info_box(str, self.backup)
            elif self.pdialog == 5:
                str = "You came to tell me what you're doing."
                str += "\nBut I already know!"
                self.info_box(str, self.backup)
            elif self.pdialog == 6:
                str = "See, you can't have her tape."
                str += "\nI need it. For the future, you see."
                self.info_box(str, self.backup)
            elif self.pdialog == 7:
                str = "The insult 'tool' never really fits to most situations."
                str += "\nBut now it's apt!"
                self.info_box(str, self.backup)
            elif self.pdialog == 8:
                str = "...sudo apt!"
                self.info_box(str, self.backup)
            elif self.pdialog == 9:
                str = "..."
                self.info_box(str, self.backup)
            elif self.pdialog == 10:
                str = "Now you die!"
                self.info_box(str, self.backup)
            elif self.pdialog == 11:
                g.saveData['scene20'] = 1
                self.backup.attacking = 1
                self.backup.dy = -10.0
                self.pdialog = 20
                self.backup.walkto(None)
        else:
            g.intermission = 0

        if 'scene20' in g.saveData:
            if not 'scene21' in g.saveData:
                self.backup.draw_health_meter()

        if self.backup.health <= 0:
            if not 'scene21' in g.saveData:
                g.saveData['scene21'] = 1
                self.backup.attacking = 0
                self.backup.dead = 1
                self.coins = Inventory(g, 'coin', (self.backup.rect.x, self.backup.rect.y) )

        if self.coins:
            self.coins.rect.y += 5
            self.backup.rect.y += 5


        if self.oldPos != g.player.pos:
            self.pdialog = 0
        self.oldPos = g.player.pos