The rocketship can move — now it needs to fight back! In this activity, we will add a bullet sprite and program it to shoot upward from the rocketship when the spacebar is pressed.
Adding the Bullet Sprite
- Open your Space Battle Game file from the previous lesson.
- Add a new sprite for the bullet — you can draw a small circle or use a small ball sprite from the library.
- Resize the bullet to about 20% so it looks like a small projectile.
- Hide the bullet at the start by adding a 'Hide' block in its initialization script.
Programming the Bullet
The bullet should appear at the rocketship's position when the spacebar is pressed, then fly upward until it hits the top of the Stage or an enemy. You will find the blocks in the mentioned palettes:
- When flag clicked: Hide the bullet — Events, Looks
- When (space) key pressed: Go to (Rocketship), Show, point in direction 0 — Events, Motion, Looks
- Repeat Until (touching edge? OR touching Ghost?): Move 15 steps — Control, Motion, Sensing
- Hide the bullet after the loop ends — Looks
- If touching Ghost?: Change Score by 1 — Sensing, Variables

Handling Multiple Bullets
Because each bullet follows the same script, the player can only have one bullet on screen at a time. This is fine for now — it adds a challenge to the game!
In more advanced games, cloning is used to create multiple bullets at once. For now, one bullet at a time keeps the game balanced and simple.
Testing the Shooting
- Click the green flag to start the game.
- Move the rocketship using the arrow keys.
- Press the spacebar to shoot a bullet.
- Watch the bullet fly upward from the rocketship!
- Try to aim at the ghost and hit it to earn points.
Save your file before moving on to the final activity — programming the ghost enemy!

.webp&w=3840&q=75)
.webp&w=3840&q=75)
.webp&w=3840&q=75)
.webp&w=3840&q=75)
.webp&w=3840&q=75)