Possible sprite-generating code, some weird error left to fix