Sticking Actors - Need help fast

MaestroKaizersMaestroKaizers Member Posts: 6
edited January 2012 in Working with GS (Mac)
Hi there, could anyone please explain me how i stick actors to each other when they overlaps or collide??
Please someone explain me fast :P :)
Cheers

Comments

  • MotherHooseMotherHoose Member Posts: 2,456
    actor1 instance in scene:
    Rule: when
    Actor receives event: overlaps or collides with actor2
    --Interpolate or changeAttribute
    ----self.Position.X To: scene.layer.actor2.Position.X
    ----self.Position.Y To: scene.layer.actor2.Position.Y

    have both actors on same layer … of course the actor on top is higher in the layer (you can R click the actor in scene and change its order in that layer)

    @};- MH
  • beefy_clyrobeefy_clyro Member Posts: 5,394
    edited January 2012
    If your actors are moving the whole time and you want them to stick whilst they move you'll need to create 2 real game attributes of the target you want to be stuck to.

    Actor1X
    Actor1Y

    In Actor1

    Constrain attribute game.Actor1X to self.positionX
    Constrain attribute game.Actor1Y to self.positionY

    In Actor2

    Rule
    WhenActor2 overlaps or collides with Actor1

    Constrain attribute self.positionX to game.Actor1X
    Constrain attribute self.positionY to game.Actor1Y

    Be careful using too many constrains though as they'll start to hurt game performance.

    Hope that helps.

    Cheers
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    I know your trying to get help but please dont make multiple threads on the same thing. This is now your 3rd thread on this, im gonna close the other ones.

    cheers
Sign In or Register to comment.