Ejemplo n.º 1
0
def _tryparseport(node):
  if node is None:
    return node
  port = node.find('portal')
  if port is not None:
    port = Portal(port.get('file', 'swordcave.map'), int(port.get('x', '0')), int(port.get('y', '0')), PortalType.__dict__[port.get('type', 'Boundary')])
  return port
Ejemplo n.º 2
0
class SOUP():
    portal = None
    estudios = None
    cs = None
    directorio = None

    def __init__(self):
        self.portal = Portal("http://ufm.edu/Portal")
        self.estudios = Estudios("http://ufm.edu/Estudios")
        self.cs = CS("https://fce.ufm.edu/carrera/cs/")
        self.directorio = Directorio("https://www.ufm.edu/Directorio")

    def programOne(self):
        self.portal.run()

    def programTwo(self):
        self.estudios.run()

    def programThree(self):
        self.cs.run()

    def programFour(self):
        self.directorio.run()

    def exec(self, Program):
        Program(self)

    programNumber = {
        1: programOne,
        2: programTwo,
        3: programThree,
        4: programFour
    }

    def getProgramNumber(self, args):
        for eachInt in args.integers:
            program = self.programNumber.get(int(eachInt))
            self.exec(program)

    def printDev(self):
        print(os.environ["DEV_PROGRA"])

    def start(self, args):
        if args.integers is None:
            args.integers = [1, 2, 3, 4]
        self.printDev()
        self.getProgramNumber(args)
Ejemplo n.º 3
0
def enter():
    # fill here
    global ui, boy, lupins, footholds, ropes, portal

    ui = UI()
    boy = Boy()

    footholds =load_foothold()
    for foothold in footholds:
        foothold.set_player(boy)

    ropes = load_rope()
    for rope in ropes:
        rope.set_player(boy)

    lupins = load_lupin()

    for lupin in lupins:
        lupin.set_player(boy)

    portal = Portal()
    portal.set_player(boy)

    current_time = get_time()
Ejemplo n.º 4
0
 def __init__(self, name):
     self.inv = Inventory()
     self.dim = Portal()
     self.ui = Interface()
     self.loader = BlockLoader()
     
     self.no_quest = Quest(desc="No quest.", name="None")
     self.you = Player(self.inv, name, self.no_quest)
     self.mob1 = Cow()
     self.mob2 = Gnu()
     self.mob3 = Zombie()
     self.mob4 = Grue()
     self.mob5 = Kitty()
     
     self.no_quest = Quest(desc="No quest.", name="None")
     self.hell_quest = Quest(desc="Conquer Hell!", name="Crusader")
     self.sky_quest = Quest(desc="Conquer the Sky Dimension!", name="Hostile Heavenly Takeover")
     self.magic_quest = Quest(desc="Magify something.", name="We Don't Have to Explain It")
     self.
     
     self.sk = SkyKing()
     self.satan = Lucifer()
