Exemple #1
0
def layout_level3(screen):
    p3_width = 50
    p_height = 50
    p_width = 100
    platforms = []
    ar_x = 1.3
    ar_y = 1.5

    platforms.append(Block(50, 490, p_width, p_height, "block1.png"))
    platforms.append(Block(150, 490, p_width, p_height, "block1.png"))
    platforms.append(Block(250, 490, p_width, p_height, "block1.png"))
    platforms.append(Block(350, 490, p_width, p_height, "block1.png"))
    platforms.append(Block(450, 490, p_width, p_height, "block1.png"))
    platforms.append(Block(550, 490, p_width, p_height, "block1.png"))
    platforms.append(Block(650, 490, p_width, p_height, "block1.png"))
    platforms.append(Block(750, 490, p_width, p_height, "block1.png"))

    lampHeight = lampImage.get_height()

    lampList = [
        Lamp((250, 490), lampImage, lightAlpha, 1),
        Lamp((650, 490), lampImage, lightAlpha, 5)
    ]

    doorList = [Door((50, 490), False), Door((750, 490), True)]

    return platforms, lampList, doorList
Exemple #2
0
def layout_level4(screen):
    p3_width = 50
    p_height = 50
    p_width = 100
    p4_height = 105
    p4_width = 15

    platforms = []

    platforms.append(Block(150, 70, p_width, p_height, "block1.png"))
    platforms.append(Block(550, 70, p_width, p_height, "block1.png"))
    platforms.append(Block(650, 175, p_width, p_height, "block1.png"))
    platforms.append(Block(250, 280, p_width, p_height, "block1.png"))
    platforms.append(Block(650, 280, p_width, p_height, "block1.png"))
    platforms.append(Block(50, 385, p_width, p_height, "block1.png"))
    platforms.append(Block(650, 385, p_width, p_height, "block1.png"))
    platforms.append(Block(50, 490, p_width, p_height, "block1.png"))
    platforms.append(Block(150, 490, p_width, p_height, "block1.png"))
    platforms.append(Block(450, 490, p_width, p_height, "block1.png"))
    platforms.append(Block(750, 490, p_width, p_height, "block1.png"))

    platforms.append(Block(250, 70, p_width, p_height, "block2.png"))
    platforms.append(Block(50, 175, p_width, p_height, "block2.png"))
    platforms.append(Block(250, 175, p_width, p_height, "block2.png"))
    platforms.append(Block(450, 175, p_width, p_height, "block2.png"))
    platforms.append(Block(550, 175, p_width, p_height, "block2.png"))
    platforms.append(Block(150, 280, p_width, p_height, "block2.png"))
    platforms.append(Block(550, 280, p_width, p_height, "block2.png"))
    platforms.append(Block(250, 385, p_width, p_height, "block2.png"))
    platforms.append(Block(650, 490, p_width, p_height, "block2.png"))

    platforms.append(Block(775, 70, p3_width, p_height, "block3.png"))
    platforms.append(Block(325, 385, p3_width, p_height, "block3.png"))
    platforms.append(Block(225, 490, p3_width, p_height, "block3.png"))

    #Floor
    platforms.append(Block(50, 590, p_width, p_height, "block1.png"))
    platforms.append(Block(150, 590, p_width, p_height, "block1.png"))
    platforms.append(Block(250, 590, p_width, p_height, "block1.png"))
    platforms.append(Block(350, 590, p_width, p_height, "block1.png"))
    platforms.append(Block(450, 590, p_width, p_height, "block1.png"))
    platforms.append(Block(550, 590, p_width, p_height, "block1.png"))
    platforms.append(Block(650, 590, p_width, p_height, "block1.png"))
    platforms.append(Block(750, 590, p_width, p_height, "block1.png"))

    lampHeight = lampImage.get_height()

    lampList = [
        Lamp((150, 490), lampImage, lightAlpha, isLit=True),
        Lamp((250, 70), lampImage, lightAlpha, 10),
        Lamp((650, 385), lampImage, lightAlpha, 5)
    ]

    doorList = [Door((750, 490), False), Door((50, 490), True)]

    return platforms, lampList, doorList, None
