How to make Space Invader Scratch Game (easy scratch game)

About Space Invaders Scratch Game:

Space Invaders scratch Game is a shooter game in which the player controls a Rocketship by moving it horizontally across the bottom of the screen and firing at advancing aliens.

Make the Rocketship move with arrow keys

When you press the Left-and Right-Arrow keys on your keyboard, the Rocketship should move smoothly left and right. You can adjust the player movement speed by increasing or decreasing the CHANGE X BY value. Test it! The movement of Rocketship with your arrow keys.

Shooting the aliens with Laser

Let’s set up our laser that we’ll shoot from the Rocketship at the aliens.

When spacebar is clicked, a laser should shoot out of your spaceship and destroy any aliens it hits. It should move up until it touches the edge of the screen or an Alien. If it hits, then hide the laser in either case.

Test it! Each laser should now destroy just one alien or disappear when it reaches the top edge of the Stage.

Make the Clone of Aliens:

Instead of duplicating, you can now use a single code block to clone as many aliens as you want when the game begins. Can you see why this is so much better? You only have to make changes to that first alien and all the clones will have those changes.

Steps involved in creating Aliens Clones:

  1. Move the original Alien sprite to the top-left corner of the Stage.
  2. The repeat 7 block repeatedly moves 60 steps to the right while making clones of itself, resulting in a row of 7 Alien clones.
  3. The repeat 3 block repeats the row-creating code to create 3 rows of Alien clones.
  4. 7 Alien clones in a a row multiplied by 3 rows results in total 21 Alien clones.
  5. set the X value back to -200 so the parent sprite starts each row in the same location.
  6. Add a HIDE block at the end of your alien cloning code, then add a SHOW block at the beginning of the code.

Test it! Each time you click the Green Flag button the original alien sprite will appear, create all the clones, and then hide during the game.

Give clones their marching orders:

The clones wait patiently until they receive the broadcasted message “Start Marching”, and then the clones should begin marching back and forth across the stage.

If you want a sprite to point only left or right, you can change the rotation to left – right.

When the invaders reach the right side of the screen (if X position is greater than 210),and left side of the screen (if X position is less than -210), they should broadcast the message “Turn”

When the alien clones receive the message “Turn”, they should do following two things:

  • When your marching aliens reach the right side, they should now change direction without flipping upside-down.
  • They also should move down the Stage, getting closer and closer to the player.

Test it! When the invader reaches the edge it changes direction and also moves downward. That way each time they move all the way across the screen they move closer to the player. Eventually if the player isn’t careful, they get to the bottom and the game ends.

Program Enemies to Drop Bombs

The game will be a lot more challenging if the aliens can fight back. Since they are bug-shaped, I think we should give them some exploding egg bombs!

You need to instruct the bombs

  1. To have different enemies attack at random.
  2. For every three to six seconds, each alien will create a clone of bomb.
  3. To drop toward the bottom of the Stage.

Randomize enemy attacks:

It will require a bit more programming to have different enemies attack at random.

Program your bomb so that, it will drop at random times and drop from different enemies instead of same place.Create variable named ‘bomb x’  and variable named ‘Bomb y’. This variable will instruct the bombs where to fall from.  By using variable, each alien clone tell the bomb where it is.

Test it! When the green flag is clicked,the bomb drops from random enemies.

You need to instruct the bombs to drop toward the bottom of the Stage. It should move down until it touches the edge of the screen or an Rocketship, If it is then delete the Bomb in either case.

Simple Space Invaders Scratch Game Code

DOWNLOAD SPACE INVADERS SCRATCH GAME PROJECT FILES:

To download the project files of the Space Invaders scratch Game click here and you can also learn another interesting easy Scratch game tutorial on Brick Breaker Game On Scratch and Tic Tac Toe Game on Scratch here.

scrat

View Comments

  • But wanna input that you have a very nice website , I love the pattern it actually stands out.

Recent Posts

Create Your Own Super Mario Game in Scratch (Easy Step-by-Step)

Here's a step-by-step tutorial to create a platformer game similar to Super Mario in Scratch:…

3 weeks ago

Create a Fun Whack-a-Mole Game in Scratch: Step-by-Step Tutorial

Here's a step-by-step tutorial to create a Whack-a-Mole game in Scratch with code snippets: 1.…

3 weeks ago

Spot The Difference Game in Scratch

About Game: In Spot The Difference Game, the player has to spot the difference between…

3 years ago

Memory game using Scratch| Step by step Scratch Tutorial

In this scratch tutorial, you will create a memory game in which you have to…

3 years ago

How to make Flappy Bird on Scratch | Coding For Kids

In this article, we are going to teach you how to program your owncustomized version…

3 years ago

How to make Shooting Game on Scratch (Duck Hunt Game)

About Duck Hunt Game: This is a remake of the classic video game Duck Hunt.…

3 years ago

This website uses cookies.