platforms disappear and reappear

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By rodell2020

OK (I am using 3.4.4 on windows 11)
Now I have my Level as follows

Level-A
platform-A
platform-B --the platform I love to make disappear/reappear —
Button [an Aear2d Sprite, collisionShape2d] about half on platform-A
exit [an Aear2d, Sprite, CollisionShape2D] at the end of platform-B
player
camera(a child of player)

I have tried placing the script file on platform-B
func _physics_process(delta):
visible = false
it works the platform disappears

now when i tried to make the player walk the button
I connect the button signal to the script platform-B
then tried visible = true but it does not work.
I can use print(“hello”) and it prints hello in the output window

:bust_in_silhouette: Reply From: Pomelo

That is because you are using a procces() function to set it invisible. Procces happens every frame (60 times per second by default). So even though your signal sets the platform visible, just in a fraction of a second, it is set to invisble again.

A quick fix would be to use _ready()to set the platform invisible, since this only triggers once when the node enters the scene.

I suggest you read the documentation

Thank you Thank you a big big big big THANK YOU,
IT WORKS JUST incase anyone wants to know you can do more than 1 platform on a level
I now have 3 (all 3 working form the same signal)

rodell2020 | 2022-06-23 12:42

glad it helped! remember to select the awnser as best awnser so that it shows as awnsered

Pomelo | 2022-06-23 14:34