Sprite Sheets For Developers On A Budget

You need to execute the code above every time you run your app.  It replaces _G.require with a helper function.

The script is called patcher, that doesn’t mean it modifies your phone.  See the product description (https://marketplace.coronalabs.com/corona-plugins/patcher).   The concept was, to enable hot-patching a app or game by downloading replacement scripts to documents.  

Not sure if your last sentence was a question, but I can’t give you much help on debugging animations.

Hi roaminggamer,

I use the grammar based document. ↓

local Flower = helper.newSprite({baseDir = system.DocumentsDirectory,definition = "DecoFlower,image = “DecoFlower.png”},FlowerData)

But no Image was found.

Originally my Image was placed in system.ResourceDirectory, but now I changed to system.DocumentsDirectory but an error occurred.

I tried to adjust the position of this code, but it didn’t work.

Hope to get some guidance from you. :frowning:

  1. Zip up a sample project that I can download and run, then link it here with dropbox or another reputable downloader so I have something to look at.

2.  I didn’t understand what you meant by “grammar based document”

3.  Which of the 4 tools above did you use?  

  1. Did you follow the docs directions? https://roaminggamer.github.io/RGDocs/pages/Plugins/texturepackerhelpers/#texture-packer-helpers

  2. Out of curiosity, why is the  image image in the ‘documents directory’?

  3. What is the field ‘definition’? I am not familiar with a that field.

    definition = "DecoFlower

7. That call to newSprite looks wrong.  You’re not providing a image sheet.

display.newSprite( [parent,] imageSheet, sequenceData )

https://docs.coronalabs.com/api/library/display/newSprite.html

 

 

8.  Have you downloaded and examined the samples I provided (one for each tool is available):

https://roaminggamer.github.io/RGDocs/pages/Plugins/texturepackerhelpers/#samples

 

 

  1. Is this a general question about sprites or are you trying to get help with my tool?  If the prior, please don’t post here with general questions not about the tool.  If the latter, please do #1 and answer questions 2…8.

I can’t send this file because it is in the sandbox.

My problem is that there is an error from ResourceDirectory → DocumentsDirectory, helper.newSprite cannot find the DocumentsDirectory location.

Please see my response (edited after you answered). 

Please answer the questions by # so I know what answer goes with which question.

I can’t help w/o a downloadable sample, but I think you’re not using newSprite() correctly.

Wow… it’s been a while… 

I forgot about the ‘definition’ … and I still can’t remember what it is for off the top of my head. :slight_smile:

Hmmm…  I thought I’d released the source for this when I gave away most of my portfolio: https://forums.coronalabs.com/topic/74704-template-portfolio-release/

But it isn’t there.

I’ll try to find it and upload it so you can get the source and fix it for your needs.

#9

I use your Image Sheet / Sprite Helpers.

#1

Unable to execute. Documents whose files are in the sandbox, you cannot get him.

#2

On your document.

newSprite (params) Returns an sprite made using the speficied parameters. baseDir, definition, image, sheet, x, y, parent.

I followed the above sequence baseDir = system.DocumentsDirectory, definition = “DecoFlower, image =” DecoFlower.png "

WARNING: Failed to find image ‘DecoFlower.png’ appeared

#3 

I use  PAID  Texture Packer

#4

Yes I follow the instructions in this document.

#5

My file has 1GB, Android and Apple do not allow such a huge file, so I use Amazon S3 to download the file to the ‘documents directory’

#6

The picture name.

#7

No, It can run normally in ResourceDirectory, I can use the sprite.

#8

Yes, I checked many times, but there is no information about ‘documents directory’.

Found it. 

https://github.com/roaminggamer/RG_FreeStuff/raw/master/Products/texturePackerHelpers/texturePackerHelpers.zip

You can get the source here, and it includes an updated demo.

Remember, if you use the modified source ‘texturePackerHelpers.lua’ you no longer need to include the plugin line in build.settings.

Neither will you need to

require "plugins.texturePackerHelpers"

just:

require "texturePackerHelpers" -- assumes lua file is in project root folder with main.lua

Final post (I think).

  1. You can download the (modified) source for the plugin and use it in your project.

  2. This will let you debug the problem directly in the helper (one file, pretty well organized and straight forward).

Okay, thank you, I tried to find a solution.

After all, this problem has been bothering me for 2 hours. Haha.

Ahh!  I see the problem.

The ‘definition’ is a path to a LUA file.  It cannot be in the documents directory.  i.e. You can’t require scripts from the documents directory.

Actually you can, but that requires additional effort.    My patcher plugin lets you do that: https://marketplace.coronalabs.com/corona-plugins/patcher

I’ll see if I can find the code for patcher and release that too.

Will buying this plug-in solve this problem, because I am modifying the file you gave and it still does not work.

If it is, then I will buy it, because this problem prevents me from logging into the game. :smiley:

I’m not saying buy it.  I’m saying, I’ll provide patcher for free as a download.

Right now I’m trying to figure out if/how this can be done.

Thank you for your selfless dedication.

I originally thought that if I could solve the problem quickly, I would be willing to spend it directly. :slight_smile:

  1. Go here and re-download this file: 

https://github.com/roaminggamer/RG_FreeStuff/raw/master/Products/texturePackerHelpers/texturePackerHelpers.zip

  1. Grab texturePackerHelpers.lua from the zip file and use this (updated) file in your project.  (Old file had a bug).

  2. Get patcher here: https://github.com/roaminggamer/RG_FreeStuff/raw/master/Products/patcher/patcher.zip

  3. Do this in main.lua:

    local patcher = require “patcher” patcher.debug(true) patcher.export() patcher.enabled(true) local helpers = require “texturePackerHelpers” local helper = helpers.texturePacker

Be warned.  Using patcher will make debugging syntax errors a little more difficult.  It can’t be avoided. 

One thing that can be done to avoid this problem is to enable and disable patcher as needed.

i.e. Simply  modify the helpers code to enable and disable patcher before executing ‘require’ calls.  It is a bit hacky, but it will work.

I have tested using scripts and image files from the documents folder and it works.  The textuerPackerHelpers.zip file contains a folder: fromDocumentsDirectory that tests this feature.

The problem has been solved.

Thank you very much for your help.

Finally, I would like to ask, I found that I only executed it once, and after closing the CoronaSimulator.

–local patcher = require “patcher”

–patcher.debug (true)

–patcher.export ()

–patcher.enabled (true)

And open again,can still run normally

Does this mean that I only need the player to execute the patcher once, and then I do n’t have to execute it again on that phone?

Best Regards.

I ’m not sure if it ’s my illusion, the animation is running not smoothly.

You need to execute the code above every time you run your app.  It replaces _G.require with a helper function.

The script is called patcher, that doesn’t mean it modifies your phone.  See the product description (https://marketplace.coronalabs.com/corona-plugins/patcher).   The concept was, to enable hot-patching a app or game by downloading replacement scripts to documents.  

Not sure if your last sentence was a question, but I can’t give you much help on debugging animations.