I search the forum for discussion on HUD but did not find what I was searching for so here it is:
I want to know what is the best way to do my hud. In my game, I have picture of the energy left and the sheild left. Everything is tell by color and I already have the code for managing all of that. But for showing this, I think that I can put all of my different image in a egg texture card. But when its done, how do I choose from the texture card wich one I want to show? Is it something with Geom?
I already done a button with a egg texture card and it work perfectly so any piece of code for showing a specific texture from a texture card on demand would be greatly appreciated!
If you have question, don’t hesitate to ask!
I find a way to do it.
First, I found a model with only on face so it’s like a paper and I can put the texture of my choice on it.
After that, I’ve done this:
self.energyModel = loader.loadModel('models/logo.x')
self.sheildModel = loader.loadModel('models/logo.x')
self.energy = aspect2d.attachNewNode('hud-energy')
self.sheild = aspect2d.attachNewNode('hud-sheild')
I load the texture like this (Could have done a egg texture card but I don’t see the point for now. If you could give me a good reason to do it, I will)
#Loading the different textures
self.energyGreen_tex = loader.loadTexture("models/hud/energy/energy-VERT.png")
self.energyYellow_tex = loader.loadTexture("models/hud/energy/energy-JAUNE.png")
self.energyRed_tex = loader.loadTexture("models/hud/energy/energy-ROUGE.png")
self.sheildGreen_tex = loader.loadTexture("models/hud/sheild/armureVERT.png")
self.sheildYellow_tex = loader.loadTexture("models/hud/sheild/armureJAUNE.png")
self.sheildRed_tex = loader.loadTexture("models/hud/sheild/armureROUGE.png")
Finally, I put the texture of my choice using this call:
def loadTextureOnModel(self, model,texture):
If you want to comment on my solution, let’s go
you could post a sample in the code snipplets with the necessary graphics so we could see how it works, or post a video on youtube or something