How do I destroy only one instance of an object?

Get help using Construct 2

Post » Mon Jun 12, 2017 2:48 am

Hello everyone!
As the subject says, I want to destroy only one instance of an object and not all of them on the screen. How can i do?
For example, on collision, I want to destroy the object that collide, but all the objects of that kind are destroyed instead.

I wish you can help me!

Thanks!!!
B
4
Posts: 2
Reputation: 204

Post » Mon Jun 12, 2017 3:15 am

Hi.

You simply say OBJECT on collision with PLAYER >> spawn your explosion, add your score, then OBJECT destroy
and that should destroy only the object that collided

Another tip that you might need, there is a SYSTEM select random instance which is useful to pick one out of many instances.

Another possibility is to put a condition to OBJECT that OVERLAPS the player, which will then only apply to those specific instances which are overlapping. This is useful if you have for example a planet that has an atmosphere and if a plane flies out then it would be destroyed via NOT overlapping atmosphere.

Good luck!
Thank you to Construct 2 for giving me the ability to create games without programming knowledge.

My games & gaming portal = DolyGames

If anyone wants to cooperate to help each other Win-Win please email me - I am always happy to discover new opportunities.

Cheers,

COSMOS
B
20
S
9
G
1
Posts: 75
Reputation: 2,152

Post » Thu Jun 15, 2017 2:11 am

DolyGamesCosmos wrote:Hi.

You simply say OBJECT on collision with PLAYER >> spawn your explosion, add your score, then OBJECT destroy
and that should destroy only the object that collided

Another tip that you might need, there is a SYSTEM select random instance which is useful to pick one out of many instances.

Another possibility is to put a condition to OBJECT that OVERLAPS the player, which will then only apply to those specific instances which are overlapping. This is useful if you have for example a planet that has an atmosphere and if a plane flies out then it would be destroyed via NOT overlapping atmosphere.

Good luck!



Thanks!!!!!!!
B
4
Posts: 2
Reputation: 204

Post » Thu Jun 15, 2017 5:10 am

Aran24 wrote:
DolyGamesCosmos wrote:Hi.

You simply say OBJECT on collision with PLAYER >> spawn your explosion, add your score, then OBJECT destroy
and that should destroy only the object that collided

Another tip that you might need, there is a SYSTEM select random instance which is useful to pick one out of many instances.

Another possibility is to put a condition to OBJECT that OVERLAPS the player, which will then only apply to those specific instances which are overlapping. This is useful if you have for example a planet that has an atmosphere and if a plane flies out then it would be destroyed via NOT overlapping atmosphere.

Good luck!


Thanks!!!!!!!


My pleasure :)
Thank you to Construct 2 for giving me the ability to create games without programming knowledge.

My games & gaming portal = DolyGames

If anyone wants to cooperate to help each other Win-Win please email me - I am always happy to discover new opportunities.

Cheers,

COSMOS
B
20
S
9
G
1
Posts: 75
Reputation: 2,152

Post » Tue Jun 20, 2017 7:15 am

when using multiple enemies you can also use instance variables to give each instance of an object its own unique health value, sort of like in mariokart how you have battle mode w the 3 balloons, each player doesnt die until hit 3 times.
B
22
S
12
G
1
Posts: 108
Reputation: 2,774


Return to How do I....?

Who is online

Users browsing this forum: evillair, Yahoo [Bot] and 13 guests