Make all actors stop upon collision

mdtajghorimdtajghori Member Posts: 24
edited June 2012 in Working with GS (Mac)
Hey, guys, I've got four circular actors and I want them to stay in sync everytime, even when one of the actor collides with an object. I've included a video below and as you can see upon collision the actors behind the first circle don't stop even though I've included a rule that when any of the actors collide I turn a boolean attribute to true. I added an attribute into each of the four circles which says that 'when.key.right is down and boolen is fasle', move the actor in a direction 0 at a speed of 300. hence if any of the actors collide with the wall (refer to the video) they shouldn't move because the boolean attribute is true. How do I make all actors stop?

Answers

  • EatingMyHatEatingMyHat Member Posts: 1,246
    do you mean that you want them to stay in formation?
  • mdtajghorimdtajghori Member Posts: 24
    Yes, I want them to maintain the formation they held right before collision. (I can however interchange the position of the circles among themselves by pressing the space bar and you can see this near the end of the video where the circles are interchanging positions. To point out, this isn't the issue)
  • MotherHooseMotherHoose Member Posts: 2,456
    edited June 2012
    @mdtajghori … rather than using the Move Behavior
    try a Change Attribute Behavior for the self.Motion.Linear Velocity.X

    on the circleActor:
    Rule: when (All)
    Event: key right down
    Attribute: game.collided is false
    -changeAttribute: self.Motion.Linear Velocity.X To: 300
    Otherwise:
    -changeAttribute: self.Motion.Linear Velocity.X To: 0

    image MH
  • mdtajghorimdtajghori Member Posts: 24
    Thanks MH, but that gives that resolve the issue. I'm getting the same behaviour as before
  • LumpAppsLumpApps Member Posts: 2,881
    Perhaps constrain the x and y to a moving coordinate (in the case of your video the middle point of the 4 actors?) with an offset. That will give a lot of constraints though (2 for each actor) and might give a performance drop.
    I am not at my Mac now so can't try it.
Sign In or Register to comment.