Order of rules

MrMarmiteMrMarmite Member Posts: 2
edited June 2012 in Working with GS (Mac)
Hi,

I have a rule on a ball which checks to see if it has hit a boundary wall. If yes, it saves the x position of that collision to an attribute. I have a rule on that boundary wall that if a ball collides with it it creates a particle explosion at the x position saved. However, as there are many balls on the screen at once, I need to ensure the rule on the ball, which sets the x position takes place before the rule on the wall, which loads the x position. What is happening is that all particle explosions are happening at the position of the one but last collision, i.e., the wall collision rule is being evaluated before the ball collision rule. These two events are, of course, taking place at exactly the same time. Is there a way I can ensure one rule takes place before the other?

Even better, is there a way I can find the x and y coordinates of a collision without having to save and load attributes?

Thanks

Best Answer

  • rickdalrickdal Posts: 30
    Accepted Answer
    im not totally sure, but i believe script operation order is related to the order of actors listed in the scene(either top to bottom or bottom to top).

    if you had a lot of balls you still may have situations where multiple balls hit walls at the same time which would cause problems. you could have the ball spawn an invisible actor which creates the particles(and then destroys itself after delay). OR have the ball collide with wall, then save x and y pos(with offset) to a local variable, then create particles from the ball actor, but use the saved position you set during the collision...

    second way is probably better since would have no spawning, just a thought...
Sign In or Register to comment.