Space Invaders Game - Scratch Tutorial
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.
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.
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.
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.
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.
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:
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.
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
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.
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.
Here's a step-by-step tutorial to create a platformer game similar to Super Mario in Scratch:…
Here's a step-by-step tutorial to create a Whack-a-Mole game in Scratch with code snippets: 1.…
About Game: In Spot The Difference Game, the player has to spot the difference between…
In this scratch tutorial, you will create a memory game in which you have to…
In this article, we are going to teach you how to program your owncustomized version…
About Duck Hunt Game: This is a remake of the classic video game Duck Hunt.…
This website uses cookies.
View Comments
But wanna input that you have a very nice website , I love the pattern it actually stands out.