Ejemplo n.º 5
0
	def __init__(self, screen_wdith, screen_height) :		
		# Call the parent constructor.
		super().__init__()

		# The borders of the level.
		self.left_edge = 0
		self.right_edge = 4590
		self.top_edge = -500
		self.bottom_edge = 1000
		# Where the camera stops moving on this level.
		self.shift_left_bound = self.left_edge + (screen_wdith/2)
		self.shift_right_bound = self.right_edge - (screen_wdith/2)
		self.shift_up_bound = self.top_edge + (screen_height/2)
		self.shift_down_bound = self.bottom_edge - (screen_height/2)

		# Where the player starts on this level.
		self.starting_x = 20
		self.starting_y = 212
		self.starting_right = True

		# The portal to the next level.
		self.portal = Portal(4480, -60)
		self.portal_list.add(self.portal)

		# Music for this level.
		self.music = "Assets/Music/Level_1.mp3"		
		
		# 2D array, containing the x and y coordinates and type for each platform.
		platforms = [
			[0, 288, 0],
			[70, 288, 1],
			[140, 288, 1],
			[210, 288, 1],
			[280, 288, 1],
			[350, 288, 1],
			[420, 288, 1],
			[490, 288, 1],
			[560, 288, 1],
			[630, 288, 1],
			[700, 288, 1],
			[770, 288, 2],

			[980, 168, 0],
			[1050, 168, 2],

			[1340, 168, 0],
			[1410, 168, 2],

			[1650, 168, 0],
			[1720, 168, 1],
			[1790, 168, 1],
			[1860, 168, 1],
			[1930, 168, 1],
			[2000, 168, 1],
			[2070, 168, 1],
			[2140, 168, 2],

			[2470, 330, 0],
			[2540, 330, 2],

			[2770, 350, 0],
			[2840, 350, 1],
			[2910, 350, 1],
			[2980, 350, 1],
			[3050, 350, 1],
			[3120, 350, 1],
			[3190, 350, 2],

			[3400, 230, 0],
			[3470, 230, 2],

			[3680, 110, 0],
			[3750, 110, 1],
			[3820, 110, 1],
			[3890, 110, 1],
			[3960, 110, 1],
			[4030, 110, 1],
			[4100, 110, 1],
			[4170, 110, 1],
			[4240, 110, 1],
			[4310, 110, 1],
			[4380, 110, 1],
			[4450, 110, 1],
			[4520, 110, 2]
			]

		# Go through the array above and create the platforms.
		for temp in platforms:
			platform = Platform(temp[0], temp[1], temp[2])
			self.platform_list.add(platform)

		# A 2D array containing the min-x, max-x, and y coordinates and color of each enemy.
		enemies = [
			[1650, 2210, 138, True],
			[2770, 3260, 320, False],
			[3680, 4310, 80, True],
			]

		# Go through the array above and create the enemies.
		for temp in enemies :
			enemy = Enemy(temp[0], temp[1], temp[2], temp[3])
			self.enemy_list.add(enemy)
