Beispiel #1
0
 def __init__(self):
     """ Creates the display surface and loads the game assets. """
     
     pygame.init()
     log.info("Initializing display surface at {}x{}".format(
         data.SCREEN_RESOLUTION[0], data.SCREEN_RESOLUTION[1]))
     self.screen = pygame.display.set_mode(data.SCREEN_RESOLUTION)
     pygame.display.set_caption("digital heist")
     
     # load image resources
     exhibition.images(os.path.join(data.DATA_DIR, "images"))
     exhibition.optimize()
     
     self.level = level1.Level1()
     self.input = inputdevice.KeyboardInput()
Beispiel #2
0
    def __init__(self):
        super().__init__()
        
        p = player.Player((80.0, 80.0))
        m = map.Map(os.path.join(data.DATA_DIR, "maps", "map1.txt"))
        area1 = area.Area(p, m, self)
        
        computer1 = objects.computer.Computer(
            exhibition.images()["computer"],
            pygame.Rect(map.Map.tile_to_world_coords((3, 3)), (TILE_SIZE/2, TILE_SIZE/2)),
            pygame.Rect(map.Map.tile_to_world_coords((3, 3)), (TILE_SIZE/2, TILE_SIZE/2)),
            area1
        )
        
        exitdoor = objects.lvl1door.Level1Door(
            pygame.Rect(map.Map.tile_to_world_coords((0, 1)), (TILE_SIZE, TILE_SIZE)),
            pygame.Rect(map.Map.tile_to_world_coords((0, 1)), (TILE_SIZE, TILE_SIZE)),
            area1
        )
        
        area1.interactables["comp1"] = computer1
        area1.interactables["exitdoor"] = exitdoor
        
        g1 = guard.PatrollingGuard(m, [(6, 1), (14, 1), (4, 3), (1, 5)])
        area1.guards["g1"] = g1

        self.areas[1] = area1
        self.area = self.areas[1]
        
        self.mission_state = Level1State.LookingForData
Beispiel #3
0
 def __init__(self, _map, pos):
     self.pos = pygame.Rect(pos, (32, 32))
     self.image = exhibition.images()["guard"]
     self.map = _map
     self.move_speed = 6
     self.vel = collections.namedtuple('velocity', ['x', 'y'])
     self.vel.x, self.vel.y = 0, 0
Beispiel #4
0
 def __init__(self, starting_position):
     """ Creates a player at the specified (x, y) starting position. """
     
     self.area = None
     self.pos = collections.namedtuple('position', ['x', 'y'])
     self.pos.x, self.pos.y = starting_position
     self.image = exhibition.images()["player"]
     self.vel = collections.namedtuple('vector', ['x', 'y'])
     self.dir = None
     self.vel.x, self.vel.y = 0.0, 0.0
     self.move_speed = 4.0
     self.rect = None
     self.collision_rect = None
     self.fix_rect()
Beispiel #5
0
 def __init__(self, pos):
     super().__init__(pos)
     self.image = exhibition.images()["vwalldoor"]
     self.collision_rect = pygame.Rect(self.rect)
     self.collision_rect.width /= 8
     self.collision_rect.center = self.rect.center
Beispiel #6
0
 def __init__(self, pos):
     super().__init__(pos)
     self.image = exhibition.images()["missing"]
     log.error("Missing tile created at {}, {}".format(pos[0], pos[1]))
Beispiel #7
0
 def __init__(self, pos):
     super().__init__(pos)
     self.collision_rect = self.rect
     self.image = exhibition.images()["wall"]
Beispiel #8
0
 def __init__(self, pos):
     super().__init__(pos)
     self.image = exhibition.images()["floor"]
Beispiel #9
0
 def __init__(self, location, collision_rect, area):
     
     super().__init__(exhibition.images()["vwalldoor"], location, collision_rect, area)