Setting positions with random?

FrenchiesFrenchies Member Posts: 3
edited November -1 in Working with GS (Mac)
Hello. I am a guy who has quite a bit of experience with another (somewhat similar) program called Game Maker, and in my previous games, I have had strange twitching effects usually generated with a random() expression. However, I can't seem to get this type of effect to work in GameSalad. I have an actor, JumpBg, and I have a behavior. This behavior is a constrain attribute behavior that sets self.Position.Y to 158+random(0,4). However, this does nothing but set the Y to the random position at the beginning of the scene. This also happens when I use a change attribute. There is very little documentation on either of these important behaviors, and I'm not sure if either of the behaviors set the attribute relative to the expression that is typed in or what. Some help would be appreciated. Thanks

Comments

  • ChaserChaser Member Posts: 1,453
    You can set it to random (158,162)
    And you can do it in a timer
  • RedlerTechRedlerTech Member Posts: 1,583
    yes exactly,
    insert function random. Then, add in the parenthesis (158,162) & everything should work fine :)

    _________________________________________________________________________________
    GameSalad Community Project
    Quality Game Making Service
  • deretraumderetraum Member Posts: 7
    randoms cant re-compute in closed loop systems, if you have a rule generate a random , then that rule must be steped out of and then reentered to make more randoms, its really annoying
  • diyajeediyajee Member Posts: 15
    This action is to limit the behavior characteristic, which is set self.Position.Y 158 + random (0.4). However, this is not just a random set Y
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi Frenchies; can I suggest that it sounds like you only need Change attribute in this situation, not Constrain.

    Try making an integer attribute; let's call it Random. Then:

    Change attribute Random to random(0,4)

    Change attribute self.Position.Y to 158 + Random

    See if that does the trick for you.

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

Sign In or Register to comment.