Ejemplo n.º 6
0
class Main:
    def __init__(self, name):
        self.inv = Inventory()
        self.dim = Portal()
        self.ui = Interface()
        self.loader = BlockLoader()
        
        self.no_quest = Quest(desc="No quest.", name="None")
        self.you = Player(self.inv, name, self.no_quest)
        self.mob1 = Cow()
        self.mob2 = Gnu()
        self.mob3 = Zombie()
        self.mob4 = Grue()
        self.mob5 = Kitty()
        
        self.no_quest = Quest(desc="No quest.", name="None")
        self.hell_quest = Quest(desc="Conquer Hell!", name="Crusader")
        self.sky_quest = Quest(desc="Conquer the Sky Dimension!", name="Hostile Heavenly Takeover")
        self.magic_quest = Quest(desc="Magify something.", name="We Don't Have to Explain It")
        self.
        
        self.sk = SkyKing()
        self.satan = Lucifer()
        
    def clear_screen(self):
        if sys.platform.startswith("win32") or sys.platform.startswith("os2"):
            system("cls")
        else:
            sys.stdout.write('\033[2J')
            sys.stdout.write('\033[H')
            sys.stdout.flush()
    
    def run(self):
        while True:
            self.you.day += 1
            sleep(1)
            self.clear_screen()
            
            if self.you.dimension == "Hell":
                self.run_hell()
            elif self.you.dimension == "Sky Dimension":
                self.run_sd()
            elif self.you.dimension == "Base":
                pass
            else:
                print "ERR"
            
            cowspawn = self.mob1.x == None and self.mob1.y == None and self.mob1.z == None
            zomspawn = self.mob3.x == None and self.mob3.y == None and self.mob3.z == None
            gruespawn = self.mob4.x == None and self.mob4.y == None and self.mob4.z == None
            kittyspawn = self.mob5.x == None and self.mob5.y == None and self.mob5.z == None
            if cowspawn and zomspawn and gruespawn and kittyspawn:
                self.ui.load_peaceful_graphics(self.you)
            elif cowspawn and not zomspawn and gruespawn and kittyspawn:
                self.ui.load_zombie_graphics(self.you, self.mob3)
            elif cowspawn and zomspawn and not gruespawn and kittyspawn:
                self.ui.load_grue_graphics(self.you, self.mob4)
            elif not cowspawn and zomspawn and gruespawn and kittyspawn:
                self.ui.load_cow_graphics(self.you, self.mob1)
            elif cowspawn and zomspawn and gruespawn and not kittyspawn:
                self.ui.load_kitty_graphics(self.you, self.mob5)
            else:
                pass
            
            if not zomspawn:
                zomcheck1 = abs(self.mob3.y) - abs(self.you.y) == 1 and abs(self.mob3.x) - abs(self.you.x) == 0
            else:
                zomcheck1 = False
            if not zomspawn:
                zomcheck2 = abs(self.mob3.x) - abs(self.you.x) == 1 and abs(self.mob3.y) - abs(self.you.y) == 0
            else:
                zomcheck2 = False
            if zomcheck1 or zomcheck2:
                self.you.attack(self.mob3, self.inv)
            else:
                pass
            if not gruespawn:
                gruecheck1 = abs(self.mob4.y) - abs(self.you.y) == 1 and abs(self.mob4.x) - abs(self.you.x) == 0
            else:
                gruecheck1 = False
            if not gruespawn:
                gruecheck2 = abs(self.mob4.x) - abs(self.you.x) == 1 and abs(self.mob4.y) - abs(self.you.y) == 0
            else:
                gruecheck2 = False
            if gruecheck1 or gruecheck2:
                self.you.attack(self.mob4, self.inv)
            else:
                pass
            if not cowspawn:
                cowcheck1 = abs(self.mob1.y) - abs(self.you.y) == 1 and abs(self.mob1.x) - abs(self.you.x) == 0
            else:
                cowcheck1 = False
            if not cowspawn:
                cowcheck2 = abs(self.mob1.x) - abs(self.you.x) == 1 and abs(self.mob1.y) - abs(self.you.y) == 0
            else:
                cowcheck2 = False
            if cowcheck1 or cowcheck2:
                self.you.attack(self.mob1, self.inv)
            else:
                pass
                
            if self.inv.hellporterpartone == 1 and self.inv.hellporterparttwo == 1 and self.inv.hellporterpartthree == 1:
                print "You have created the Hell Teleporter!"
                self.inv.hell_teleporter = 1
            else:
                pass
            
            if self.inv.skykeypartone == 1 and self.inv.skykeyparttwo == 1 and self.inv.skykeypartthree == 1:
                print "You have created the key to the Stairway to the Sky Dimension!"
                self.inv.sky_key = 1

            self.mob1.check_spawn(self.you, randint(10, 15))
            self.mob2.check_spawn(self.you, 35)
            self.mob3.check_spawn(self.you, randint(20, 40))
            self.mob4.check_spawn(self.you, randint(30, 45))
            self.mob5.check_spawn(self.you, randint(60,75))
            command = str(raw_input("> "))
            
            if command.startswith("dig "):
                self.you.move(command[4:].upper())
            elif command == "inventory":
                self.clear_screen()
                self.inv.list_inv()
                sleep(3)
                self.clear_screen()
            elif command == "inv":
                self.clear_screen()
                self.inv.list_inv()
                sleep(3)
            elif command == "craft bow":
                if self.inv.wood >= 3:
                    self.inv.bow = self.inv.UNMAGIC_HAD
                    self.you.equipped = "L1"
                else:
                    print "You don't have enough materials."
            elif command == "craft dagger":
                if self.inv.wood >= 3:
                    self.inv.dagger = self.inv.UNMAGIC_HAD
                    self.you.equipped = "L1"
                else:
                    print "You don't have enough materials."
            elif command == "craft sword":
                if self.inv.wood >= 1 and self.inv.iron >= 2:
                    self.inv.sword = self.inv.UNMAGIC_HAD
                    self.you.equipped = "L2"
                else:
                    print "You don't have enough materials."
            elif command == "craft crossbow":
                if self.inv.wood >= 2 and self.inv.iron >= 2:
                    self.inv.crossbow = self.inv.UNMAGIC_HAD
                    self.you.equipped = "L2"
                else:
                    print "You don't have enough materials."
            elif command == "craft magifier":
                if self.inv.iron >= 3 and self.inv.gold >= 4 and self.inv.unobtainium >= 2:
                    self.inv.magifier = self.inv.UNMAGIC_HAD
                    print "You created the Magifier! You can now magify weaponry with 3 involatilium and the magifier!"
                else:
                    print "You don't have enough materials."
            elif command.startswith("magify "):
                if self.inv.magifier == self.inv.UNMAGIC_HAD:
                    self.inv.magify(command[7:])
                else:
                    print "You don't have the Magifier."
            elif command.startswith("teleport "):
                if command[9:].lower() == "hell" and self.you.dimension != "Hell":
                    if self.inv.hell_teleporter == self.inv.UNMAGIC_HAD:
                        self.dim.teleport(self.you, "Hell")
                    else:
                        print "You can't teleport to Hell without the Teleporter!"
                elif command[9:].lower() == "sky" and self.you.dimension != "Sky":
                    if self.inv.skydim_key == self.inv.UNMAGIC_HAD:
                        self.dim.teleport(self.you, "Sky")
                    else:
                        print "You can't teleport to the Sky Dimension without the key to the stairway!"
                elif command[9:].lower() == "base" and self.you.dimension != "Base":
                    self.dim.teleport(self.you, "Sky")
                else:
                    print "Either that dimension doesn't exist or it has not been implemented yet."
            elif command == "exit":
                temp = raw_input("Do you really want to exit?\n>")
                if temp.lower() == "yes" or temp.lower() == "y":
                    exit("Goodbye, then.")
                else:
                    pass
            elif command == "quests":
                self.questboard.display_board()
            else:
                print "Unrecognized command."
                
    def run_hell(self):
        while True:
            sleep(1)
            self.clear_screen()
            
            if self.you.dimension == "Hell":
                pass
            elif self.you.dimension == "Sky Dimension":
                self.run_sd()
            elif self.you.dimension == "Base":
                self.run()
            else:
                print "ERR"
            
            self.ui.load_peaceful_graphics(self.you)
            
            command = str(raw_input("> "))
            if command.startswith("dig "):
                self.you.move_hell(command[4:].upper())
            elif command == "inventory":
                self.clear_screen()
                self.inv.list_inv()
                sleep(2)
                self.clear_screen()
            elif command == "inv":
                self.clear_screen()
                self.inv.list_inv()
                sleep(2)
            elif command == "fight boss" or command == "boss fight":
                self.satan.boss_fight(self.you, self.inv)
            elif command.startswith("craft "):
                print "You can't craft in Hell."
            elif command.startswith("magify "):
                if self.inv.magifier == self.inv.UNMAGIC_HAD:
                    self.inv.magify(command[7:])
                else:
                    print "You don't have the Magifier."
            elif command.startswith("teleport"):
                if command[9:].lower() == "base" and self.you.dimension != "Base":
                    self.dim.teleport(self.you, "Base")
                else:
                    print "You can't teleport anywhere other than back to the base dimension while in Hell."
            elif command == "exit":
                temp = raw_input("Do you really want to exit?\n>")
                if temp.lower() == "yes" or temp.lower() == "y":
                    exit("Goodbye, then.")
                else:
                    pass
            else:
                print "Unrecognized command."
                
    def run_sd(self):
        while True:
            sleep(1)
            self.clear_screen()
            
            if self.you.dimension == "Hell":
                self.run_hell()
            elif self.you.dimension == "Sky Dimension":
                pass
            elif self.you.dimension == "Base":
                self.run()
            else:
                print "ERR"
            
            if command.startswith("dig "):
                self.you.move_sd(command[4:].upper())
            elif command == "inventory":
                self.clear_screen()
                self.inv.list_inv()
                sleep(3)
                self.clear_screen()
            elif command == "inv":
                self.inv.list_inv()
            elif command == "boss fight":
                self.sk.boss_fight(self.you, self.inv)
            elif command.startswith("craft "):
                print "You can't craft in the Sky Dimension."
            elif command.startswith("magify "):
                if self.inv.magifier == self.inv.UNMAGIC_HAD:
                    self.inv.magify(command[7:])
                else:
                    print "You don't have the Magifier."
            elif command == "boss fight" or command == "fight boss":
                print "Are you /sure/ you want to fight the Sky King? (y|n)"
                tmp = raw_input("> ")
                if tmp.lower() == "y" or tmp.lower() == "yes":
                    sk.boss_fight(self.you, self.inv)
                else:
                    pass
            elif command.startswith("teleport"):
                if command[9:].lower() == "base" and self.you.dimension != "Base":
                    self.dim.teleport(self.you, "Base")
                else:
                    print "You can't teleport anywhere other than back to the base dimension while in the Sky Dimension."
            elif command == "exit":
                temp = raw_input("Do you really want to exit?\n>")
                if temp.lower() == "yes" or temp.lower() == "y":
                    exit("Goodbye, then.")
                else:
                    pass
            else:
                print "Unrecognized command."
