Random function without some numbers

patapplepatapple Member Posts: 873
edited August 2012 in Working with GS (Mac)
Hi,

I have a random function that spawn a ball to random(0,360) degrees but i don't want that this ball is spawned to 0, 90, 180 and 360. How must i modify the function to exclude this numbers?

Thanks (if possible without table and other attributes)

Comments

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    Hmm...Not sure...Could you just create a rule that says:
    If self.rotation is 0, 90, 180, 360 - Change rotation to whatever?
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Or as follows (if I've understood correctly).. although is impossible without using another attribute (integer), I'm certain:

    Change Attribute RandMain to random(1,4)

    When RandMain =1
    Change Attribute RandMain to random(1,89)
    Change Attribute self.Rotation to RandMain

    When RandMain =2
    Change Attribute RandMain to random(91,179)
    Change Attribute self.Rotation to RandMain

    When RandMain =3
    Change Attribute RandMain to random(181,269)
    Change Attribute self.Rotation to RandMain

    When RandMain =4
    Change Attribute RandMain to random(271,359)
    Change Attribute self.Rotation to RandMain

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

  • patapplepatapple Member Posts: 873
    @gyroscope thanks. It is exactly what i was looking for :))
  • DanDaMan123DanDaMan123 Member Posts: 216
    what's wrong with 0, 90, 180, 270?
Sign In or Register to comment.