Hi, I’m new to coding and I have run into a problem using the bge.texture module.
In the api there is a sample script for changing textures which I was able to modify and use to change the texture on my object in the game. I gave the object a property which represents an energy level and set it up so that every time the energy level changes, the texture changes. This works great, but then if I make copies of my object I run into a problem. Whenever one of the objects changes textures, all the others do too.
I think the problem comes in here:
code snippet from the api sample code:
# the texture has to be stored in a permanent Python object logic.texture = object_texture # update/replace the texture logic.texture.source = new_source logic.texture.refresh(False)
I think this means that each object is storing its texture in the same object, and when that object calls refresh they then all get refreshed.
So my question is, can anyone suggest how I might create a unique permanent storage object for each of my objects? I tried creating a variable and filling it with a unique string, but I couldn’t make it work.