Exemple #1
0
    def check_images_size(self):
        from data.modules.graphic.image_modificator import resize_image
        for key in self.sprites:
            self.sprites[key]['sprite'] = resize_image(
                self.screen, self.sprites[key]['sprite'])

        for key in self.item_sprites:
            self.item_sprites[key]['sprite'] = resize_image(
                self.screen, self.item_sprites[key]['sprite'])
Exemple #2
0
 def load_object(self, object, object_sprite):
     object_sprite.small_position = object.coordinate
     object_sprite.image = resize_image(self.screen, object_sprite.image)
     size = object_sprite.image.get_size()
     object_sprite.big_position = (object.coordinate[0] * size[0],
                                   object.coordinate[1] * size[1])
     self.objects_sprite_menager.add(object_sprite)
Exemple #3
0
 def load_person(self, person, person_sprite):
     person_sprite.small_position = person.coordinate
     person_sprite.image = resize_image(self.screen, person_sprite.image)
     size = person_sprite.image.get_size()
     person_sprite.big_position = (person.coordinate[0] * size[0],
                                   person.coordinate[1] * size[1])
     self.person_sprite_menager.add(person_sprite)
Exemple #4
0
    def load_terrain(self, terrain, key, map):
        terrain_images = {
            'id': key,
            'image': resize_image(self.screen, terrain['sprite'])
        }
        size = terrain_images['image'].get_size()

        self.terrain_images.append(terrain_images)

        for y in range(len(map.map)):
            for x in range(len(map.map[y])):
                if map.map[y][x] == int(key):
                    terrain_sprite = TerrainSprite()
                    terrain_sprite.image_id = key
                    terrain_sprite.small_position = (x, y)
                    terrain_sprite.big_position = (x * size[0], y * size[1])
                    self.terrain_sprites.add(terrain_sprite)