Fade out pinned object when another dies

Get help using Construct 2

Post » Mon Aug 07, 2017 12:43 pm

My object has pinned "spech cloud" but when object die, cloud die too. I want' to make this cloud fade out. It's not matter that object is destroyed.

This is not working and cloud die when object die:
Image
B
10
S
4
G
2
Posts: 198
Reputation: 2,384

Post » Mon Aug 07, 2017 1:13 pm

Is the cloud object in a container with the enemy? If not then the cloud shouldn't be destroyed with the enemy, and there must be something else in your code that is destroying or moving it (check the debug to confirm that cloud is actually being destroyed).

If the cloud is in a container with the enemy then it will be destroyed with the cloud, because that's the way that containers work. Off the top of my head here are a couple of workarounds:

1) Rather than destroying the enemy immediately, set it to invisible and start the cloud fading; when the cloud has faded out then destroy the enemy. You will need to disable the collisions and/or use an instance boolean to differentiate the "kind of dead" enemy from living enemies so that it doesn't continue to respond to enemy events.

2) Before destroying the enemy spawn a new "fadeCloud" object in the same position as the cloud object - this just has the fade behaviour on it and destroys at the end of the fade.
B
22
S
9
G
4
Posts: 479
Reputation: 4,333

Post » Mon Aug 07, 2017 2:18 pm

mekonbekon

yes there is container, so now it's understandable.
thanks much for another metod advice!
B
10
S
4
G
2
Posts: 198
Reputation: 2,384

Post » Mon Aug 07, 2017 4:32 pm

You're welcome :)
B
22
S
9
G
4
Posts: 479
Reputation: 4,333


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 25 guests