Random Timer Help!

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

  • RabidParrotRabidParrot Formally RabidParrot. Member Posts: 956

    Is the actor set to 0% opacity?

  • No

  • ArmellineArmelline Member, PRO Posts: 5,366

    Perhaps post a screenshot of the rules you're using.

  • RabidParrotRabidParrot Formally RabidParrot. Member Posts: 956
    edited October 2014

    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.)}

  • SocksSocks London, UK.Member Posts: 12,822
    edited October 2014

    @tayhubhan@gmail.com said:
    I set the timer for every random(1,5) seconds > change image to "Mole".

    @Rabid Parrot said:
    Every random (1,5) seconds . . .

    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 !

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.