Fading an object

Hi i have an idea that when my player jumps on a cloud. the cloud wil slowely dissapear so he has to do the parkour really fast other wise he wil fall and die. I thought it had to do something with collusion but i am stupid and nothing works. Can someone help me with this idea???

You can use the tween behavior to dissapear the cloud. Then check if the tween has finished, and if so, deactivate the platform behavior. You can also use a timer that gradually dissapears (lowering the opacity) the cloud, and when the cloud has reached a certain opacity, the platform behavior gets deactivated.

What events do you have? Can you give a screen snip of them?

What @Epicsleeper is suggesting is right, and you should tween the opacity of the cloud. If you don’t need the cloud once it’s jumped on, you can set the option in the tween to delete the cloud when the tween is finished. All this can be achieved in 1 event action.

1 Like

Hi i have sort of figured it out the problem is that when the opacity hit 0 and the object cloud is deleted and my player dies the cloud doesnt respawn do you know what i did wrong??

What happens when the player dies, do you restart the scene or do you spawn the player at a checkpoint? Because restarting the scene should place the cloud back.

Also, you can set the Z order of the cloud in the editor itself instead of doing it at the beginning of the scene.

When my player dies it spawns at a checkpoint

When you teleport to a checkpoint, everything in the scene will still be the same since you didn’t ask for anything to happen besides spawning at a checkpoint.

You could store the checkpoint X and Y in a global variable and also a just_died global variable that gets set to 1 when you die, and after that restart the scene. Then at the beginning of the scene, check if the just_died global variable is 1 and then load the X and Y global variables and spawn the player. Make sure you set the just_died variable back to 0.

This way everything in the scene gets recreated. There are different ways to achieve this but this is a simple one.

The downside of that is that collectables are replenished, which is not always a desirable effect.

In the light of @Aampowertje06’s requirements, I prefer your earlier idea, @Epicsleeper, of deactivating the behaviour. When the player is respawned at the checkpoint, just set all clouds to visible and re-activate their behaviour.

1 Like

I indeed also recommend that method :slight_smile: