Which Star Wars character are you?

May the fourth be with you!

I love Star Wars and me earliest memory of watching it was at my friend's house when it was his birthday. I had to leave early and just got to the bit where C3P0 and R2D2 crash landed on Tatooine.

To celebrate Star Wars, every year on May 4 it is #Maythefourth be with you day. And to help celebrate this year I've made a really simple game in Scratch.

Hi reader!

I never put my blog posts behind paywall or pop ups because quite frankly that is annoying and prevents anyone from accessing the content. I will always keep my blog content free of charge. But I do ask that if you are able and willing, that you buy me a "coffee" as it helps me to pay for hosting this blog, and to buy stuff to hack from Poundshops / Dollar Stores / Aliexpress which are used in free projects and reviews on this blog. It is You dear reader who make this possible, and I am immensely grateful for your support.

Thanks!

How can I build my own game?

You will need

Coding the game

You will need to go to the Scratch website and open a new project

Using Sprite 1, the cat, we are going to create a sequence of code that will forever loop through the different costumes for the sprite, until the player presses the STOP! button.



We start by going to Events and then we drag the When Green Flag Clicked block to the coding area.



Then we go to Control and drag a forever loop into the coding area, connecting to the previous block.



We need to create a Variable and we can find this in the Variables section. Call the variable stop and make sure it is for all sprites.



From Variables we now need to drag set stop to 0 and place it inside the loop.



The block in Variables may be called set my variable to 0, you can use that and change the value using the drop down menu.



From Control we drag repeat until <> amd place that inside the loop, and underneath the previous block.



The next step is to add a (__) = (__) block from Operators. This block will compare what is in the left blank space, with the right blank space. In the left space we need to drop stop from Variables and in the right blank we type stop.



So what happens inside this new loop? Well first we change the costume of the sprite. Go to Looks and place next costume inside the repeat until loop. Then go to to Control and drag the wait 1 seconds block into the code, place it under the previous block. Change 1 to 0.1.



The last block for this sprite is another wait 1 seconds block, but this is outside of the repeat until loop, but inside the main forever loop.

Adding costumes



If you have downloaded the Star Wars icons, extract them into a folder.



Click on the Costumes tab and first delete the cat costumes!



Now go to the bottom left and click on Upload Costume



Select all of the icons at once, and click Open / Ok. This will import all of the icons at once!

Adding another sprite



This new sprite is a button which will trigger the game to pause and choose our character.



To create a new sprite, click on the cat icon at the bottom right of the screen and click on Choose a sprite



Choose Button 2.



I edited the button to have a different colour, and the word STOP! in big letters.

Coding the button



With the button sprite still selected, click on the Code tab to start writing code for the sprite.



The first block is from Events and it is when this sprite clicked.



Next we go to Variables and drag over set stop to 0 and change the 0 to stop.



From Control we use the wait 1 seconds block, changing the 1 to 5.



Lastly we go back to Variables and drag over another set stop to 0

Adding some music



Look to the far right, in the middle. You will see the Stage icon. Click on this icon and we can now write code for the stage.



Next click on the Sound tab to start working with sounds.



Click on Upload Sound and then upload the music that you would like to use.



We can edit the sound in Scratch too.



If you would like to use some of the music already in Scratch then click on Choose a Sound via the speaker icon.



And select the music from the large selection built into Scratch.

Coding the music



The last step is to add the blocks that will play the music. First we use when green flag clicked from Events to trigger the sequence.



Then from Control we use a forever loop.



Lastly from Sound we drag the play sound music until done block and place it inside the loop.

That is all of the code now complete! Now you can find out which Star Wars character you are!

May the force be with you!