Can Spawned Objec know Parent

Get help using Construct 2

Post » Wed Mar 27, 2013 5:57 am

Hi

Im having this problem: When my player runs, its catching the bullet he just fired, and being hit by it.

Is there a way to know which object spawned another object, so I can set my bullet to ignore the collision with the object who spawned it?

Thanks.
B
7
S
3
G
3
Posts: 53
Reputation: 2,459

Post » Wed Mar 27, 2013 6:41 am

Give bullets instance variable 'Owner'

Then, modify your events along these lines:

Player spawn bullet
.. bullet.owner = player.uid

bullet on collision with target
bullet.owner not equal to target.uid
.. do collision stuff
vee412013-03-27 06:42:27
B
24
S
8
G
7
Posts: 756
Reputation: 7,202

Post » Wed Mar 27, 2013 1:46 pm

Thanks. That did the trick.
B
7
S
3
G
3
Posts: 53
Reputation: 2,459


Return to How do I....?

Who is online

Users browsing this forum: Justin1967, qaisarehman and 32 guests