def getAnimForXY(self, x, y, isCurrent = False): #FIXME : hack, accounting for the possible margin between the # event box bounds and the atlas bounds. I'm ashamed for i, anim in enumerate(self.animations): try: if is_contained_by(x, y, anim.texturex, anim.texturey, anim.texturew * anim.tilelen, anim.textureh): if isCurrent: self.currentAnim = i return anim except KeyError: pass
def getSpriteForXY(self, x, y, isCurrent = False): #FIXME : hack, accounting for the possible margin between the # event box bounds and the atlas bounds. I'm ashamed for i, sprite in enumerate(self.sprites): try: if is_contained_by(x, y, sprite.texturex, sprite.texturey, sprite.texturew, sprite.textureh): if isCurrent: self.currentSprite = i return sprite except KeyError: pass