How to Code a Basic Retro Space Shooter on Scratch!
by hmartin22 in Circuits > Computers
1677 Views, 4 Favorites, 0 Comments
How to Code a Basic Retro Space Shooter on Scratch!
Hi I have created this tutorial for people who are new to coding on scratch and would like to create a game.
Below this is me playing the game.
Supplies
For This You will need to have or make a scratch account to create and save these games.
Creating the Background
First Go to the background tab at the bottom of the screen, Click it then convert to bitmap. Use the bucket to fill it with black and then add white dots. Note: you can animate it but that is optional.
Add a Ship
To add a space ship I Set my pen size to 5 on bit map to make it a pixel and made something that looked like a rocket. I also decided to add a spinning animation.
Aliens!
Now for the fun part Design an alien That the ship has to defeat to get points. For my alien I decided to make it spin to make it look cooler
Add More Aliens and Delay Animations for Wavelike Pattern
For this step you add a block that says go to and set the start location and then get the glide to block and set were you want it to go. Then add multiple aliens with the same script and add a short 0.1 - 1 second delay adding a tenth or more seconds each time this should result in a wavelike pattern if done correctly.
Laser Beam
Create a beam out of pixels any design you want then make it hide when flag clicked but when space key pressed show go to the space ship whatever sprite it is and change y by 20 until it hits the alien or make it wait 3 seconds and then hide.
Score and Alien Hit
Make 2 new variables one called hit and one called score. Make it so when the flag is clicked these two variables are set to zero. Go to all of the alien sprites and make have a forever block around an if then block which says if touching laser beam (what ever the sprite is called) then change hit and score by one. Now code it so when hit equals three make the aliens show and then make it so when hit equals six show a new sprite which is your YOU WIN! screen.
The End
That is all there is to making a shooter game
If you would like the rocket to move then do when key left or right pressed then move -10 or 10 x Eathier direction