def __init__(self, screen, tilex, tiley, set="brown", tileclass="wall"): x = (tilex - (FULL_TILES_HOR - TILES_HOR) + 0.5) * TILE_DIM y = (tiley - (FULL_TILES_VER - TILES_VER) + 0.5) * TILE_DIM VisibleObject.__init__(self, screen, x, y) self.animations["default"] = Animation(set, tileclass) self.image = self.animations[self.current_animation].update_and_get_image() self.rect = self.image.get_rect() self.tilex = tilex self.tiley = tiley self.tileclass = tileclass self.aligned = True return
def __init__(self, screen, x, y, life = -1, gravity = False, colliding = False): VisibleObject.__init__(self, screen, x, y) self.dx = 0.0 self.dy = 0.0 self.initial_x = x self.initial_y = y self.gravity = gravity self.colliding = colliding self.active = (self.x + self.rect.width / 2 > 0) and (self.y + self.rect.height / 2 > 0) self.on_ground = False self.life = life self.destructable = True if (self.life == -1): self.destructable = False return
def __init__(self, screen, x = None, y = None, set = "brown", itemclass = "key", max_activations = 1, trigger_type = None): VisibleObject.__init__(self, screen, x, y) self.animations["default"] = Animation(set, itemclass) try: self.animations["broken"] = Animation(set, itemclass + "_broken") except: self.animations["broken"] = self.animations["default"] self.image = self.animations[self.current_animation].update_and_get_image() self.rect = self.image.get_rect() self.itemclass = itemclass self.activated_times = 0 self.max_activations = max_activations self.trigger = None if trigger_type != None: self.trigger = Trigger(trigger_type, x, y) else: self.pickable = True return