Exemple #3
0
    def __init__(self):
        SceneBase.__init__(self)
        playerimage = pygame.transform.scale(pygame.image.load("Images/player.png"), (30, 30))
        # creates the Player character in the location 20, 20
        self.player = Player.Player(30, 30, playerimage)

        blueParticle = pygame.image.load("Images/particle_blue.png")
        redParticle = pygame.image.load("Images/particle_red.png")
        # Defines the starting positions of the first two Particles for level 1 of the game
        self.particle1 = Particle.Particle(100, 100, False, None, redParticle, False)
        self.particle2 = Particle.Particle(100, 200, True, self.particle1, blueParticle, False)  # Particle 2 is entangled to Particle one

        # Defines the position for the first goal for level 1 of the game
        self.goal = Goal.Goal(400, 400)

        # NOTE: Negative numbers in wall declarations ruin collision detection
        self.leftWall = Wall.Wall(0, 0, 20, 600)
        self.rightWall = Wall.Wall(780, 0, 20, 600)
        self.topWall = Wall.Wall(0, 0, 800, 20)
        self.bottomWall = Wall.Wall(0, 580, 800, 20)
        self.door = Door.Door(760, 300, 20, 100)
        self.walls=[self.leftWall,self.rightWall,self.bottomWall,self.topWall]

        # Defines the objects that the Player character cannot pass through
        self.entities = [self.player,self.particle1, self.particle2, self.leftWall, self.rightWall, self.topWall, self.bottomWall]
        self.particles=[self.particle1,self.particle2]
        self.startTime=int(round(time.time()))
        pygame.mixer.music.load('A Strange Charm.wav')
        pygame.mixer.music.play(-1)
Exemple #4
0
 def restartFromDoorOne(self):
     self.__currentDoor = Door("Porte1")
     self.__thisPathHistory = []
     self.__passwordHistory = []
     self.__optionAneedToBePressed = False
     print("\nVous etes maintenant devant la porte 1 du labyrinthe.\n")
     return
Exemple #5
0
    def addDoor(self, xy, variant, isOpen):
        x, y = xy

        side = [[6, 7], [13, 3], [6, -1], [-1, 3]].index([x, y])
        self.doors.append(
            Door(self.floor, side, variant, isOpen, self.textures["doors"],
                 self.sounds))
Exemple #6
0
 def generate_doors(self):
     door_loc = {'direction': 'none', 'x': 0, 'y': 0}
     for room in self.neighboring_rooms:
         if not self.is_connected(room):
             if room.rect.x >= self.rect.x + self.rect.width:  #right
                 door_loc = Door.Door('vertical', room.rect.x/Room.grid_size, \
                  random.randint(max(room.rect.y, self.rect.y)/Room.grid_size, \
                  min(room.rect.y+room.rect.height, self.rect.y+self.rect.height)/Room.grid_size-1))
                 door_loc.rooms = [self, room]
                 self.set_connected_door(room, door_loc)
             elif room.rect.y >= self.rect.y + self.rect.height:  #top
                 door_loc = Door.Door('horizontal', random.randint(max(room.rect.x, self.rect.x)/Room.grid_size, \
                  min(room.rect.x+room.rect.width, self.rect.x+self.rect.width)/Room.grid_size-1), \
                  (self.rect.y + self.rect.height)/Room.grid_size)
                 door_loc.rooms = [self, room]
                 self.set_connected_door(room, door_loc)
Exemple #7
0
	def add_door(self, x, y, width, height, id):
		door = Door(x, y, width, height)
		self.doors.append(door)
		self.activatables.append(door)
		for ac in self.activators:
			if ac.id == id:
				ac.add_activatable(door)
def connect():
    global door
    doorPath = ""
    for f in os.listdir("/dev"):
        if "ttyACM" in f:
            doorPath = "/dev/" + f

    door = Door(doorPath)
