How to change image (out of a pool of 100 images) without 100 rules????
bluelotus
Member Posts: 96
Hi all,
Having a hard time figuring this out....
I have one image on the screen. I have a pool of 100 images. The image on the screen needs to change every couple seconds.
Now the way I have been doing it is every couple of seconds I choose a random number and there are 100 change image rules that correspond to the random numbers. The problem is,
a.) when I open that actor that contains all the change image rules I have to wait forever for all the rules to load (the rule windows are all open and then collapse one at a time). Sometimes take 3 minutes each time. And when you are trouble shooting (preview>open the actor, preview>open the actor) it takes way too long.
b.) I want to add more images to the pool but I dont want to have 300-400 rules inside an actor.
Is there any way to use ONE variable to change the image? Or any other ideas would be greatly appreciated
THANKS!!!
Having a hard time figuring this out....
I have one image on the screen. I have a pool of 100 images. The image on the screen needs to change every couple seconds.
Now the way I have been doing it is every couple of seconds I choose a random number and there are 100 change image rules that correspond to the random numbers. The problem is,
a.) when I open that actor that contains all the change image rules I have to wait forever for all the rules to load (the rule windows are all open and then collapse one at a time). Sometimes take 3 minutes each time. And when you are trouble shooting (preview>open the actor, preview>open the actor) it takes way too long.
b.) I want to add more images to the pool but I dont want to have 300-400 rules inside an actor.
Is there any way to use ONE variable to change the image? Or any other ideas would be greatly appreciated
THANKS!!!
Comments
self.image = random(1,100)..".png"
Timer Every 3 seconds
-----Change Attribute: self.Image To: "image"..random(1,100)..".png"
You will need to name your images like this: image1.png, image2.png, image3.png, etc.
perfect!
@Rob2 (or whoever)... Is there a simple way to check for duplicates without having to make a whole bunch of attributes?
HOW TO display random images with out repeats
I think I can just make a pseudo-random sequence by cycling through the images by odd numbers. Just add 7,9,11 to the the image number and when it is greater than 100 just minus 100. This would make it so they dont repeat but aren't in order.
The question of the syntax still remains. How do I write that math in the expression editor?
-----Change Attribute: self.Image To: "image"..random(1,100)..".png" <------this is with a random number. how do I make it +7?
Timer Every 3 seconds
-----Change Attribute: self.currentImage To: self.currentImage + 1
-----Change Attribute: self.Image To: "image"..self.currentImage..".png"