Example #1
0
 def loadWeapon(self, name):
     """
     Uses the weapon config file to load all weapon characteristics.
     """
     config_file = open(os.path.join('rec', 'weapon', name, 'config.py')).read()
     exec(config_file)
     self.hold_image = img_load(os.path.join('rec', 'weapon', name, 'hold.png')).convert_alpha()
     if os.path.exists(os.path.join('rec', 'weapon', name, 'attack.png')):
         self.attack_image = img_load(os.path.join('rec', 'weapon', name, 'attack.png')).convert_alpha()
     else:
         self.attack_image = Surface([1, 1])
Example #2
0
 def load(self, name):
     config_file = open(os.path.join('rec', 'weapon', name, 'config.py')).read()
     exec(config_file)
     self.frames = []
     for fi in os.listdir(os.path.join('rec', 'weapon', name)):
         if '.png' in fi:
             self.frames.append(img_load(os.path.join('rec', 'weapon', name, fi)))
     self.changeUpdate()
Example #3
0
 def loadFrames(self, name):
     """
     Loads all projectile frames ending in .png.
     """
     frames = []
     for fi in os.listdir(os.path.join('rec', 'projectile', name)):
         if '.png' in fi:
             frames.append(img_load(os.path.join('rec', 'projectile', name, fi)))
     return frames
Example #4
0
 def loadFrames(self, name):
     """
     Loads all projectile frames ending in .png.
     """
     frames = []
     for fi in os.listdir(os.path.join('rec', 'projectile', name)):
         if '.png' in fi:
             frames.append(
                 img_load(os.path.join('rec', 'projectile', name, fi)))
     return frames
Example #5
0
    def _load_pack(name):
        pathfile = path.join(IMAGES_DIR, '%s.png' % name)
        image = img_load(pathfile)

        return {
            Direction.UP: image,
            Direction.LEFT: rotate(image, 90),
            Direction.DOWN: rotate(image, 180),
            Direction.RIGHT: rotate(image, 270),
        }
Example #6
0
 def getSurface(self, name):
     fi_name = name.lower().replace(' ', '_') + '.png'
     return img_load(os.path.join(self.game.main_path, 'rec', 'weapon', name, fi_name))
Example #7
0
 def getSurface(self, name):
     fi_name = name.lower().replace(' ', '_') + '.png'
     return img_load(os.path.join(self.game.main_path, 'rec', 'weapon', name, fi_name))
Example #8
0
 def _load_simple(name):
     pathfile = path.join(IMAGES_DIR, '%s.png' % name)
     return img_load(pathfile)