Add sprites generation
Fix bug of function placement