Hello. After a little over 5 months of intensive development and bug fixes, I’m releasing version 3 of my Spritely plugin.
I have a bad PC and my intention is to buy a better one to get twice the performance with this plugin. If you can donate Robux, I would greatly appreciate it. I could have paid for it, but I really want this to reach a lot of people.
-
Get the Plugin Here: Spritely
-
Get a Sample File Here: Online2dGameExample.rbxl
This plugin is focused on 2D game development, facilitating sprite creation and offering smart, well-optimized methods (such as collision detection and 2D stereo sound).
As a plugin, we offer:
- Design your own sprites
- Import sprites/sprite sheets
- Bake collision maps
- Assign your own collisions (BETA)
- Preload instances (no coding required for your sprite to start when you press PLAY (BETA))
- Constant updates
⚠️Avoid altering the names without the plugin correcting them. This behavior is implemented to prevent recalculations or the use of incorrect sprites.⚠️
Images
This plugin automatically inserts a module that has a wide variety of methods to ensure your game performs properly.
Module Offers
Core Functions
Spritely:CreateObject(ImageObject, SpriteFolder, Frame)
◦ ImageObject: (ImageLabel/ImageButton) The UI element to be registered into the system.[Required]
◦ SpriteFolder: (string) The identifier for the sprite data and frame collection. [Required]
◦ Frame: (number) The specific frame index to display upon creation. [Optional]
- Registers the instance, generates its pixel hash for collision detection, and prepares animation events.
- Returns: void.
Spritely:WaitForInstanceLoaded(ImageObject, TimeOut)
◦ ImageObject: (Instance) The target object to wait for. [Required]
◦ TimeOut: (number) Maximum time in seconds to wait before stopping. [Optional - Default: 10]
- Yields the current thread until the specified object is fully processed and loaded into the Spritely memory.
- Returns: number (The elapsed time spent waiting).
Spritely.IstanceLoaded(ImageObject)
◦ ImageObject: (Instance) The object to verify. [Required]
◦ IstanceLoaded: (boolean) Returns true if the object has already been registered and processed. [Required]
- Checks the internal registry to see if the object is ready for physics or animation.
- Returns: boolean.
Spritely.IsTouching(Image1, Image2, Type)
◦ Image1: (ImageLabel) The first sprite in the collision check. [Required]
◦ Image2: (ImageLabel) The second sprite in the collision check. [Required]
◦ Type: (string) Use “Fast” for bounding box checks or “Detailed” for pixel-perfect/SAT polygon collision. [Optional]
- Determines if two registered sprites are overlapping based on their transparency maps.
- Returns: boolean.
Spritely:RayCast(Position, Direction, Options)
◦ Position: (Vector2) The starting point of the ray in 2D space. [Required]
◦ Direction: (Vector2) The vector indicating the range and orientation of the ray. [Required]
◦Options: (table) A dictionary containing filters (IgnoreList) or visibility settings. [Optional]
- Casts a 2D ray to detect collisions with any registered Spritely objects.
- Returns: table (Contains Instance, Position, Normal, and Distance) or nil.
Animation & Control
Spritely:SetFrame(ImageObject, Frame)
◦ ImageObject: (Instance) The sprite whose frame needs to be updated. [Required]
◦ Frame: (number) The index of the frame to be displayed. [Required]
- Manually switches the current frame of the target image.
- Returns: void.
Spritely:PlayAnimation(ImageLabel, FPS, Loop, MinFrame, MaxFrame)
◦ ImageLabel: (Instance) The target UI element to animate. [Required]
◦ FPS: (number) Frames per second for the playback speed. [Optional]
◦ Loop: (boolean) Determines if the animation should restart after finishing. [Optional]
◦ MinFrame: (number) The starting frame of the animation sequence. [Optional]
◦ MaxFrame: (number) The ending frame of the animation sequence. [Optional]
- Starts a playback loop on the specified image using the frames from its registered folder.
- Returns: void.
Spritely:StopAnimation(ImageLabel)
◦ ImageLabel: (Instance) The object that should stop animating. [Required]
- Halts any active animation sequence on the target object.
- Returns: void.
Spritely:GetAnimationEvent(ImageObject)
◦ ImageObject: (Instance) The sprite linked to the events. [Required]
- Accesses the RBXScriptSignals associated with the object’s animation state.
- Returns: table (Contains signals: Played, Stopped, Ended, and FrameChanged).
Data & Utilities
Spritely:GetImageBuffer(SpriteFolder, Frame)
◦ SpriteFolder: (string) The folder name to query. [Required]
◦ Frame: (number) The specific frame index. [Required]
- Retrieves the raw pixel data and original dimensions of a stored sprite.
- Returns: buffer (Pixel data) and Vector2 (Original size).
Spritely:SetImageBuffer(ImageObject, Buffer)
◦ ImageObject: (Instance) The UI element to modify. [Required]
◦ Buffer: (buffer) The new pixel data to write. [Required]
- Directly updates the EditableImage content of the object using a pixel buffer.
- Returns: void.
Spritely:AddSound(SoundId, ImageObject)
◦ SoundId: (string/number) The AssetId of the sound to be created. [Required]
◦ ImageObject: (Instance) The UI object that will “emit” the sound. [Required]
- Creates a 3D sound instance logically parented to the object’s position for spatial audio effects.
- Returns: Sound (The created Sound instance).
Debugging
Debug_Collision_Spritely
◦ Attribute Location: workspace
◦ Type: boolean
◦ Function: When this attribute is added to the workspace and set to true, the plugin will automatically generate and render visual collision boxes/polygons for every registered object. This is intended for testing and debugging collision accuracy. It is disabled by default.
It's a pleasure. I look forward to reading your comments. I apologize for my poor English; I did my best to explain everything correctly. I may have missed something about the plugin. I'll correct it throughout the day.
When this new API comes out of Beta, my plugin will be easier to implement for all types of devices.
Additional Information: This plugin is constantly evolving as I develop a 2D video game. I’d appreciate your suggestions for improvements.