How do I rotate a sprite towards where objects collide?

Get help using Construct 2

Post » Thu May 01, 2014 9:04 am

I have an object which is destructible, meaning when the object is hit by the player I spawn a duplicate of this object which has been designed in Gimp to look destroyed. However, I'm struggling with rotating this towards the point of impact between these two objects. How can I detect where collision between objects occur?

I've tried with something like Set angle to Sprite.XXX.Angle, which works kind of ok, as long as the "front" of the player hits the other object. However, if it is hit from the side of the player, it doesn't look as good.
Posts: 123
Reputation: 1,571

Post » Thu May 01, 2014 9:53 am

whenever an object collide that actually means its overlapping another object.
General collision algorithms generates an area becouse of this, not a point. So you cannot get a point of collision happened.
(i may be wrong on this issue not expert enough on construct 2)

You may be find "overlapping at offset" useful on this issue. sou you can dedect from which side does it hits by using x,y coordinates in an object itself and manipulate the angle according to the side

also this thread may help you too:
Truth shall be your freedom...
Posts: 45
Reputation: 930

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 19 guests