This is basically the Jumping game Scratch educator card (link below). However, I didn't like that the jumping worked even when the game had stopped so I put the jumping code into a forever block with a wait for space pressed. https://resources.scratch.mit.edu/www/cards/en/scratch-cards-all.pdf