nooneisback / luau-spriteclip2

0 stars 0 forks source link

Can you create a video tutorial on how to use the module? #1

Open SpasFTY opened 2 weeks ago

SpasFTY commented 2 weeks ago

Im not good at all in programming so i dont understand anything whats written on the devforum, but im sure it will be a lot easier to understand how that thing works with visual guide, i just wanna have some goofy animated sprites in my roblox game thats all😭😭😭(i cant text in the devforum so i thought maybe here i could contact the creator)

nooneisback commented 2 weeks ago

I will try to later on, but I can't promise anything since my connection will be bad for the next few weeks.

nooneisback commented 1 week ago

I won't be able to make a video, but here's the best I can do visually.

Let's say you want to animate the part of the spritesheet in the red rectange (source: https://www.deviantart.com/popgamer06/art/Roblox-Noob-sprite-sheet-1024089675): GimpScreen

We know that those sprites are 65x65 pixels. And we know that the leftmost sprite in this group is 7th from the top and 7th from the left, meaning its top left corner is Vector2.new( (7-1)65, (7-1)65 ), and that is our edge offset.

Once you are in Studio, create a ScreenGui and an ImageLabel inside. Upload the spritesheet and apply the asset id to the label. You should end up with this: image

Afterwards, import SpriteClip2 and drop it into the Label. Create a LocalScript within that label as well, so you end up with the following: image

Finally copy-paste the following into the LocalScript:

local SpriteClip = require(script.Parent.SpriteClip2);
local Label = script.Parent;

local Sprite = SpriteClip.ImageSprite.new({
    adornee = Label;
    spriteSheetId = Label.Image;

    spriteSize = Vector2.new(56, 56);       -- the size of each sprite
    edgeOffset = Vector2.new( (7-1)*65, (7-1)*65 ); -- the position of the first sprite (7-1 = 6)
    spriteCount = 6;                        -- total number of sprites in our animation
    columnCount = 6;                        -- total number of sprites in a column (counting left to right)
    frameRate = 15;                         -- frame rate of your animation
});

Sprite:Play();

Here's the final result: a

And here's the place file: tester.zip