Exemple #9
0
 def test_get_neigghbors(self):
    b = Cell(Coord(8, 14))
    door = DoorModule.Door(self.a, EAST, b)
    self.a.add_door(EAST, door)
    b.add_door(WEST, door)
    neighbors = self.a.get_neighbors()
    self.assertEqual(neighbors, [b])
    neighbors = b.get_neighbors()
    self.assertEqual(neighbors, [self.a])
Exemple #10
0
 def test_one_get_doors(self):
    b = Cell(Coord(8, 14))
    door = DoorModule.Door(self.a, EAST, b)
    self.a.add_door(EAST, door)
    b.add_door(WEST, door)
    doors = self.a.get_doors()
    self.assertEqual(doors, [door])
    doors = b.get_doors()
    self.assertEqual(doors, [door])
Exemple #11
0
def genEnvironment(difficulty, direction):
    objects = []
    door = []
    choices = []
    if direction == "Up":
        door.append(Door(False, "Down", 0))
        choices = ["Up", "Left", "Right"]
    elif direction == "Down":
        door.append(Door(False, "Up", 0))
        choices = ["Down", "Left", "Right"]
    elif direction == "Left":
        door.append(Door(False, "Right", 0))
        choices = ["Up", "Left", "Down"]
    elif direction == "Right":
        door.append(Door(False, "Left", 0))
        choices = ["Up", "Down", "Right"]
    for x in range(0, 3):
        randDoorChance = random.randint(0, 99)
        isDoor = False
        if randDoorChance < 35:
            isDoor = True
        if isDoor == True:
            randDoor = random.randint(0, len(choices) - 1)
            lockedChance = random.randint(0, 100 / difficulty)
            lockedState = False
            if lockedChance <= 10:
                lockedState = True
            door.append(
                Door(lockedState, choices[randDoor],
                     random.randint(0, NUMBER_OF_DOORS - 1)))
            choices.pop(randDoor)
    numObjects = random.randint(0, 2)
    for i in range(0, numObjects):
        objType = random.randint(0, 2)
        objects.append(genObject(objType, difficulty))
    #Generate random room description
    Descriptions = Library.getDescriptionsList()
    Choice = random.randint(0, len(Descriptions) - 1)
    desc = "a " + Descriptions[Choice] + " room"
    retEnv = Environment(objects, desc, door)
    return retEnv
Exemple #12
0
def create_doors(level, positions):
    door_pos = positions
    for x in range(level):
        a = Door.Door()
        a.set_image(door_image)
        a.get_pos(level)
        pos_list = [a.x_pos, a.y_pos]

        while pos_list in door_pos:
            a.get_pos(level)
            pos_list = [a.x_pos, a.y_pos]

        door_list.append(a)
        door_pos.append([a.x_pos, a.y_pos])
        all_doors.append([a.x_pos, a.y_pos])
Exemple #13
0
    def openCurrentDoor(self):
        if self.__optionAneedToBePressed == False:

            nextDoor = self.__currentDoor.ouvrirPorte(
                self.__thisPathHistory, self.__completeEventsHistory,
                self.__passwordHistory)
            self.__currentDoor = Door(nextDoor)

            if nextDoor == "PorteGouffre":
                self.__optionAneedToBePressed = True
            else:
                self.__optionAneedToBePressed = False
        else:
            print(
                "\nTant que l’option (a) n’a pas été choisie, l’option (b) ne peut pas être choisie.\n"
            )
