Detecting collision sides
foldi
Member Posts: 21
Is it possible to detect which side caused a collision? For example, actor 'player' falls on actor 'enemy' from above. That should trigger a different behavior than if actor 'player' runs into actor 'enemy' from the side.
I understand I could create hidden actors that are constrained to the location of the enemy. This would make sense if there was one enemy. But if there is an unlimited amount of enemies that can be spawned and destroyed, how could the hidden actors access their parent enemy's XY values?
I understand I could create hidden actors that are constrained to the location of the enemy. This would make sense if there was one enemy. But if there is an unlimited amount of enemies that can be spawned and destroyed, how could the hidden actors access their parent enemy's XY values?
Comments
If it is spawned let me know and I'll tell u how it's a little more work
The only problem is u you need a posx and posy for each actor on screen at one time plus track witch actor goes with which posx posy combo which can b done but takes alot of rules
I have a game I'm wrkn on that uses this way and has a ton of rules
What if the logic I want to employ for this cannot be "scene specific" meaning it will have to continue throughout the duration of the game and I want to make all my edits in the prototype actors, not in the scene logic. (Reason: there will be too many scenes to modify the logic in if I need to change it).
Here are the rules I'm trying to figure out:
I have inanimate objects that can destroy (or damage in my case) an enemy if it lands on his head, but not if he is perched on them. (Think Angry Birds boxes).
In this case I have a prototype "box" actor that I can stack a bunch of and when/if the Hero causes the box to collide with the "enemy" actor it needs to follow this logic (spoken in the context of the enemy actor):
IF an "actor of type" BOX collides with me on "MyHead" THEN decrease my health (or destroy me if I have no health left).
Also, the same enemy actor has to have the following logic when attacked/hit by the player.
IF the player collides with "MyBackside" or "MyHead" THEN destroy the PlayerActor. Otherwise if the player collides with Me (meaning my face or belly) THEN decrease my health (or destroy me if I have no health left).
Collision angle
Cheers!
Thanks for responding... your example above solved the problem!