def __init__(self, pos): Object.__init__(self, pos) self.hp = self.max_hp # ai is defined in the individual mob type's class # we need a new instance of it for the object if self.ai: self.ai = copy.copy(self.ai) self.ai.owner = self
def __init__(self, pos, damage, color, dx, dy): Object.__init__(self, pos) self.damage = damage self.color = color self.dx = dx self.dy = dy self.char = self.chars[(self.dx, self.dy)] self.life = BULLET_LIFE # on creation, check for anyone directly in its way # so that if player fires a bullet at something adjacent to him, # it doesn't get a blow in before it dies # it feels better this way when playing # hackish way of doing it though: update, then roll back updates self.update() if not self.dead: self.x -= self.dx self.y -= self.dy self.life += 1
def __init__(self, mob): Object.__init__(self, (mob.x, mob.y)) self.name = 'remains of ' + mob.name