def process_file(self, filename):
     try:
         self.load_file(ccResourcePaths.get_keys() + filename)
     except:
         ccLogger.error('{} could not be loaded.'.format(filename))
         raise RuntimeError('{} could not be loaded.'.format(filename))
     self.__process_keys()
    def process_file(self, filename):
        try:
            self.load_file(ccResourcePaths.get_sounds() + filename)

        except:
            ccLogger.error(str(filename) + ' file could not be loaded.')
            raise RuntimeError('File could not be loaded.')
        self.__process_sounds()
 def process_file(self, filename):
     try:
         self.load_file(filename)
     except:
         ccLogger.error('{} could not be loaded.'.format(filename))
         raise RuntimeError('{} could not be loaded.'.format(filename))
     self.__process_config()
     self.__process_object_sections()
 def package_check():
     cache = apt.Cache()
     if cache['pylint'].is_installed and cache['graphviz'].is_installed:
         ccLogger.trace('Packages for UML creation are installed. Creating UML images.')
         return True
     else:
         ccLogger.error('Required packages not installed. Please execute the following: '
                        'sudo apt-get install pylint, sudo apt-get install graphviz')
         return False
def test_cclogger():
    ccLogger.trace("Starting in ..")
    for counter in range(5, -1, -1):
        ccLogger.trace("..", counter, "..")

    ccLogger.error("Sample: Something went wrong", 4, 3.5)
    ccLogger.warning("Sample: There are some problems", 500, 234.45)
    ccLogger.trace("The program is running", 2.345667777777777777, 45667)
    try:
        logger = ccLogger("Logger can't be intantiated and this is intended.")
    except:
        pass
    ccLogger.trace("Exiting..")
    def load(self, anim_data):
        try:
            super().load(anim_data)
            if 'animations' in anim_data:
                for anim_name in anim_data['animations']:
                    anim = ccSpriteManager.get_sprite(anim_name)
                    self.anims.append(anim)
            if 'start_anim' in anim_data:
                self.current_anim = ccSpriteManager.get_sprite(
                    anim_data['start_anim'])
                self.current_frame = self.current_anim.get_frame(0)
                self.active_sprite = self.current_frame.get_sprite()
                self.set_hitbox()

        except:
            ccLogger.error('Sprite could not be loaded.: ')
            raise RuntimeError('Sprite could not be loaded.')
Exemple #7
0
    def objecthit(self, other_obj):
        # if self.hitbox.y + self.hitbox.height <= other_obj.hitbox.y + other_obj.hitbox.height and self.velocity.y >= 0:
        #     self.velocity.y = 0
        #     local_hitbox_y = self.hitbox.y
        #     self.hitbox.y = other_obj.hitbox.y - self.hitbox.height
        #     self.position.y -= local_hitbox_y - self.hitbox.y
        #     if self.jumping is False and \
        #             ccKeyEventHandler.get_is_right_pressed() and \
        #             self.position.x < self.desired_position:
        #         self.position.x += 1  # to compensate the stuck/jump when it's going backwards a bit
        # else:
        #     outpos_x = 0
        #     outpos_y = 0
        #     intersect = self.hitbox.clip(other_obj.hitbox)
        #     if (self.velocity.y > 0 and self.jumping is False) or intersect.width < intersect.height:
        #         if self.hitbox.x < other_obj.hitbox.x:
        #             outpos_x = -intersect.width
        #             ccGlobals.blocked = True
        #         else:
        #             outpos_x = intersect.width
        #     else:
        #         if self.hitbox.y < other_obj.hitbox.y:
        #             outpos_y = -intersect.height
        #         else:
        #             outpos_y = intersect.height
        #     self.position.x += outpos_x
        #     self.position.y += outpos_y
        #     self.hitbox.x += outpos_x
        #     self.hitbox.y += outpos_y

        intersect = self.hitbox.clip(other_obj.hitbox)
        outpos_x = 0
        outpos_y = 0

        if self.velocity.y > 0:  # falling down
            if other_obj.velocity.x == 0 and other_obj.velocity.y == 0:  # other is standing
                if self.hitbox.height / 2 > intersect.height:
                    ccLogger.error("first")
                    if self.hitbox.y > other_obj.hitbox.y:  # move Y position based on collision positions
                        ccLogger.error("if")
                        outpos_y = intersect.height
                    else:
                        ccLogger.error("else")
                        outpos_y = -intersect.height
                else:
                    ccLogger.error("walking")
                    if self.hitbox.x < other_obj.hitbox.x:  # move X position based on collision positions
                        outpos_x = -intersect.width
                        ccGlobals.blocked = True
                    else:
                        outpos_x = intersect.width
            else:
                ccLogger.error("Missing implementation")
        else:  # jumping or walking
            ccLogger.error("else ág")
            if other_obj.velocity.x == 0 and other_obj.velocity.y == 0:  # other is standing
                if self.hitbox.x < other_obj.hitbox.x:  # move X position based on collision positions
                    outpos_x = -intersect.width
                    ccGlobals.blocked = True
                else:
                    outpos_x = intersect.width

        self.position.x += outpos_x
        self.position.y += outpos_y
        self.hitbox.x += outpos_x
        self.hitbox.y += outpos_y
Exemple #8
0
 def get_height(self):
     if self.height == 0:
         ccLogger.error("Error: height is zero.")
     return self.height
 def draw(self, renderer):
     ccLogger.error(
         "ccObject is an abstract class, yon can't call the draw function!")
     raise NotImplementedError
 def step(self, time_passed):
     time = time_passed
     ccLogger.error("Error: step does not work at the moment.")
     error_message = ccLogger("Error: step does not work at the moment.")
 def draw(self):
     ccLogger.error("Error: could not draw scene.")
     error_message = ccLogger("Error: could not draw scene.")
 def load(self, filename):
     ccLogger.error("Error: file not loaded.")
     error_message = ccLogger("Error: file not loaded.")
 def get_sprite(cls, sprite_name):
     sprite = cls.sprites.get(sprite_name)
     if sprite:
         return sprite
     ccLogger.error(sprite_name + " not found.")
 def get_texture(cls, texture_name):
     texture = cls.textures.get(texture_name)
     if texture:
         return texture
     ccLogger.error(texture_name + " not found.")
     return None
Exemple #15
0
 def get_texture(self):
     if self.image is None:
         ccLogger.error("Error: there is no image stored.")
     return self.image
 def add_anim(self, anim):
     if type(anim) == 'ccAnimSprite':
         self.anims.append(anim)
     else:
         ccLogger.error('Not Anim sprite' + type(anim))
Exemple #17
0
 def __init__(self):
     ccLogger.error("ccResourcePath can not be instantiated")
     raise NotImplementedError
Exemple #18
0
 def get_width(self):
     #give back loaded texture's width. print error if no texture is loaded and give back 0
     if self.width == 0:
         ccLogger.error("Width is zero!")
     return self.width
 def __init__(self):
     ccLogger.error("ccResourcePath is an abstract class, can't call __init__!")
     raise NotImplementedError
Exemple #20
0
 def get_height(self):
     #give back loaded texture's height. print error if no texture is loaded and give back 0
     if self.height == 0:
         ccLogger.error("Height is zero!")
     return self.height
Exemple #21
0
 def get_texture(self):
     #give back the texture stored. If no texture, give back None and print error msg
     if self.image is None:
         ccLogger.error("There is no image!")
     return self.image
Exemple #22
0
 def get_width(self):
     if self.width == 0:
         ccLogger.error("Error: width is zero.")
     return self.width