The goal of this game is to have our character jump the ball.
We will be using two sprites to make our game, we need a sprite that can jump the ball when we press the space key.
We also need a sprite that can be the object that needs to be jumped over.
Jumping Sprite
We are going to use the Glide block to make our character jump up and then jump down.
We want our sprite to start in the same spot each time.
We then want our character to jump when we press the space key.
I’ve made my sprite jump up 140 pixels, and then jump down a little slower 140 pixels. Be sure to use the + and – blocks. We also use the ‘x position’ block to make sure the character doesn’t jump forward or backwards.
Test these numbers out to find a good jumping speed. If you want to jump sideways on the X, give it a try as well.
Now we need to have the ball fly across the screen.
We always want the ball to move across the screen, so we will use a forever block. When the x position gets to -230, it will be very close to the edge of the left hand side of the screen. We then move it back to the right hand side so that it can fly across the screen.
We change the X by a number (I’ve chosen 10), and I’ve also made it look like it’s spinning by using the ‘turn 5 degrees’ block.
Making it Harder
We can add a variable called ‘BallSpeed’ which will store a random number that represents how fast the ball moves across the screen.
Add the Score
We can make the scoring system add one to the user score when the ball is reset to the starting position, this can only happen if the player jumped over the ball successfully.
We then need to add a test to see if we touch the jumping sprite, if we did hit it, we subtract from the score and move the ball back to the right hand side of the screen.
Test out the random speed numbers.