Collect the Medals
Carli McGinty
Drakes Creek Middle School
Scratch Coding
To begin, I added sprites & backdrops that were built-in - what Scratch created. I created four sprites, one of which was the red/blue/pink medal. I first made the red one, which was made using an oval and a rectangle. I copied this costume in the sprite and recolored it to create the blue & pink medals. For the next sprite, the instructions, I took a white oval and added black text inside using the “Handwriting” font. I did this for all 4 costumes in the instructions sprite. After the instructions, I created the spike sprite. For that, I created a medium gray triangle with a black border. For the last sprite, the border, I created a red box with a black outline. I moved all the sprites to their corresponding places. Now, for the backdrops, I used 5 different backdrops that were built into the Scratch website. The names of the backdrops are Stars, Blue Sky 2, Underwater 1, Stripes, and Rays (which I recolored from a gold color to orange).
Then, I coded the intro, instructions, and backdrop question. The code for the intro is as follows, with their explanations after: When I receive [intro], show. Wait (1) second(s), start sound (Boing); change size by (10), wait (0.5) seconds, change size by (-10). Wait (1) second(s), hide, broadcast (backdrop). “When I receive [intro]” means that when the message named “intro” is broadcasted, the code that follows the block occurs. The “show” block means that the sprite will appear, with the “hide” block meaning the sprite will disappear. The “start sound (Boing)” block means that the sound named “Boing” will start playing. The “change size by (10)” and “change size by (-10)” blocks mean that the sprite’s size will add/subtract 10 to its current size. Finally, the “broadcast (backdrop)” block means that the message named “backdrop” is broadcasted. Speaking of backdrops, I needed to make the code for the backdrop question. When the backdrop message is broadcasted from the intro’s code, a question and a text box appears at the bottom of the screen. The question is “What backdrop do you want? Say either ‘STARS’, ‘SKY’, or ‘WATER’. This is not case sensitive.” After that, there’s a long chain of if-else blocks. Here’s the chain of if-else blocks: If <(answer)=(stars)>, then switch backdrop to (stars), broadcast (stars), else; if <(answer)=(sky)>, then switch backdrop to (blue sky 2), broadcast (sky), else; if <(answer)=(water)>, then switch backdrop to (underwater 1), broadcast (water), else; ask (What you entered was not one of the answers. Please enter "OK" to continue.), broadcast (backdrop), broadcast (game).
Next, I needed to add the ability for the medals & spikes to move to the left. For both sprites, I used a similar code for them to move. The code is as follows: When I receive [game], repeat until <score=75>; [wait (2) seconds, create clone of (myself), glide (2) secs to x: (-246) y: (pick random (154) to (-143)), set x to (234), delete this clone]. You may be asking, “What does this mean?” Well, to start, the “When I receive [game]” means that a message is sent (the message’s name is “game”) to the code telling it to only start the code when “game” occurs. The “repeat until <score=75>” means that the code inside the repeat bracket will repeat until the player’s score is 75. The code block “create clone of (myself)” means that the sprite will create a clone of itself, as stated. The block “glide (2) secs to x: (-246) y: (pick random (154) to (-143))” means that the sprite will take two seconds to glide somewhere between the top and bottom of the screen, going to the very left of the screen. Lastly, the code block “delete this clone” means that after the clone (created from the “create clone of (myself)” block) finishes gliding to the left of the screen, it will delete the clone.
Finally, I needed to make the mid-game rewards and the “You Win!” screen work. There are 2 scripts of code for the mid-game rewards, and is as follows: Script One - When green flag clicked, forever: [[ if <(score)=(25)>, then broadcast (music). Repeat until <<(score)=(50)> or <(score) > (50)>>: [play sound (Video Game 1) until done.] Stop [this script]. ]] Script Two - When I receive [music], forever: [[ if <(score) = (50)>, then stop all sounds, broadcast (music2). Repeat until <(score)=(75)>: [play sound (Hip Hop) until done.] Stop [this script]. ]] For the “You Win!” screen to work, I used 2 small scripts of code, and they are as followed: Script One - When I receive [game], forever: [[ if <(score) = (75)>, then broadcast (game over). ]] Script Two - When I receive [game over], show, stop [all].
The goal of this game is to collect 75 medals without touching any spikes.
I was inspired to create this idea because in many video games, you collect coins as currency. This game is trying to collect coins, but in different worlds.
The Scratch block I used that I am most proud of is the “create clone of (myself)” block. I have never used that block before, as I didn’t know how it worked.
A problem I faced was that the “Rays” background wasn’t showing up on the project. I solved that problem by changing the color of the rays, which somehow worked.
If I had unlimited time, I would add different difficulties, with each one having different score goals and different time limits.
Game Logic
Score (Repeats until player wins)
Lose
Game Movement
Click the link.
Click download
Go to scratch.mit.edu.
Click “Create” (no sign-in needed)
Click “File”. Click “Load from your computer” and click the file.
Enjoy playing!