We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi,
I am currently using the Particles example by Dan Shiffman and I would like to change the Particle texture by keypress to a different PNG. As the PNG is loaded n the setup-phase I can't do this there. Is there a way to switch a texture which has already been loaded (maybe in some internal buffer)? Or should I change the code so that I load all images upfront and the try to adapt the Particle system?
Any help is greatly appreciated, maybe someone has already coded a similar thing?
Thanks, Robo
Answers
Definitely load images up front; or possibly in an event listener if you've got a lot of images - though there may be a noticeable delay whilst each one loads. How you swap images depends on your actual implementation: a condition against a global in Particle or your event handler updating each Particle instance, etc.
Hello blindfish,
thanks for the answer, I thought loading upfront is the best way to go. I am currently stuck at figuring out how to switch a shape, I tried the following:
It seems that it is not possible to assign a Shape to a new shape. Any suggestions on that?