Ejemplo n.º 7
0
    def __init__(self, screen_wdith, screen_height):
        # Call the parent constructor.
        super().__init__()

        # The borders of the level.
        self.left_edge = -1500
        self.right_edge = 2500
        self.top_edge = -1800
        self.bottom_edge = 1000
        # Where the camera stops moving on this level.
        self.shift_left_bound = self.left_edge + (screen_wdith / 2)
        self.shift_right_bound = self.right_edge - (screen_wdith / 2)
        self.shift_up_bound = self.top_edge + (screen_height / 2)
        self.shift_down_bound = self.bottom_edge - (screen_height / 2)

        # Where the player starts on this level.
        self.starting_x = 429
        self.starting_y = 212
        self.starting_right = False

        # The portal to the next level.
        self.portal = Portal(460, -1430)
        self.portal_list.add(self.portal)

        # Music for this level.
        self.music = "Assets/Music/Level_2.mp3"

        # 2D array, containing the x and y coordinates and type for each platform.
        platforms = [[210, 288, 0], [280, 288, 1], [350, 288,
                                                    1], [420, 288, 1],
                     [490, 288, 1], [560, 288, 2], [-700, 168, 0],
                     [-630, 168, 1], [-560, 168, 1], [-490, 168, 1],
                     [-420, 168, 1], [-350, 168, 1], [-280, 168, 1],
                     [-210, 168, 1], [-140, 168, 1], [-70, 168, 1],
                     [0, 168, 1], [70, 168, 2], [-910, 28, 0], [-840, 28, 2],
                     [-680, -108, 0], [-610, -108, 1], [-540, -108, 1],
                     [-470, -108, 1], [-400, -108, 1], [-330, -108, 1],
                     [-260, -108, 1], [-190, -108, 1], [-120, -108, 2],
                     [150, -108, 0], [220, -108, 2], [490, -108, 0],
                     [560, -108, 1], [630, -108, 2], [910, -108, 0],
                     [980, -108, 2], [1130, -230, 0], [1200, -230, 1],
                     [1270, -230, 1], [1340, -230, 1], [1410, -230, 1],
                     [1480, -230, 1], [1550, -230, 2], [1700, -360, 0],
                     [1770, -360, 2], [1410, -480, 0], [1480, -480, 2],
                     [1700, -600, 0], [1770, -600, 2], [1410, -730, 0],
                     [1480, -730, 2], [1700, -860, 0], [1770, -860, 2],
                     [-200, -1000, 0], [-130, -1000, 1], [-60, -1000, 1],
                     [10, -1000, 1], [80, -1000, 1], [150, -1000, 1],
                     [220, -1000, 1], [290, -1000, 1], [360, -1000, 1],
                     [430, -1000, 1], [500, -1000, 1], [570, -1000, 1],
                     [640, -1000, 1], [710, -1000, 1], [780, -1000, 1],
                     [850, -1000, 1], [920, -1000, 1], [990, -1000, 1],
                     [1060, -1000, 1], [1130, -1000, 1], [1200, -1000, 1],
                     [1270, -1000, 1], [1340, -1000, 1], [1410, -1000, 1],
                     [1480, -1000, 2], [-490, -1120, 0], [-420, -1120, 2],
                     [-200, -1260, 0], [-130, -1260, 1], [-60, -1260, 1],
                     [10, -1260, 1], [80, -1260, 1], [150, -1260, 1],
                     [220, -1260, 1], [290, -1260, 1], [360, -1260, 1],
                     [430, -1260, 1], [500, -1260, 2]]

        # Go through the array above and create the platforms.
        for temp in platforms:
            platform = Platform(temp[0], temp[1], temp[2])
            self.platform_list.add(platform)

        # A 2D array containing the min-x, max-x, and y coordinates and color of each enemy.
        enemies = [[-700, -350, 138, False], [-350, 140, 138, True],
                   [490, 700, -138, False], [-680, -50, -138, False],
                   [1130, 1620, -260, True], [-200, 220, -1030, True],
                   [220, 640, -1030, False], [640, 1060, -1030, True],
                   [1060, 1550, -1030, False], [-200, 290, -1290, True]]

        # Go through the array above and create the enemies.
        for temp in enemies:
            enemy = Enemy(temp[0], temp[1], temp[2], temp[3])
            self.enemy_list.add(enemy)