Exemple #14
0
    def __init__(self, player, clock):
        SceneBase.__init__(self)
        # creates the Player character in the location 20, 20
        self.player = player
        player.x = 30
        player.y = 30

        # Defines the starting positions of the first two Particles for level 3 of the game
        self.particle1 = Particle.Particle(90, 360, False, None, greenParticle,
                                           False)
        self.particle2 = Particle.Particle(
            90, 80, True, self.particle1, greenParticle,
            False)  # Particle 2 is entangled to Particle one

        # Defines the position for the first goal for level 3 of the game
        self.goal = Goal.Goal(720, 530)
        self.door = Door.Door(760, 100, 20, 100)
        # NOTE: Negative numbers in wall declarations ruin collision detection
        self.leftWall = Wall.Wall(0, 0, 20, 600)
        self.rightWall = Wall.Wall(780, 0, 20, 600)
        self.topWall = Wall.Wall(0, 0, 800, 20)
        self.bottomWall = Wall.Wall(0, 580, 800, 20)

        self.centerWallObstacle = Wall.Wall(20, 290, 780, 30)
        self.lowerWallObstacle = Wall.Wall(20, 390, 280, 20)
        self.middleWallObstacle = Wall.Wall(380, 300, 20, 180)
        self.rightWallObstacleOne = Wall.Wall(500, 450, 20, 130)
        self.rightWallObstacleTwo = Wall.Wall(580, 360, 200, 20)
        self.walls = [
            self.leftWall, self.rightWall, self.bottomWall, self.topWall,
            self.centerWallObstacle, self.lowerWallObstacle,
            self.middleWallObstacle, self.rightWallObstacleOne,
            self.rightWallObstacleTwo
        ]

        # Defines the objects that the Player character cannot pass through
        self.entities = [
            self.player, self.particle1, self.particle2, self.leftWall,
            self.rightWall, self.topWall, self.bottomWall,
            self.centerWallObstacle, self.lowerWallObstacle,
            self.middleWallObstacle, self.rightWallObstacleOne,
            self.rightWallObstacleTwo
        ]
        self.particles = [self.particle1, self.particle2]
        self.startTime = clock
Exemple #15
0
def putDoors():
    global doors
    global lg
    global enemies
    doors = []

    if (not len(enemies) == 0):
        if (lg.map[lg.tela[0] - 1][lg.tela[1]] != 0):
            doors.append(
                Door(int(size * 3 / 8), 0, int(size / 8), int(size / 80),
                     "left"))
            doors.append(
                Door(int(size * 4 / 8), 0, int(size / 8), int(size / 80),
                     "right"))

        if ((lg.map[lg.tela[0] + 1][lg.tela[1] + 1] != 0)):
            doors.append(
                Door(int(size * 3 / 8), int(size - size / 80), int(size / 8),
                     int(size / 80), "left"))
            doors.append(
                Door(int(size * 4 / 8), int(size - size / 80), int(size / 8),
                     int(size / 80), "right"))

        if ((lg.map[lg.tela[0]][lg.tela[1] - 1] != 0)):
            doors.append(
                Door(0, int(size * 3 / 8), int(size / 80), int(size / 8),
                     "up"))
            doors.append(
                Door(0, int(size * 4 / 8), int(size / 80), int(size / 8),
                     "down"))

        if ((lg.map[lg.tela[0]][lg.tela[1] + 1] != 0)):
            doors.append(
                Door(int(size - size / 80), int(size * 3 / 8), int(size / 80),
                     int(size / 8), "up"))
            doors.append(
                Door(int(size - size / 80), int(size * 4 / 8), int(size / 80),
                     int(size / 8), "down"))
Exemple #16
0
enemies = []

shops = []

clockTick = 60

andar = 0

lg = levelGenerator(player, bullets, seed, 10, size)
enemies = lg.getAtualMap().enemies
obstaculo = lg.getAtualMap().obstaculos
player.platforms = obstaculo
shops = lg.getAtualMap().shops

doors = [
    Door(int(size * 3 / 8), 0, int(size / 8), int(size / 80), "left"),
    Door(int(size * 4 / 8), 0, int(size / 8), int(size / 80), "right"),
    Door(int(size * 3 / 8), int(size - size / 80), int(size / 8),
         int(size / 80), "left"),
    Door(int(size * 4 / 8), int(size - size / 80), int(size / 8),
         int(size / 80), "right"),
    Door(0, int(size * 3 / 8), int(size / 80), int(size / 8), "up"),
    Door(0, int(size * 4 / 8), 10, int(size / 8), "down"),
    Door(int(size - size / 80), int(size * 3 / 8), int(size / 80),
         int(size / 8), "up"),
    Door(int(size - size / 80), int(size * 4 / 8), 10, int(size / 8), "down")
]
player.doors = doors


