How to make a special floor that slows down the player?

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

I want to make a special floor in a 2D top-down view game that slows down the player.
I put an Area2D over the floor and used body_entered and body_exited signals, which sends signals to the player to adjust its speed. It works, but if I want a “safe” floor in the middle of the special floor, I have to use four Area2Ds and it doesn’t work anymore.
How would you solve this?

I solved this using a counter in the Player Scene, that gets incremented or decremented by body_entered and body_exited signals. If this counter is greater than 0, I slow down the player.

fago | 2018-06-09 11:30