Colide when hit, not when just touching

jon2sjon2s Member Posts: 40
edited November -1 in Working with GS (Mac)
Curious if anyone has any ideas for this. I have 1 actor a and a several of actor b. If actor a is resting on top of an actor b, I want nothing to happen. However if actor a falls onto an actor b I want an action to happen to actor a. Like wise if an actor b falls onto actor a I want an action to happen to actor a.

I thought about making it so that if the velocity of actor a is greater than X and collides, but that would not work if actor b falls onto actor a.

Any ideas?

Comments

  • ORBZORBZ Member Posts: 1,304
    check both actors' velocities in scene scope.
  • jon2sjon2s Member Posts: 40
    I would, however since there are multiple of actor b there would not be a way to know if the instance of actor b that actor a collided with is the one that is moving. :(
  • ORBZORBZ Member Posts: 1,304
    ahhh...

    ya that's kind of a situation where GS really needs to have the ability to pass collision data between the objects that are colliding.

    there may be a way ... it's not coming to me off the top of my head though. sorry :(

    anyone else have an idea?
  • firemaplegamesfiremaplegames Member Posts: 3,211
    Actors CAN talk directly to other Actors, "sort of".
    Maybe more accurately, they can "listen" to other Actors.
    However, it is kind of ugly.
    And it breaks the Prototype-Instance bond.

    But it can be useful in certain VERY controlled situations.

    It works like this:

    Actor Instances in the Scene have access to all the other Actor Instances in the Scene.

    Double-click on an Actor in the Scene.
    Click the padlock to edit that Instance's Behaviors

    Add a Rule.

    In the first dropdown menu in the Rule, change it to attribute.
    Then select Current Scene => layers => [whatever layer you want] => Actor Instance => [whatever Attribute]

    This would allow you to do things like:

    Rule
    When scene.Background.BobTheActor.Position.X > 500
    [whatever]

    I'm sure people can come up with interesting uses for this.

    However, all that being said, I don't think it is a viable solution for your problem.
  • firemaplegamesfiremaplegames Member Posts: 3,211
    For your problem, could you just do something like this:

    First create two Actor tags on the Home Screen.
    For simplicity, let's called them TAGA and TAGB
    Make Actor A a member of Tag A and Actor B a member of Tag B.

    Make a global game Boolean attribute called something like actorAhasbeenHurt

    In Actor B:

    Rule
    When Actor receives event Overlaps or collides with actor of TAGA
    -----Rule
    -----Any
    -----When Motion.Velocity.X > 0
    -----When Motion.Velocity.Y > 0
    ----------Change Attribute: game.actorAhasbeenHurt To: TRUE

    In Actor A:

    Rule
    When Actor receives event Overlaps or collides with actor of TAGB
    -----Rule
    -----Any
    -----When Motion.Velocity.X > 0
    -----When Motion.Velocity.Y > 0
    ----------Change Attribute: game.actorAhasbeenHurt To: TRUE

    Rule
    When game.actorAhasbeenHurt = TRUE
    -----[do something. I have either fallen onto, or I have been fallen upon]
Sign In or Register to comment.