The dot(Vector2(0, -1)) part: It's comparing the angle of that normal's direction between the direction of a vector that is pointing up in a 2D screen coordinate system.
The dot product numbers will tell you if two vectors are:
- Going in the same direction. (Positive number)
- Perpendicular to each other. (0)
- Heading in the opposite direction of each other. (Negative number)
In this example, as others said, they applied an inverse cosine function to convert that number into an angle in radians, then convert it into degrees.
The result is an angle between this normal's direction and a vector pointing straight up, then comparing if that angle is beyond a threshold.
It's also very similar to the
angle_to() method inside the vector itself, but it keeps track of a the negative sign. You could use it just the same if you applied absolute value to keep it always positive so it can be compared.
Maybe this is a more readable version for the mind's eye. (I left the units in radians to cut down on the example):
var up_vector = Vector2(0, -1) # If it's screen coodinates, -1 is up
if(abs(normal.angle_to(up_vector)) < FLOOR_RADIAN_TOLERANCE): #do stuff