Colide when hit, not when just touching
jon2s
Member Posts: 40
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?
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
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?
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.
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]