def __init__(self, screen_width, screen_height): Entity.__init__(self, screen_width, 0, Icicle.name) # Take off 7 for a buffer on the bottom self.counted = False self.ice_blocks = [] # at what point in num_blocks we add the gap num_possible_gaps = int(screen_height / Ice.image_height) - 6 gap = random.randint(1, num_possible_gaps) num_blocks = 0 height = 0 while height < screen_height: # Add the middle pieces if we reach the gap point if num_blocks == gap: self.ice_blocks.append(Ice(Ice.image_bottom, screen_width, height, Ice.icicle_type)) top = height height += Icicle.gap_size bottom = height self.gap_range = (top, bottom) self.ice_blocks.append(Ice(Ice.image_top, screen_width, height, Ice.icicle_type)) else: self.ice_blocks.append(Ice(Ice.image_base, screen_width, height, Ice.icicle_type)) num_blocks += 1 height += Ice.image_height
def __init__(self, pos, sprite_close, sprite_open, potential_items): Entity.__init__(self, "Chest", pos, sprite_close) self.sprite_open_link = sprite_open self.sprite_close_link = sprite_close self.sprite_open = pg.transform.scale(pg.image.load(sprite_open).convert_alpha(), (TILE_SIZE, TILE_SIZE)) self.item = Chest.determine_item(potential_items) self.opened = False
def __init__(self, name, pos, sprite, sprite_empty, effect, times): Entity.__init__(self, name, pos, sprite) self.effect = effect self.times = times self.sprite_empty = pg.transform.scale( pg.image.load(sprite_empty).convert_alpha(), (TILE_SIZE, TILE_SIZE))
def __init__(self, name, pos, sprite, hp, defense, res): Entity.__init__(self, name, pos, sprite) self.hp_max = hp self.hp = hp self.defense = defense self.res = res
def __init__(self, name, pos, sprite, interaction=None): Entity.__init__(self, name, pos, sprite) self.sprite_name = sprite self.interaction = interaction
def __init__(self, pos, sprite, pick_lock_initiated): Entity.__init__(self, "Door", pos, sprite) self.sprite_name = sprite self.pick_lock_initiated = pick_lock_initiated
def __init__(self, name, pos, sprite, interaction={}): Entity.__init__(self, name, pos, sprite) self.interaction = interaction
def __init__(self, name, pos_first, sprite): Entity.__init__(self, name, pos_first, sprite) self.linked_to = None
def __init__(self, pos_first, sprite): Entity.__init__(self, "Portal", pos_first, sprite) self.linked_to = None