Ejemplo n.º 8
0
def run_game():
    pygame.init()
    pygame.font.init()
    settings = Settings()
    screen = pygame.display.set_mode((settings.HEIGHT, settings.WIDTH))
    pygame.display.set_caption("Pacman")
    blocks = Group()
    dots = Group()
    powers = Group()
    nodes = Group()
    pacman = Pacman(settings, screen)
    portal = Portal(screen)
    score = Score(settings, screen)
    menupac = Pacman(settings, screen)
    blinky = Ghost(screen, 'Blinky', (150, 200), settings)
    inky = Ghost(screen, 'Inky', (150, 250), settings)
    pinky = Ghost(screen, 'Pinky', (150, 300), settings)
    clyde = Ghost(screen, 'Clyde', (150, 350), settings)
    title = settings.title

    while not settings.GAME_ACTIVE:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                sys.exit()
            elif event.type == pygame.KEYDOWN:
                settings.GAME_ACTIVE = True
        textsurface = settings.myfont.render("PACMAN", False, (255, 255, 0))
        menupac.rect.center = (150, 150)
        menupac.MOVINGRIGHT = True
        menupac.blitme()
        screen.blit(textsurface, (180, 145))
        textsurface = settings.myfont.render("Press any Key to Continue",
                                             False, (255, 255, 255))
        screen.blit(textsurface, (150, 600))
        blinky.blitme()
        inky.blitme()
        pinky.blitme()
        clyde.blitme()
        textsurface = settings.myfont.render("BLINKY", False, (255, 0, 0))
        screen.blit(textsurface, (180, 200))
        textsurface = settings.myfont.render("INKY", False, (7, 225, 225))
        screen.blit(textsurface, (180, 250))
        textsurface = settings.myfont.render("PINKY", False, (225, 207, 231))
        screen.blit(textsurface, (180, 300))
        textsurface = settings.myfont.render("CLYDE", False, (255, 159, 7))
        screen.blit(textsurface, (180, 350))
        screen.blit(title, (0, 0))
        textsurface = settings.myfont.render("HIGH SCORES", False,
                                             (255, 255, 255))
        screen.blit(textsurface, (350, 100))
        pygame.display.flip()

    gf.create_maze(settings, blocks, screen, dots, pacman, powers, nodes)

    while True:
        pacman.update()
        portal.update(pacman)
        gf.check_events(pacman, dots, blocks, powers, score, settings, screen,
                        nodes, portal)
        gf.update_screen(blocks, dots, pacman, screen, settings, powers, score,
                         portal)
