Universal clock to control events?
bluelotus
Member Posts: 96
Ok. New question (I hope... couldn't quite piece together an answer from reading forums/wiki)...
... I am building a slideshow where images cycle constantly at either 5,10, or 15 seconds. The images all have an alpha interpolate at the beginning and end to cross-fade into each other.
I have two places where I am stuck.
1)there are different categories of images that I want the user to be able to turn on or off while the slideshow is running. For example lets say there are blue, red, and yellow images, all on by default, and I want to be able to control whether they all play, blue and yellow only, blue only, or any combination, etc. The only way I could think to do it, and allow them to alpha cross-fade, was to have every image be an actor, have another actor spawn them randomly. But I then had to have different groups of rules for each possible combination of images.... I don't want to have to do that because it seems like a lot of useless code, but I don't see how it could work with tags because you cant spawn an attribute, only an actor.
2. the second issue is that when you select on or off an image category, the slideshow abruptly starts over. So to try and solve that I made three clocks (called game.timer1,2,3) that count to 5,10 or 15 and repeat. There is an attribute called game.timerSelect that controls which clock is active. I also made two attributes for each clock called game.timerTrigger1 and 2. These are booleans that are true at 1sec and then at 5,10,or15 seconds respectively. (and turn the other one off/false)
My thinking was that at any point the user can select a new length of time for each image (5,10,15 seconds), as well as selecting on/off an image category. And no changes could take affect until previous image has cycled through and the game.timerTrigger1 = true. (clock is back to 0)
but this doesn't work
basically the images (which are now set to fade on when game.timerTrigger1=true, and fade off when game.timerTrigger2=true) just keep displaying the first image. I can see a quick flash of the next image each time the clock resets but then the same images remains.
Hopefully this isn't too confusing. I suppose I could upload the versions if it helps. In the meantime, any tidbits of information would be helpful. Thanks!
... I am building a slideshow where images cycle constantly at either 5,10, or 15 seconds. The images all have an alpha interpolate at the beginning and end to cross-fade into each other.
I have two places where I am stuck.
1)there are different categories of images that I want the user to be able to turn on or off while the slideshow is running. For example lets say there are blue, red, and yellow images, all on by default, and I want to be able to control whether they all play, blue and yellow only, blue only, or any combination, etc. The only way I could think to do it, and allow them to alpha cross-fade, was to have every image be an actor, have another actor spawn them randomly. But I then had to have different groups of rules for each possible combination of images.... I don't want to have to do that because it seems like a lot of useless code, but I don't see how it could work with tags because you cant spawn an attribute, only an actor.
2. the second issue is that when you select on or off an image category, the slideshow abruptly starts over. So to try and solve that I made three clocks (called game.timer1,2,3) that count to 5,10 or 15 and repeat. There is an attribute called game.timerSelect that controls which clock is active. I also made two attributes for each clock called game.timerTrigger1 and 2. These are booleans that are true at 1sec and then at 5,10,or15 seconds respectively. (and turn the other one off/false)
My thinking was that at any point the user can select a new length of time for each image (5,10,15 seconds), as well as selecting on/off an image category. And no changes could take affect until previous image has cycled through and the game.timerTrigger1 = true. (clock is back to 0)
but this doesn't work
basically the images (which are now set to fade on when game.timerTrigger1=true, and fade off when game.timerTrigger2=true) just keep displaying the first image. I can see a quick flash of the next image each time the clock resets but then the same images remains.
Hopefully this isn't too confusing. I suppose I could upload the versions if it helps. In the meantime, any tidbits of information would be helpful. Thanks!
Comments
then each actor would have rules that could determine through a set of conditions which image to change to based on its attribute value.
example:
--------------------------------
Rule:
Attribute game.image = 3
--------------------------------
Change Image
Set Image to: Yellow.png
---------------------------------
And depending on how many images you need you'll have that many rules. Keep in mind you could copy and paste this Group into the other actor, or if it's unique at least you only have to set this up twice.