Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would you use a sprite sheet/map?

Asked by 10 years ago

Here is a example of a sprite sheet here. Can somebody explain to me how you would use them? Thanks!

1 answer

Log in to vote
4
Answered by
DataStore 530 Moderation Voter
10 years ago

ImageLabels (and ImageButtons) have two properties which allow you to use sprite sheets. Those two properties are ImageRectOffset and ImageRectSize.

Using ImageRectSize you can change how much of the image is shown on the ImageLabel (or ImageButton), and use ImageRectOffset to change between each sprite image by setting where to show the 'viewport' (set by the ImageRectSize property).

For example, With the example image given you would set the ImageLabel's ImageRectSize to '100,100'. To change between each 'footprint' you would edit the ImageRectOffset property, so if you were to set it to '0, 200' you would get the third footprint down, on the left.

Note: You would set both of these properties with Vector2.new()

2
Note: The units of the `ImageRect` properties are in SOURCE PIXELS. If you uploaded something that was 213x493, then that is the whole size of the image in `ImageRectSize` / `ImageRectOffset`. Note, however, that ROBLOX also caps resolution to a particular level, so for a 3000x3000 image, you won't be using 3000 as the width of the whole (I think the cap is 1024x1024 - I am not sure) BlueTaslem 18071 — 10y
Ad

Answer this question