Ejemplo n.º 9
0
# запускаем таймер 60 fps
clock = pygame.time.Clock()
fps = 60

running = True
shift = False

# создаем человека
human = Human()
# создаем пулю
bullet = Bullet()
# создаем пулю
field = Field()

# создаем красный портал
red_portal = Portal('red_vert.png', 'red_horz.png')
# создаем синий портал
blue_portal = Portal('blue_vert.png', 'blue_horz.png')

# создаем надпись на экране с картинкой
label = Label(w, h)
# создаем меню
menu = Menu(w, h)

# подгружаем звук завершения уровня
win_sound = pygame.mixer.Sound('data/tada.wav')


# загрузка уровня
def load_level(level):
    # загружаем поле
Ejemplo n.º 10
0
def run_game():

    pygame.init()
    pygame.display.set_caption("Portal Pacman")

    screen = pygame.display.set_mode((800, 700))
    clock = pygame.time.Clock()
    settings = [
        "Images/red_ghost.bmp", "Images/orange_ghost.bmp",
        "Images/pink_ghost.bmp", "Images/cyan_ghost.bmp"
    ]

    maze = Group()
    AllDots = Group()
    myShield = Group()
    ghosts = Group()
    pac = PacSprite(screen)
    score = Scoreboard()
    bullets = Group()
    portal = Portal(screen, pac)

    gf.makeMap(screen, maze, myShield)
    gf.makeFood(screen, AllDots)
    gf.create_Ghost(screen, ghosts, settings)
    red_ghost = Ghost(screen, settings[0])
    orange_ghost = Ghost(screen, settings[1])
    orange_ghost.rect.x += 30
    pink_ghost = Ghost(screen, settings[2])
    pink_ghost.rect.x += 60
    cyan_ghost = Ghost(screen, settings[3])
    cyan_ghost.rect.x += 90

    timer = 0
    gf.mainMenu(screen)
    while True:
        clock.tick(120)

        if not AllDots:
            gf.makeFood(screen, AllDots)
            pac.reset()
        screen.fill((0, 0, 0))
        gf.check_events(screen, pac, bullets, portal)
        pac.update()
        gf.collision_check(pac, maze, AllDots, ghosts, score, myShield,
                           bullets, portal)

        for block in maze:
            block.drawBlocks()
        for dot in AllDots:
            dot.draw_Dots()
        for Shield in myShield:
            Shield.blitme()
        # for ghost in ghosts:
        #   ghost.blitme()

        for bullet in bullets:
            bullet.update()
            bullet.draw_bullet(portal)
        if timer % 10 == 0:
            red_ghost.update()
        else:
            red_ghost.rect = 250, 300
        red_ghost.blitme()
        orange_ghost.blitme()
        pink_ghost.blitme()
        cyan_ghost.blitme()
        pac.blitme()
        score.blit_text(pac, screen)
        pygame.display.flip()
        timer += 1
