One possible approach is, instead of having the 8 direction behavior control your character sprite directly, have it control your character's invisible "footprint" (a separate sprite object). Create a new object to act as your character sprite and, every tick, set its coordinates to match the coordinates of your footprint object.Altitude variable
Now you just need one more value to store the player's current altitude above the ground. Normally your altitude will be 0, because you'll be standing flat on the ground. When you jump, this value will increase up to your maximum jump height and then decrease back to 0.
So far so good, but that altitude number won't move your player by itself.Actually jumping
Earlier I said we'd set the character's coordinates to match the footprint's coordinates. We now need to make a small change...
We still make the character's X coord match the footprint's X coord, but we set the character's Y coord to equal the footprint's Y coord PLUS
the altitude number.
Now when you move the character should follow the footprint, and when you jump, the character should hop up and down "vertically" over the footprint.
As an added bonus, you can attach a little shadow image to the footprint object and it will always be directly "under" your character even when jumping.Borrowing Jump altitude from the Platform behavior
Now, if you don't want to build custom code to make the altitude variable "jump" when you press jump, you can borrow the jump behavior from the platform object in a roundabout way.
We basically create an invisible platform object that can only jump, put it somewhere out of the way, and we use its Y position as the real character's jump altitude.
Specifically, we create an invisible platform object with it's controls disabled (so the player can't move it), and then we make the game's Jump key trigger the platform object's "Simulate control" action to simulate a Jump, so the player can make it jump, but not move around.
We'll also need to make an invisible solid object for it to stand on, and we'll position them both so that the platform object's Y coord is 0 when it's resting on the solid ground object.
Every tick, the player's altitude variable should be set to the platform object's Y coord.
This method also allows you to optionally use some of the other nice features of the platform object's jump system, like holding jump to go higher.