Timer and Random problem

tufiretufire Member, PRO Posts: 17
edited August 2013 in Working with GS (Mac)
So i have this set up where

Timer every 2 seconds
Spawn a Blue Ball
Works fine

New Set up
Timer every 2 seconds
Ball Spawn Value = random(1 to 4)

Ball Spawn Value = 1
Spawn Blue ball

Ball Spawn Value = 2
Spawn Red Ball

Ball Spawn Value = 3
Spawn Green Ball

Ball Spawn Value = 4
Spawn Yellow Ball

Problem. Random balls are spawning but sometimes its not every 2 seconds. so i have like gaps in my ball drops
The balls are moving at the right speed.

Comments

  • tufiretufire Member, PRO Posts: 17
    https://www.dropbox.com/s/hvu64tv2z7dh1hv/mess up spawn.png
    heres a screen shot. the balls are being drop from above. ball 1, 3 and 4 are at the right distance. but the ball 2 at the top is way off. the gap between ball 4 and ball 2 is not at the correct space
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited August 2013

    Hi @tufire

    My guess is the gaps are when you get the same number more than once (a sort of a glitch then...) - so try this: add the following to make your attribute Ball Spawn Value zero after each round. This should fix it for you hopefully.

    Timer every 2 seconds
    Ball Spawn Value = random(1 to 4)

    When Ball Spawn Value = 1
    Change Attribute Ball Spawn Value to 0
    Spawn Blue ball

    When Ball Spawn Value = 2
    Change Attribute Ball Spawn Value to 0
    Spawn Red Ball

    When Ball Spawn Value = 3
    Change Attribute Ball Spawn Value to 0
    Spawn Green Ball

    When Ball Spawn Value = 4
    Change Attribute Ball Spawn Value to 0
    Spawn Yellow Ball

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • tufiretufire Member, PRO Posts: 17
    ill try that
  • tufiretufire Member, PRO Posts: 17
    whoo hoo. resetting the ball spawn to zero fix the job.

    i thought it was something else since i change the random value to a bigger range. 1 to 100. 1 to 25 would be blue ball. that way i wouldnt get repeated number as much. but the gap still happen then.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    I'm glad I could help then. :-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

Sign In or Register to comment.