Ejemplo n.º 11
0
def cidade_inicial(personagem, inventario, nome, habilidades, itens, bolsa):
    print("\n****************************************************************")
    print("\n\nCidade do Portal\n\n")
    print("****************************************************************\n")
    sleep(2)
    ponto = len(inventario)

    if (ponto == 0):
        print("Mago Sábio:")
        print("    Bem vindo a Mundo, %s!" % nome[0])
        sleep(3)
        print(
            "\n    Este mundo foi dividido em cem andares. Cada andar é guardado por um Chefe,"
        )
        print("    o qual você deverá derrotar para avançar. Alguns Chefes ")
        print("    são homens de confiançado Senhor Conquistador, outos são ")
        print("    criaturas monstruosas que estão sobre o porder dele.")
        sleep(7)
        #pets(personagem, nome)
        print(
            "\n    Esta é a Cidade do Portal, o unico lugar seguro que restou."
        )
        print(
            "    Toda vez que derrotar um Chefe, você será teletransportado ")
        print("    para este local e o Portal dará acesso ao próximo andar.")
        sleep(5)
        print("\n    Fale com o Lojista para receber seus primeiros itens.")
        sleep(2)

        decisao = "0"
        lojista = "0"
        portal = "0"
        while (decisao != "1" and decisao != "2" and decisao != "3"):
            print(
                "\n****************************************************************"
            )
            decisao = input(
                "\nDecisao: \n1 - Falar com Lojista \n2 - Ir à arena \n3 - Ir ao portal \nR: "
            )

            if (decisao == "2"):
                arena(personagem, nome, inventario, habilidades, itens, bolsa,
                      ponto)
                decisao = "0"

            elif (decisao == "3"):
                print(
                    "\n****************************************************************"
                )
                if (portal == "0"):
                    print("\nMago Sábio:")
                    print("    Você ainda não pode fazer isso!")
                    sleep(2)
                    decisao = "0"
                else:
                    if (personagem[40] != 4):
                        print("Mago Sábio:")
                        print("    Antes de ir, use seu ponto de habilidade.")
                        print(
                            "    Basta escolher o número da habilidade que deseja evoluir e confirmar."
                        )
                        print("    Depois é só escolher um atalho para ela.")
                        sleep(5)

                        evoluir_habilidades(personagem, habilidades, 1)

                    print("\nMago Sábio:")
                    print(
                        "    Muito bem, agora você esta pronto para enfrentar o primeiro andar!"
                    )
                    sleep(2)

                    Portal(personagem, nome, inventario, habilidades, itens,
                           ponto, bolsa)

            elif (decisao == "1"):
                print(
                    "\n****************************************************************"
                )
                if (lojista == "0"):
                    print("\nLojista: ")
                    print(
                        "    Olá, vejo que você é novo por aqui. Pegue esses equipamentos iniciais"
                    )
                    print("    para te ajudar.")
                    sleep(2)
                    arma = []
                    armadura = []

                    arma_de_aprendiz(arma)
                    equipar_arma(arma, personagem)

                    print(
                        "    Durante uma batalha, digite 1 e pressione enter para atacar."
                    )

                    armadura_aprendiz(armadura)
                    equipar_armadura(armadura, personagem)

                    sleep(3)
                    print("    Pegue também algumas poções.")
                    sleep(2)
                    print("\nVocê recebeu poções.")

                    bolsa[3] = bolsa[2]
                    bolsa[7] = bolsa[6]

                    sleep(2)
                    print(
                        "\n    Durante a batalha, digite 2 e escolha a opção de Poção que desejar usar."
                    )
                    sleep(2)

                    lojista = "1"

                else:
                    print("Lojista:")
                    print(
                        "    Eu já te dei os itens que você precisa, volte quando tiver dinheiro!"
                    )
                    sleep(2)

                decisao = "0"
                portal = "1"

    ponto = len(inventario)

    if (ponto == 1):
        print("Mago Sábio:")
        print("    Muito bem " + nome[0] +
              " vejo que conseguiu passar do primeiro andar!")
        print(
            "    Com você do nosso lado, eu acredito que podemos vencer este mal."
        )
        sleep(2)
        print(
            "    Explore um pouco de nossa cidade antes de ir para seu próximo desafio."
        )
        sleep(4)

    if (ponto >= 1):
        decisao = "0"
        while (decisao != "1" and decisao != "2" and decisao != "3"
               and decisao != "4" and decisao != "5" and decisao != "6"
               and decisao != "7" and decisao != "8" and decisao != "9"
               and decisao != "99"):
            decisao = input(
                "\nDecisão \n1 - Menu de personagem \n2 - Lojista \n3 - Arena \n4 - Portal \n5 - Pousada \n6 - Alquimista \n7 - Ferreiro \n8 - Torre dos Chefes \n9 - Salvar \nR: "
            )

            if (decisao == "1"):
                menuPersonagem(personagem, habilidades, itens, nome, bolsa)
                decisao = "0"

            elif (decisao == "2"):
                Alojista(personagem, nome, itens, ponto, bolsa)
                decisao = "0"

            elif (decisao == "3"):
                arena(personagem, nome, inventario, habilidades, itens, bolsa,
                      ponto)
                decisao = "0"

            elif (decisao == "4"):
                Portal(personagem, nome, inventario, habilidades, itens, ponto,
                       bolsa)
                decisao = "0"

            elif (decisao == "5"):
                decisao = pousada(personagem, nome)

            elif (decisao == "6"):
                alquimista(personagem, nome, bolsa)
                decisao = "0"

            elif (decisao == "7"):
                ferreiro(personagem, nome)
                decisao = "0"

            elif (decisao == "8"):
                tentativa = torre(personagem, inventario, habilidades, itens,
                                  nome, bolsa)
                decisao = "0"

            elif (decisao == "9"):
                decisao2 = "0"

                while (decisao2 != "1" and decisao2 != "2"):
                    decisao2 = input(
                        "\nDeseja Salvar o jogo? \n1 - Sim \n2 - Não \nR: ")
                    if (decisao2 == "1"):
                        salvar_jogo(personagem, nome, inventario, habilidades,
                                    itens, bolsa)
                    decisao = "0"

            elif (decisao == "99"):
                chefe = []
                mob1 = []
                mob2 = []
                chefeTeste(chefe)
                lobo(mob1)
                lobo(mob2)

                batalhaChefe(personagem, chefe, mob1, mob2, habilidades, bolsa,
                             nome)
Ejemplo n.º 12
0
 def __init__(self):
     self.portal = Portal("http://ufm.edu/Portal")
     self.estudios = Estudios("http://ufm.edu/Estudios")
     self.cs = CS("https://fce.ufm.edu/carrera/cs/")
     self.directorio = Directorio("https://www.ufm.edu/Directorio")