destroy only one

For questions about using Classic.

Post » Thu Jan 26, 2012 12:14 am

I have 4 same objects with private variable "hp". When "hp" is equal "0" object is destroyed, but it also destroys every other same object. How to avoid that?
B
11
S
3
G
6
Posts: 193
Reputation: 4,234

Post » Thu Jan 26, 2012 12:36 am

If its just sprite.value("hp") = 0, destroy, then it should work.
Try hp <1, if it still happens its a bug or how the picking is set up.
Image Image
B
161
S
48
G
91
Posts: 7,358
Reputation: 67,271

Post » Thu Jan 26, 2012 7:47 am

Hmm.. still destroys every object.. here's a screen:
MastaZavr2012-01-26 07:48:00
B
11
S
3
G
6
Posts: 193
Reputation: 4,234

Post » Thu Jan 26, 2012 7:49 am

I still have the same problem... Here's a screen:

B
11
S
3
G
6
Posts: 193
Reputation: 4,234

Post » Thu Jan 26, 2012 8:21 am

Might be something wrong with your other events.
Just tried a new cap wiht this only and it works ok :

------
+ MouseKeyboard: On Left Clicked on Sprite
-> Sprite: Subtract 1 from 'hp'
+ Sprite: Value 'hp' Less or equal 0
-> Sprite: Destroy
------

Maybe check if the event decreasing the health value isn't depleting all instances variables?
B
4
S
1
G
2
Posts: 91
Reputation: 1,057


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests