Pinning sprites to physics objects. Destroy only 1

Get help using Construct 2

Post » Thu Feb 07, 2013 3:29 am

I have been trying to get my bad guys into my game.

Rocks fall from an area and hit the monster sprites, and the monsters should get smashed, and remove the sprites from the screen.

I have them all working properly when the animated sprite is the physics object. When I try to change the physics object to a static, non-animated sprite, and pin the animated sprite to the static sprite, Every instance of the monsters gets destroyed on collisions with the rocks now.

Is there another to adjust the physics object, so only the instance that gets struck by the rock gets removed?

Thanks for any help. I have been going over the forums and tutorials off and on all afternoon. It would be really great to get this solved tonight.
jojoe2013-02-07 03:29:56
B
28
S
8
G
4
Posts: 767
Reputation: 5,940

Post » Thu Feb 07, 2013 4:52 am

Sounds like its destroying all instances because its picking all of them during the collision. Try adding a sub event and use "pick nearest" and destroying that one

eg:
rock on collision with monster
(sub event) pick nearest monster - > destroy
B
50
S
21
G
8
Posts: 844
Reputation: 10,299

Post » Thu Feb 07, 2013 5:04 am

That is a great tip justifun. Thank you, I am going to try that now.

I was just coming back to say I found a little workaround. I had the rock spawn a cartoon "POW" sprite, and the "POW" sprite destroy the instance.

I like your way better though justifun. It sounds a lot more elegant simple. I would rather not have my special effects colliding with things. :)

Thanks very much :)
B
28
S
8
G
4
Posts: 767
Reputation: 5,940


Return to How do I....?

Who is online

Users browsing this forum: imnotspecial, tomi71, totoe, Yahoo [Bot] and 10 guests