Exemple #1
0
    def __init__(self):
        tile_renderer = tilerender.Renderer(os.path.join(MAIN_DIR, "map.tmx"))
        self.map_surface, self.fringe_layer = tile_renderer.make_map(
            self.hero.rect.x, self.hero.rect.y)

        self.map_rect = self.map_surface.get_rect()

        self.blockers = tile_renderer.get_blockers()
Exemple #2
0
    def __init__(self):
        self.tmx_file = os.path.join(os.getcwd(), 'test.tmx')
        self.tile_renderer = tilerender.Renderer(self.tmx_file)
        self.map_surface = self.tile_renderer.make_map()
        self.map_rect = self.map_surface.get_rect()

        self.blockers = self.make_blockers('blocker')

        self.player = self.make_player()
Exemple #3
0
    def startup(self, current_time, game_data):
        self.game_data = game_data
        self.current_time = current_time
        self.renderer = tilerender.Renderer(self.tmx_map)
        self.map_image = self.renderer.make_map()

        self.viewport = self.make_viewport(self.map_image)
        self.level_surface = self.make_level_surface(self.map_image)
        self.level_rect = self.level_surface.get_rect()
Exemple #4
0
    def __loadScenes(self, lazy=False):
        tree = ET.parse(os.path.join(DATA_DIR, 'scenes.xml'))
        root = tree.getroot()
        self.active_sprite_list = pygame.sprite.Group()
        for scene in root:
            if scene.attrib['id'] == self.scene:
                tile_renderer = tilerender.Renderer(
                    os.path.join(MAIN_DIR, scene.attrib['file_path']))
                for npc in scene.findall('npc'):
                    if npc.get('type', '') == 'enemy':
                        new_npc = character.NPC(npc)
                        self.active_sprite_list.add(new_npc)
                    else:
                        new_enemy = character.Enemy(npc)
                        self.active_sprite_list.add(new_enemy)

                self.map_surface, self.fringe_layer = tile_renderer.make_map(
                    self.hero.rect.x, self.hero.rect.y)
                self.map_rect = self.map_surface.get_rect()
                self.blockers = tile_renderer.get_blockers()
                self.portals = tile_renderer.get_portals()
Exemple #5
0
gui_sprites = pygame.sprite.Group(health_bar, mana_bar)
collidables = pygame.sprite.Group(enemy_sprites, platform_objects)
game_objects = pygame.sprite.Group(enemy_sprites, player_sprite, platform_objects)
# Every single sprite
all_sprites = pygame.sprite.Group(enemy_sprites, player_sprite, platform_objects, gui_sprites)
#------------------------------------------------------------------------
# Background music
backsound_sound = pygame.mixer.music
backsound_sound.load("Resources/Audio/ambientSounds.mp3")

clock = pygame.time.Clock()

screen_rect = screen.get_rect()

tmx_file = "Resources/test.tmx"
tile_renderer = tilerender.Renderer(tmx_file)

map_surface = tile_renderer.make_map()
map_rect = map_surface.get_rect()
background = pygame.image.load("Resources/Single photos/background.png")


done = False
while not done:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            done = True
        elif event.type == pygame.KEYDOWN:
            if event.key == pygame.K_e:
                player.Attack(screen, enemy_sprites)
                print(str(squid.health))
Exemple #6
0
 def __init__(self, screen):
     self.screen = screen
     self.renderer = tilerender.Renderer('test.tmx')
     self.map_image = self.renderer.make_map()
     self.viewport = self.make_viewport(self.map_image)
     self.level_surface = self.make_level_surface(self.map_image)
	def __init__(self):
		self.tmx_map = os.path.join(os.getcwd(), 'test.tmx')
		self.renderer = tilerender.Renderer(self.tmx_map)
		self.map_image = self.renderer.make_map()
		self.level_surface = self.make_level_surface(self.map_image)
		self.level_rect = self.level_surface.get_rect()