I’ve modified my function above to take the baseDir as an argument.
If you use my function above and pass system.CachesDirectory as the second argument, it should work.
(This assumes that the PNG and JSON is in the same place though)
I’ve modified my function above to take the baseDir as an argument.
If you use my function above and pass system.CachesDirectory as the second argument, it should work.
(This assumes that the PNG and JSON is in the same place though)
Thank you for your solution, but it seems that you can only place the texture file in the ResourcesDirectory. I tried to place both .json and .png files in the DocumentsDirectory and it crashed trying to find the .png file. Looking at emitterParams table, I didn’t find any option to set the directory. Any suggestion would be really appreciated. Thank you.
This is how I call your function:
local emitter = newEmitter("library/book001/leaves.json", system.DocumentsDirectory)
And it reads leaves.json without any problem.
It crashes at the end of your constructor:
local emitter = display.newEmitter(emitterParams)
This is the error message: CAN’T find texture name: library/book001/leaves.png
The file leaves.png is in this folder.
Thank you in advance!
If I can ask one more thing:
Open your leaves.json file. What does the “textureFileName” line look like?
Is it something like this: “textureFileName” : “leaves.png” ?
Bummer. It looks like there’s nothing I can do to fix this.
Corona’s display.newEmitter() expects to find the jpg in the Resource directory and I can’t find any way around it.
I understand. Thank you anyway. I will post a feature request that let us choose where to place texture file.
Here you can vote the feature request to add the possibility of choosing the base directory of both files (.json and .png) of the particle system emitter.
Thank you for your solution, but it seems that you can only place the texture file in the ResourcesDirectory. I tried to place both .json and .png files in the DocumentsDirectory and it crashed trying to find the .png file. Looking at emitterParams table, I didn’t find any option to set the directory. Any suggestion would be really appreciated. Thank you.
This is how I call your function:
local emitter = newEmitter("library/book001/leaves.json", system.DocumentsDirectory)
And it reads leaves.json without any problem.
It crashes at the end of your constructor:
local emitter = display.newEmitter(emitterParams)
This is the error message: CAN’T find texture name: library/book001/leaves.png
The file leaves.png is in this folder.
Thank you in advance!
If I can ask one more thing:
Open your leaves.json file. What does the “textureFileName” line look like?
Is it something like this: “textureFileName” : “leaves.png” ?
Bummer. It looks like there’s nothing I can do to fix this.
Corona’s display.newEmitter() expects to find the jpg in the Resource directory and I can’t find any way around it.
I understand. Thank you anyway. I will post a feature request that let us choose where to place texture file.
Here you can vote the feature request to add the possibility of choosing the base directory of both files (.json and .png) of the particle system emitter.