/ star wars

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.

Animated-GIF-downsized_large--4-

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.

Screenshot-from-2020-05-02-16-11-12
We start by going to Events and then we drag the When Green Flag Clicked block to the coding area.
Screenshot-from-2020-05-02-16-14-25
Then we go to Control and drag a forever loop into the coding area, connecting to the previous block.
Screenshot-from-2020-05-02-16-15-22
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.
Screenshot-from-2020-05-02-16-16-42
From Variables we now need to drag set stop to 0 and place it inside the loop.

variable
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.

Screenshot-from-2020-05-02-16-28-37
From Control we drag repeat until <> amd place that inside the loop, and underneath the previous block.
Screenshot-from-2020-05-02-16-32-50
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.
Screenshot-from-2020-05-02-16-47-03
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.
Screenshot-from-2020-05-02-16-51-42
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

upload-icons
If you have downloaded the Star Wars icons, extract them into a folder.
Screenshot-from-2020-05-02-16-58-53
Click on the Costumes tab and first delete the cat costumes!
Screenshot-from-2020-05-02-17-00-08
Now go to the bottom left and click on Upload Costume
Screenshot-from-2020-05-02-17-02-21
Select all of the icons at once, and click Open / Ok. This will import all of the icons at once!

Adding another sprite

Screenshot-from-2020-05-02-17-05-49
This new sprite is a button which will trigger the game to pause and choose our character.
Screenshot-from-2020-05-02-17-06-58
To create a new sprite, click on the cat icon at the bottom right of the screen and click on Choose a sprite
Screenshot-from-2020-05-02-17-07-09
Choose Button 2.
Screenshot-from-2020-05-02-17-11-48
I edited the button to have a different colour, and the word STOP! in big letters.

Coding the button

Screenshot-from-2020-05-02-17-12-57
With the button sprite still selected, click on the Code tab to start writing code for the sprite.
Screenshot-from-2020-05-02-17-19-59
The first block is from Events and it is when this sprite clicked.
Screenshot-from-2020-05-02-17-20-50
Next we go to Variables and drag over set stop to 0 and change the 0 to stop.
Screenshot-from-2020-05-02-17-22-07
From Control we use the wait 1 seconds block, changing the 1 to 5.
Screenshot-from-2020-05-02-17-23-25
Lastly we go back to Variables and drag over another set stop to 0

Adding some music

Screenshot-from-2020-05-02-17-31-15
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.
add-sound
Next click on the Sound tab to start working with sounds.
Screenshot-from-2020-05-02-17-35-08
Click on Upload Sound and then upload the music that you would like to use.
Screenshot-from-2020-05-02-17-37-45
We can edit the sound in Scratch too.

Screenshot-from-2020-05-02-17-39-37
If you would like to use some of the music already in Scratch then click on Choose a Sound via the speaker icon.
Screenshot-from-2020-05-02-17-38-52
And select the music from the large selection built into Scratch.

Coding the music

Screenshot-from-2020-05-02-17-42-00
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.
Screenshot-from-2020-05-02-17-56-17
Then from Control we use a forever loop.
Screenshot-from-2020-05-02-17-56-53
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!