def changeSlice(nmap):
Exemple #17
0
os.environ['SDL_VIDEO_CENTERED'] = '1'  #centers the application window in the middle of the screen on startup
pygame.init()

#initialize the screen to size 800 x 600
gameDisplay = pygame.display.set_mode((1000, 1000))

#creates the Player character in the location 20, 20
player = Player.Player(30, 30,playerimage)

#Defines the starting positions of the first two Particles for level 1 of the game
particle1 = Particle.Particle(100, 100, False, None,redParticle,False)
particle2 = Particle.Particle(100, 200, True, particle1,blueParticle,False) #Particle 2 is entangled to Particle one

#Defines the position for the first goal for level 1 of the game
goal = Goal.Goal(400, 400)
door=Door.Door(760,300,20,100)

#NOTE: Negative numbers in wall declarations ruin collision detection
leftWall = Wall.Wall(0, 0, 20, 600)
rightWall = Wall.Wall(780, 0, 20, 600)
topWall = Wall.Wall(0, 0, 800, 20)
bottomWall = Wall.Wall(0, 580, 800, 20)
walls=[topWall,bottomWall,rightWall,leftWall]



#Defines the objects that the Player character cannot pass through

entities = [player,particle1, particle2, leftWall, rightWall, topWall, bottomWall]
particles=[particle1,particle2]
#rank by what you want to appear on what reversed
Exemple #18
0
import Door
import Gold
import time

#initialization
pygame.init()
name = input("Hello. What is your name? ")

screen_w = 750
screen_h = 750
size = [screen_w, screen_h]

screen = pygame.display.set_mode(size)

h = Hero.Hero(name)
d = Door.Door()
s = Spike.Spike()
g = Gold.Gold()

door_image = pygame.image.load("door.png")
door_rect = door_image.get_rect()
d.set_image(door_image)

spike_image = pygame.image.load("spike.png")
spike_rect = spike_image.get_rect()
s.set_image(spike_image)

