Hi i need help with spritely

Hello i need help with spritely I want to send the images of spritely to my project and see that say something to him of SpritelyLoader but I do not understand it you can help me??

I’m not very familiar. Not because I don’t think it’s great, it’s more my lack of pixel art talent. Anyway, let’s see if I get this right…

-- SpriteLoader 
-- ver. 1.0
-- moves data from global to project storage
-- ====================

-- This class takes data from global and dumps it into your project.
-- To use this class, create an instance in your project.
-- For example:  aloader = SpritelyLoader()
-- This call will read both keys and images from the global Spritely
-- storage and copy them into your project space. 

So, do that first. You only need to load once (or anytime you change one that you need in your project)

-- Once in the project data, load the saved string to 
-- an image using it's key.  For example:
-- createImage = loadstring( readProjectData("bob"))
-- anImage = createImage() 

It’s the loadstring that is a bit confusing. When SpritelyLoader copied your image in, it put in a seperate file. This file is a string (text) of code that can be executed (loaded). The confusing part is that you can’t see it from Codea. The very easy part is, you don’t have to do anything complicated to use it.

-- To display your images, you'll need to load them into
-- a sprite. The command looks like this

-- sprite(anImage, 100, 100, 32, 32)

-- Good luck!

Then you just use it.

Yes thanks but i look that and i no undersatnd that, You can explain me how it works?

I found this discussion very helpful and created my own sprites for a game I’m working on - thanks !
Now my game is finished and I want to share it, how do I share the custom sprites? I’m guessing they’re not grabbed by copy and pasting the code?

Unfortunately, the best way to put a sprite in at the moment is to use the “print” function in Spritely, then copy / paste the code into your project. If the size of the code becomes an issue, there’s a version floating around where people smarter than me have added compression.

Hopefully, one day soon we’ll be able to trade project files again, and you won’t have to shove those images into code.

Hi Mark, thanks for that. I’ve copied the data into my project, but how do I use it? I used the spritelyloader originally, but haven’t used the “print” method. I’ve got two sprites, so do i need to change every img.set() to myimagename.set() for each image? Do I need to paste the image “prints” to separate tabs too?
How do I call this data so I can call it via sprite(myimagename) in the main programme??
Cheers, dan

Sorted it :slight_smile:
Had a look at the Spritely app to see how the icons were brought in as part of the main code, and applied the same approach in my own. It works! Problem sorted