I need change property of sprite to invisible, for a time. I not able to find in documentation.
You can use msg.post("#sprite", “disable”) or go.set("#sprite", “tint”, vmath.vector4(1,1,1,0))
and then when you want it to appear again use:
msg.post("#sprite", “enable”) or go.set("#sprite", “tint”, vmath.vector4(1,1,1,1)) depending on your initial choice
2 Likes
This is the preferred way. A disabled component will have virtually zero impact on performance. Setting alpha to 0 will still result in a lot of computations in the engine.
8 Likes
The API reference shows all of the messages you can send to various components. I also made several changes to the manuals:
- Added a components overview: https://www.defold.com/manuals/components/
- Split tilemap manual into Tile Source (https://www.defold.com/manuals/tilesource/) and Tilemap (https://www.defold.com/manuals/tilemap/) manual
- Created a Script manual (https://www.defold.com/manuals/script/) and moved some content from Lua in Defold (https://www.defold.com/manuals/lua/)
- Moved Atlas and Font from Components to Resources in the left-hand menu
3 Likes