How do I destroy an unique object?

Get help using Construct 2

Post » Fri Jun 19, 2015 2:08 am

Hi guys, I have a sprite called "cake", and using a in every 1 second condition, this cake is created on a random position at the screen..

but the problem is: if I see more than 1 cake at the screen, no matter what cake I touch to destroy, all of them is destroyed...


How to make this cake sprite be destroyed on touch without destroying the others even it is the same objec?


Thanks , I hope you can understand my question.
B
5
S
1
Posts: 60
Reputation: 495

Post » Fri Jun 19, 2015 2:18 am

Image
Sorry for my bad english, but I really do my best! And use and check with Google Translator.
B
11
S
4
G
1
Posts: 158
Reputation: 1,328

Post » Fri Jun 19, 2015 2:25 am

Can you post a capx. Generally this happens if you have your conditions set backwards but, with the Touch object, it should only happen with the object being touched. It might be how you have constructed your condition.

Alternatively here's a solution.

Create an instance variable (text) within the cake object called Actions

Create a condition:

Cake > Actions = "Destroy_Cake" >> Cake>Destroy

On Object Touched> Cake>> Set Actions>"Destroy_Cake"

Only the cake touched will have the value changed and be destroyed
Image
B
75
S
23
G
3
Posts: 673
Reputation: 9,293

Post » Fri Jun 19, 2015 11:23 am

Thanks @TheDom it works! :D


Thank you all!
B
5
S
1
Posts: 60
Reputation: 495


Return to How do I....?

Who is online

Users browsing this forum: jojomickymack and 32 guests