gold_image = pygame.image.load("gold.png")
gold_rect = gold_image.get_rect()
g.set_image(gold_image)
    def __init__(self):
        pygame.init()  #start up pygame
        self.window = pygame.display.set_mode(
            (640, 790))  #set window size to 512, 512
        pygame.display.set_caption("Search")  #title window
        pygame.key.set_repeat(1, 80)
        import objects

        self.all_sprites = pygame.sprite.Group()
        self.all_tiles = pygame.sprite.Group()
        self.active_tiles = pygame.sprite.Group()
        self.inventoryWindow = pygame.sprite.Group(
        )  #create a sprite group for the inventory window
        self.doors = pygame.sprite.Group()
        self.active_doors = pygame.sprite.Group(
        )  #make sprite group for this room's doors that Horace can walk through
        self.inactive_doors = pygame.sprite.Group(
        )  #make sprite group for this room's doors that are closed so that they will change appearance but still be drawn (removing them
        #from self.active_doors won't actually cause them to disappear)
        self.status_bar = pygame.sprite.Group()
        self.entities = pygame.sprite.Group()
        self.props = pygame.sprite.Group()
        self.active_props = pygame.sprite.Group()
        self.active_message_boxes = pygame.sprite.Group(
        )  #sprite group to hold active message boxes
        self.active_option_boxes = pygame.sprite.Group()
        self.active_enemies = pygame.sprite.Group()
        self.title_screen = pygame.sprite.Group()
        self.minimap_group = pygame.sprite.Group()

        self.active_ground_items = pygame.sprite.Group()

        self.message_box_active = False  #check if there are active message boxes

        self.active_battle = pygame.sprite.Group()
        self.active_enemy_status_bar = pygame.sprite.Group()

        #for prop in objects.cave_plants:
        #    self.props.add(prop)

        self.clock = pygame.time.Clock()

        apple = item(
            self, 91, 91, "img/items/misc/apple_2.png", 'Apple', 2,
            'Here is an unnecessarily long description of an apple. It is entirely to test the function of the textWrapper class',
            True, 'common', 1)
        apple2 = item(self, 64, 64, "img/items/misc/apple_2.png", 'Apple', 2,
                      'Another apple', True, 'common', 1)
        apple3 = item(self, 64, 64, "img/items/misc/apple_2.png", 'Apple', 2,
                      'A third apple', True, 'common', 1)

        broken_gauntlets_statreq = {"STR": 1, "DEX": 0, "AGL": 0, "INT": 0}

        broken_cuirass_statreq = {"STR": 2, "DEX": 0, "AGL": 0, "INT": 0}

        broken_gauntlets_elembonus = {
            "LIGHT": 12,
            "DARK": 0,
            "FIRE": 0,
            "ICE": 0
        }

        broken_cuirass_elembonus = {"LIGHT": 2, "DARK": 3, "FIRE": 0, "ICE": 0}

        broken_greaves_statreq = {"STR": 0, "DEX": 0, "AGL": 0, "INT": 0}

        broken_greaves_elembonus = {"LIGHT": 0, "DARK": 0, "FIRE": 0, "ICE": 0}

        cracked_helmet_elembonus = {
            "LIGHT": 12,
            "DARK": 0,
            "FIRE": 0,
            "ICE": 0
        }

        cracked_helmet_statreq = {"STR": 0, "DEX": 0, "AGL": 0, "INT": 0}

        self.broken_gauntlets = Armor(self, "Broken gauntlets", 64, 64, 2,
                                      "Plate", broken_gauntlets_elembonus,
                                      broken_gauntlets_statreq, "arms",
                                      "broken", "gauntlets", 10,
                                      "A pair of broken gauntlets")

        self.broken_cuirass = Armor(self, "Broken cuirass", 64, 64, 3, "Plate",
                                    broken_cuirass_elembonus,
                                    broken_cuirass_statreq, "torso", "broken",
                                    "cuirass", 6, "A broken cuirass.")

        self.broken_greaves = Armor(self, "Broken greaves", 64, 64, 2, "Plate",
                                    broken_greaves_elembonus,
                                    broken_greaves_statreq, "legs", "broken",
                                    "greaves", 8, "A pair of broken greaves.")

        self.cracked_helmet = Armor(self, "Cracked helmet", 64, 64, 3, "Plate",
                                    cracked_helmet_elembonus,
                                    cracked_helmet_statreq, "head", "broken",
                                    "helmet", 8, "A cracked helmet.")

        broken_sword_statreq = {"STR": 2, "DEX": 0, "AGL": 0, "INT": 0}

        broken_sword_elembonus = {"LIGHT": 5}

        self.broken_sword = Weapon(
            self, "Broken sword", 64, 64, "Straight sword", "right", "medium",
            "piercing", 8, 8, broken_sword_elembonus, broken_sword_statreq,
            None, None, "broken_sword", 15,
            "Horace's guardsman's sword. Mostly ornamental, its blade is now broken in two by falling rubble."
        )

        inventory = [
            apple, apple2, apple3, self.broken_gauntlets, self.broken_cuirass,
            self.broken_greaves, self.cracked_helmet, self.broken_sword
        ]  #create very basic inventory array

        self.player = Player(self, 64, 64, inventory, 50, 50, 20, 20, 3, 5, 5,
                             3, 5, None, None, None, None, None, None)

        goblin_targetable_areas = [
            "Target: head", "Target: arms", "Target: legs", "Target: torso"
        ]

        self.goblin = Enemy(self, self.player, 384, 384, 2, "Goblin", 20, 20,
                            3, None, None, None, None, "Beast", "goblin",
                            goblin_targetable_areas)

        self.goblin_2 = Enemy(self, self.player, 256, 384, 2, "Goblin", 20, 20,
                              3, None, None, None, None, "Beast", "goblin",
                              goblin_targetable_areas)

        room_1_enemies = [self.goblin, self.goblin_2]

        self.rightDoor = Door(
            self, 9, 4, "right", True, "img/tile/chasm/chasm_door_right.png",
            "img/tile/chasm/chasm_wall_right.png"
        )  #initialize doors. There will be only four doors, each representing a cardinal direction. A room can have 1-4 doors.
        self.leftDoor = Door(self, 0, 4, "left", True,
                             "img/tile/chasm/chasm_door_left.png",
                             "img/tile/chasm/chasm_wall_left.png")
        self.forwardDoor = Door(self, 4, 0, "forward", True,
                                "img/tile/chasm/chasm_door_top.png",
                                "img/tile/chasm/chasm_wall_top.png")
        self.backwardDoor = Door(self, 4, 9, "backward", True,
                                 "img/tile/chasm/chasm_door_bottom.png",
                                 "img/tile/chasm/chasm_wall_top.png")

        self.display_inventory = False  #flag to check whether the inventory window is open or not

        self.z1r1 = Room(
            self, "base", [self.backwardDoor], "img/tile/chasm/chasm_01.png",
            "img/tile/chasm/chasm_01_full.png", objects.props_z1r1,
            room_1_enemies
        )  #initialize some basic rooms, each with a different background image to tell them apart.
        #enter a list of doors to represent the doors of the room.
        self.z2r2 = Room(self, "base",
                         [self.backwardDoor, self.forwardDoor, self.rightDoor],
                         "img/tile/chasm/chasm_01.png",
                         "img/tile/chasm/chasm_01_full.png",
                         objects.props_z1r2, [])
        self.z3r3 = Room(self, "base", [self.forwardDoor],
                         "img/tile/chasm/chasm_01.png",
                         "img/tile/chasm/chasm_01_full.png",
                         objects.props_z1r3, [])
        self.z4r4 = Room(self, "base", [self.leftDoor],
                         "img/tile/chasm/chasm_01.png",
                         "img/tile/chasm/chasm_01_full.png",
                         objects.props_z1r4, [])

        self.ZONE1 = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0],
                      [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0],
                      [0, self.z1r1, 0, 0, 0, 0],
                      [0, self.z2r2, self.z4r4, 0, 0, 0],
                      [0, self.z3r3, 0, 0, 0, 0]]

        self.battle = False

        self.titlescreen = TitleScreen(self, 0, 0)

        self.clock_group = pygame.sprite.Group()

        #create a 2D array of rooms to represent this zone.

        #self.currentLocation =

        #self.z1r1 = Room(self, "base", "door", "img/tile/chasm/chasm_01.png") #create a new Room object (see assets.py)
        #for x in range(0, 8):
        #    for y in range(0, 8):
        #        self.active_tiles.add(self.z1r1.tiles[x][y])
        #fill the active_tiles sprite group with the tiles from the room object

        #create some random items

        #messages = ["Yes", "No", None, None]
        #dialogBox = optionBox(self, 64, 512, self.player, messages, "Will you accept the blessing?")
        #dialogBox.add(self.active_option_boxes)

        pygame.font.init()

        self.clock = pygame.time.Clock()

        self.prevKey = None

        self.minimap = Minimap(self, 500, 500, "minimap", self.player)
