This is still experimental and I have no idea how well it would work outside of localscripts, which is why I recommend you not to use them inside scripts. If you find any bugs, please either contact me immediately or post a report in this thread so I can give a public ETA over the bugs.
This module allows you to handle spreadsheets easier than if you’d manually change the ImageRectOffset by yourself.
Features in this handler:
- Allows you to add ‘names’ to images for easier access.
- Automatically marks the IDs for each image so you won’t have to.
- Always returns true or false when an operation is successful or not.
- Will probably update to add more features as time goes on.
- Easy usage ‘API’.
- Automatically detects the size of your imagelabels and creates the IDs based on it.
Drawbacks:
- Does not support Scale sized images, only Offset sized.
- Only supports ImageLabels and ImageButtons.
- Probably buggy. You should have no issues as long as you know the size of the image containing the spritesheet, and have created that spritesheet based on the ImageLabel size.
The API currently has only 3 functions which should be enough for most spritesheets uses. If not, please contact me so I can add more features to allow them.
How to use:
- Get the module and drag it into the localscript where you want to handle the spritesheets.
- Require the module like this:
local handler = require(script.SpritesheetHandler)
- Set the module to handle the ImageLabel like this:
local spritesheet = handler:New(instance, asseturl, {width = num, height = num})
- Display the wanted sprites from the spritesheet using this:
spritesheet:Display(SpriteID or Name)
- Want to access the sprites in a manner you can remember? Use this:
spritesheet:SetName(SpriteID, Name)
→spritesheet:Display(Name)
- Want to get the Vector2 positions from a spriteId? Use this function:
spritesheet:GetVector(SpriteID or Name)
An API reference is included inside the module. Feel free to read it.
NAQ (Never Asked Questions)
Q: Why did you create this?
A: I made it so it would be used in my admin system Redefine:A. I didn’t get a chance to actually release the update because of an issue I have.
cough cough
Q: You didn’t post the module in the post.
A: Yes I have.
Q: How does the module get the IDs from the spritesheet?
A: If set-up correctly, it will follow this path as shown here:
Q: Come on give me the module.
A: It’s literally here.
Q: Does foodbayer permit this module?
A:
Let’s not ask this, okay?
Q: module?
A: …
Q: Do I need to credit you for this?
A: Not at all! While appreciated, everything I release in DevForums is usable without my credit. Just uh… don’t steal it and claim credit for yourself thought. That would be a nasty move. :c
Q: wheres the module you li
Q: Are you planning to release other stuff you made for Redefine:A, such as the RC3S module?
A: I do have plans for them, yes. I’ll not say anything more.