But I don't get why jumping is inside of is_on_floor, ...
What that line of code is doing, if is_on_floor() is calling a function to see if the collider is currently colliding with the floor.
Why you want your jumping code inside of the is_on_floor condition is so you cannot jump while in the air. Without this, you'd be able to jump as long as the player presses the ui_up action, regardless of whether they are on the ground or not.
... or what the Vector is, how it works, ...
You're talking about the motion vector, correct?
motion is being used here to store how far you are going to move once you call move_and_slide. For example, if motion = (2, 4), you are going to move 2 pixels on the X axis and 4 pixels on the Y axis next frame.
In other words, motion + position is equal to where you are going to be once move_and_slide is called, assuming there is no collisions.
(I'm simplifying a bit. In actuality, move_and_slide takes delta into account, making it where you will actually go (motion * delta) + position, so you get consistent movement regardless of frame rate. With delta, you'll actually move motion + position every second, not every frame)
By setting motion.y to JUMP_HEIGHT, you are launching your player into the air next time you call move_and_slide. Assuming there is nothing in the way, the next frame you will go JUMP_HEIGHT many pixels high on the negative Y axis.
and why passing (0, -1) into it, and ...
By passing in (0, -1) you are telling move_and_slide that any collision with that normal is a floor, and thus when is_on_floor is called again, it will return true.
The reason you want to pass in a direction going up is because when you collide, normal vectors are created going towards the collided body. For example, if you are going straight down and collided with the floor, the collision code returns a normal vector pointing from the floor towards the whatever collided going down.
In other words, you want to pass in the opposite direction your floors all take. If gravity points down, then you'll likely want to pass in the up direction so anytime you collide with a floor, is_on_floor is properly updated.
then passing that into move_and_slide makes a floor
Move and slide does not make a floor, it just moves your collision body through 2D space, and if something is in the way (say another collision body), it slides according to the collision shapes involved.
The is_on_floor function doesn't seem to be involved at all.
It could be what I said above is needs to be flipped. Instead of normal vectors being created towards colliding bodies, they are instead pointing in the same direction. I have not really worked a lot on the 2D side of Godot, so I'm mainly going off my time working with other 2D game engines. Godot may create normals going in the same direction, in which case instead of passing UP, you instead want to pass DOWN.
One thing to note though, is that is_on_floor actually uses the last move_and_slide call, so if you collided with a floor in the previous frame, then is_on_floor will be true.
See this page from the documentation for a much better explanation of how KinematicBody2D works, as it explains it much better,
(Also, no worries on being new to game development. There's no reason to apologize, we all start somewhere :smile: )