File paths! (SOLVED)

Hello again!

I’ve run into a problem that I’m sure is easily solved but I can’t really find anything about it. I have a map structure that is like this:

root -> images -> other -> atlas
-> room -> castle -> gui_script

In the gui script im using gui.set_texture to set a box node to a texture that is in the atlas. My question is how should i write the file path to it? Right now I’m hashing variations of “/root/images/other/atlas” and it is not working. How should i structure the filepath to look from root?

Hi @filip9304!

You don’t use the path itself when setting the texture.
First, you add the texture to the gui scene (Right click on “Textures” and select Add Texture)
E.g. add “logo.atlas”.
Secondly, in the gui script, set the texture to the box node:

gui.set_texture(gui.get_node("box"), "logo")
1 Like

Don’t forget to set the animation/image file also

local foo = gui.new_box_node(vmath.vector3(100, 100, 0), vmath.vector3(100, 100, 0))
gui.set_texture(foo, "logo")  -- atlas file name
gui.play_flipbook(foo, "coin")  --image name inside atlas

http://www.defold.com/ref/gui/#gui.play_flipbook:node-animation–complete_function-

Thank you so much! I had totally forgotten that the gui itself contained a texture section. Then it should be easy to solve my problem :slight_smile:

1 Like