simply use a collisionshape2D and link the overlapping event to the player script, then compare the object's Y position relative to the player's, and make sure the player's Y velocity is positive. For good measure, you could add an extra collision shape on the enemy that only detects collision for the top part. To answer your question directly, isonfloor() in a kinematic or rigid body will return true if the body is standing on a static floor and you are using moveandslide for your collision, but i don't think it will work well for objects on objects.