Exemple #20
0
def layout_level9(screen):
    p3_width = 50
    p_height = 50
    p_width = 100
    p4_height = 105
    p4_width = 15

    platforms = []

    platforms.append(Block(450, 70, p_width, p_height, "block1.png"))
    platforms.append(Block(250, 175, p_width, p_height, "block1.png"))
    platforms.append(Block(450, 280, p_width, p_height, "block1.png"))
    platforms.append(Block(350, 385, p_width, p_height, "block1.png"))
    platforms.append(Block(50, 490, p_width, p_height, "block1.png"))
    platforms.append(Block(450, 490, p_width, p_height, "block1.png"))
    platforms.append(Block(250, 490, p_width, p_height, "block1.png"))

    platforms.append(Block(50, 175, p_width, p_height, "block2.png"))
    platforms.append(Block(150, 280, p_width, p_height, "block2.png"))
    platforms.append(Block(750, 280, p_width, p_height, "block2.png"))
    platforms.append(Block(550, 385, p_width, p_height, "block2.png"))
    platforms.append(Block(550, 490, p_width, p_height, "block2.png"))

    platforms.append(Block(125, 70, p3_width, p_height, "block3.png"))
    platforms.append(Block(625, 70, p3_width, p_height, "block3.png"))
    platforms.append(Block(775, 70, p3_width, p_height, "block3.png"))
    platforms.append(Block(375, 175, p3_width, p_height, "block3.png"))
    platforms.append(Block(425, 175, p3_width, p_height, "block3.png"))
    platforms.append(Block(25, 280, p3_width, p_height, "block3.png"))
    platforms.append(Block(75, 385, p3_width, p_height, "block3.png"))
    platforms.append(Block(175, 385, p3_width, p_height, "block3.png"))
    platforms.append(Block(725, 490, p3_width, p_height, "block3.png"))

    # Walls
    platforms.append(Block(200, 70, p4_width, p4_height, "block4.png"))
    platforms.append(Block(300, 70, p4_width, p4_height, "block4.png"))
    platforms.append(Block(700, 70, p4_width, p4_height, "block4.png"))
    platforms.append(Block(100, 175, p4_width, p4_height, "block4.png"))
    platforms.append(Block(200, 175, p4_width, p4_height, "block4.png"))
    platforms.append(Block(300, 280, p4_width, p4_height, "block4.png"))
    platforms.append(Block(500, 280, p4_width, p4_height, "block4.png"))
    platforms.append(Block(600, 280, p4_width, p4_height, "block4.png"))
    platforms.append(Block(700, 385, p4_width, p4_height, "block4.png"))
    platforms.append(Block(100, 385, p4_width, p4_height, "block4.png"))
    platforms.append(Block(300, 490, p4_width, p4_height, "block4.png"))
    platforms.append(Block(500, 490, p4_width, p4_height, "block4.png"))

    #Floor
    platforms.append(Block(50, 590, p_width, p_height, "block1.png"))
    platforms.append(Block(150, 590, p_width, p_height, "block1.png"))
    platforms.append(Block(250, 590, p_width, p_height, "block1.png"))
    platforms.append(Block(350, 590, p_width, p_height, "block1.png"))
    platforms.append(Block(450, 590, p_width, p_height, "block1.png"))
    platforms.append(Block(550, 590, p_width, p_height, "block1.png"))
    platforms.append(Block(650, 590, p_width, p_height, "block1.png"))
    platforms.append(Block(750, 590, p_width, p_height, "block1.png"))

    lampHeight = lampImage.get_height()

    lampList = [
        Lamp((25, 280), lampImage, lightAlpha, 25),
        Lamp((50, 590), lampImage, lightAlpha, 20),
        Lamp((250, 175), lampImage, lightAlpha, 10),
        Lamp((600, 590), lampImage, lightAlpha, 5),
        Lamp((625, 70), lampImage, lightAlpha, 20)
    ]

    letter = Letter(pygame.image.load('Assets/Letters/letter5.png'),
                    (450, 280))

    doorList = [Door((350, 590), False), Door((550, 590), True)]

    return platforms, lampList, doorList, letter
input("Press Enter to Continue...")
print(
    "This is your father's castle. Yet your adventure does not start in the throne room, or the dining room, or even your bedroom."
)
input("Press Enter to Continue...")
print(
    "You have awoken this morning locked in the jail cell in the cellar of the castle. Surrounded by rats and other undesirables."
)
input("Press Enter to Continue...")
print("Your memory slowly returns as you clear the sleep from your eyes...")
print(
    "You remember the violent murder of your father at the hands of your uncle\nYou realize your uncle must have thrown you in the jail to keep you out of the way"
)
print("until he can fully take over the kingdom!")
input("Press Enter to Continue...")
print(
    "You quickly escape the jail cell and decide to confront your uncle in the throne room!"
)
input("Press Enter to Continue...")
#Game Starts Here!
#Predefined location, with one potion type random item.
JailCell = Environment([EnvironmentGenerator.genObject(2, difficulty)],
                       "smelly dark room outside your jail cell",
                       [Door(False, "Up", 0)])
print(JailCell.toString())

#Testing RunCode
while (1):
    input("Press Enter to Continue...")
    print(EnvironmentGenerator.genEnvironment(difficulty, "Up").toString())