Random Timer Help!
tayhubhan@gmail.com
Member Posts: 1
Hi!
I'm having trouble randomizing my timer.
I'm making a whack-a-mole style game. I have several transparent images on my screen for Actor One that I want to change into my "mole" image randomly.
I set the timer for every random(1,5) seconds > change image to "Mole".
But when I do this, nothing happens at all. I could sit there for an hour and not a damn Actor One changes. I saw this based on a tutoiral from a couple years ago, so I'm sure this method is out dated. But I'm not sure how to do this otherwise.
I've tried just putting in 1,5 seconds, and even putting in just 5. But of course, that changes all of the images at the same time after 5 seconds.
Thanks!!!
Comments
Is the actor set to 0% opacity?
No
Perhaps post a screenshot of the rules you're using.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
Can you make an attribute in the actor? For instance make a boolean attribute self.changeimage. Every (1,5) change attribute self.changeimage to true
When self.changeimage is true change image to mole. Then after a set amount of time you can change self.changeimage to false. Should look like this:
{Every 1 second
After random (1,5) seconds
change self.changeimage to true.
after x seconds change self.changeimage to false}
{When self.changeimage is true
change image to "Mole"
Otherwise
change image to (Insert the original image.)}
The timer doesn't work like this, if you set the timer as described - random(1,5) - it will choose a random value between 1 and 5 and then use that continually as the game plays, it will use that value 'every' time.
So, random(1,5) will not give you 5 - 3 - 4 - 3 - 3 - 1 - 2 - 4 - 4 - 4 - 2 - 3 - 3 - 5 - 5 - 1 - 4 - 3
It will give you 4 - 4 - 4 - 4 - 4 - 4 - 4 - 4 - 4 - 4
Or maybe 2 - 2 - 2 - 2 - 2 - 2 - 2 - 2 - 2 - 2
If it did the opposite and gave you a random time interval then the word 'every' would make little sense.
Hope that makes sense !
You might want to try my demo: http://forums.gamesalad.com/discussion/comment/464547/#Comment_464547
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User