def __init__(self, pos): self.x = pos[0] self.y = pos[1] rng = random.randint(0, 2) self.sprite = EditorUtilities.create_image( Engine.subsurface(GC.IMAGESDICT['Snow'], (0, rng * 8, 8, 8))) self.speed = random.choice([1.0, 1.5, 2.0, 2.5, 3.0]) self.remove_me = False self.floor = False
def __init__(self, pos): self.x = pos[0] self.y = pos[1] self.full_sprite = GC.IMAGESDICT['FireParticle'] self.sprites = [ EditorUtilities.create_image( Engine.subsurface(self.full_sprite, (0, i * 2, 3, 2))) for i in range(6) ] self.speed = random.randint(1, 4) self.remove_me = False self.sprite = self.sprites[-1]
class DefaultUnit(object): portrait = Engine.subsurface(GC.UNITDICT['GenericPortrait'], (0, 0, 96, 80)).convert_alpha() chibi = Engine.subsurface(GC.UNITDICT['GenericPortrait'], (96, 16, 32, 32)).convert_alpha() def __init__(self): self.id = 0 self.name = '' self.level = 1 self.gender = 0 self.faction = '' self.klass = 'Citizen' self.tags = set() self.desc = '' self.stats = SaveLoad.build_stat_dict(class_dict[self.klass]['bases']) self.growths = [0 for n in xrange(cf.CONSTANTS['num_stats'])] self.items = [] self.skills = [] self.wexp = [ 0 for n in xrange(len(CustomObjects.WEAPON_TRIANGLE.types)) ] self.team = 'player'
def __init__(self, info, portrait_data): self.id = info['id'] self.name = info['name'] self.level = int(info['level']) self.gender = int(info['gender']) self.faction = info['faction'] self.klass = info['klass'] self.tags = info['tags'] self.desc = info['desc'] self.stats = info['stats'] self.growths = info['growths'] self.wexp = info['wexp'] self.items = info['items'] self.skills = info['skills'] self.team = 'player' blink_pos = (0, 0) mouth_pos = (0, 0) try: # Ex: HectorPortrait if self.name in portrait_data: blink_pos = portrait_data[self.name]['blink'] mouth_pos = portrait_data[self.name]['mouth'] self.portrait = UnitPortrait(self.name, blink_pos, mouth_pos, (0, 0)) self.chibi = Engine.subsurface(GC.UNITDICT[self.name + 'Portrait'], (96, 16, 32, 32)).convert_alpha() except KeyError: self.portrait = UnitPortrait('Generic', blink_pos, mouth_pos, (0, 0)) self.chibi = GC.UNITDICT[self.faction + 'Emblem'].convert_alpha()
def __init__(self, num, name, kind): self.num = num self.name = name self.kind = kind self.image = Engine.subsurface(GC.ICONDICT['TileInfoIcons'], (0, num * 16, 16, 16))
def create_cursor(): sprite = GC.IMAGESDICT['Cursor'] # Sprites are in 64 x 64 boxes activesprite = Engine.subsurface(sprite, (0, 64, 32, 32)).convert_alpha() return create_image(activesprite)
def create_chibi(name): return Engine.subsurface(GC.UNITDICT[name + 'Portrait'], (96, 16, 32, 32)).convert_alpha()