we had to design the character movement without the use of kinematicbody2D because it wouldn't interact with the die properly (infinite inertia). so we somehow made a character controller with the rigidbody2d node in character mode, which i don't recommend at all using in case you're considering it. move_and_slide() wasn't available
also in your code i recommend storing the player's velocity
and then doing
velocity = move_and_slide(velocity, Vector2.UP)
otherwise the player will continue moving in a certain direction even though there's an obstacle in the way
(like continuing to move upward after hitting the ceiling)