Couple key notes. You don’t need to mess with the timex stuff as I use that to make the shader do stuff.
Also you have to “preload” the material unless it’s used elsewhere on init. That’s why I call them material1, 2, and 3 but never use them. That is just referencing them so they can be found at runtime.
I edited my last reply to your post to add this in (accidentally sent the reply before I finished typing, oops…) but there’s a much simpler way of doing it instead of having to manually hash the material path:
go.property("my_material", resource.material("/material.material"))
function init(self)
go.set("#sprite", "material", self.my_material)
end
You can get the address of the generated sprites like so:
local s1_l = msg.url(nil, body.s1, "l")
local s1_r = msg.url(nil, body.s1, "r")
go.set(s1_l, "material", self.my_material)
Put that wherever it is that you need to change the material of those sprites. I don’t know the layout of your project so I can’t give a more specific answer.