LUASprites
Example Place | SpriteSheet Manager Module | PyPi | Source Code
Generate spritesheets and code at the same time
Sprite sheets increase the performance of your game, reduce loading/startup time, and use less memory overall (Which is especially beneficial on mobile devices). They are also a pain to create/handle/manage on Roblox. I wanted to compile images onto sprite sheets and then quickly reference them in code so that sprite sheets are just as easy to use as decals, thus the creation of this tool. As a side note, this tool can also be used to import gifs and there is an example at the Example Place
I have also modified Roblox’s Controller Image Library to be used as a general purpose sprite sheet manager for easy access/instantiation of images from your sprite sheets. A big organizational feature of this modified module is the concept of virtual sprite sheets. For example: you might have a lot of plant images that won’t fit onto a single 1024x1024(Roblox image size limit) sprite sheet. The python tool will split the sprites(plant images) onto multiple spritesheets but in your Lua code it can be considered the same sheet.
This is a CLI (command line interface) tool meaning that you run the program from your terminal (Mac OS/Linux) or command prompt (Windows). If you have never used a CLI before, don’t worry this tool is designed to be user friendly with verbose input and output.
SpriteSheet Manager API
SpriteSheetManager:GetImageButton(Sheet, Index)
Sheet is the sprite sheet where your image/sprite is on
Index is the name of the sprite you are
Returns an image button sized to the dimensions of the sprite
SpriteSheetManager:GetImageLabel(Sheet, Index)
Sheet is the sprite sheet where your image/sprite is on
Index is the name of the sprite you are
Returns an image label sized to the dimensions of the sprite
Installation
This is a python tool so python installed on your computer is required to use this tool. Download the latest version of python here.
The LUASprite project is stored on the PyPi repsoitory so it can be installed using pythons default pack manager, pip. Simply run pip3 install LUASprites
in your terminal. On windows you may have to run your command prompt as an administrator to install.
How to use
Video walkthrough
^This was filmed on a Mac but the process should be nearly identical on a windows machine
Watching the video and looking at the example place will make the most sense for how to use this tool.
On windows you may have to close and open a new terminal window after installing LUASprites
Run this command in your terminal
$ luasprites [IMAGE_FOLDER_HERE]
Where the brackets are have a path to a folder containing all the images you want in the sprite sheet.
After that the application will ask you for a name and what kind of Lua output you want. Should be fairly user friendly. Upload the sprite sheet images found [IMAGE_FOLDER_HERE]/output to Roblox and put the asset ids in the appropriate variable found in the .lua script generated. Finally put the newly created module script inside the spritesheets folder (inside the SpriteSheet manager linked at the top of the post) and you have finished setting up your sprite sheet.