creating a game of Rock-Paper-Scissors in program called Scratch

Assignment 4

You will be creating a game of Rock-Paper-Scissors in program called Scratch. Scratch is a visual programming language created by MIT for the purpose of learning programming. It touches on many of the basic concepts in popular programming languages used today, such as C, C++, Java, and Python.

This assignment will be out of 1000 possible points.
Getting started:

Download the Scratch installer from the CMPE 3 eCommons “Resources” link, and install.
Read through the brief Concepts Covered and Overview of Scratch sections below.
For more help, check out these two fully-functional Scratch program examples by right-clicking on the links and selecting “Save link as…”. Then open them on your computer.
Number Guessing Example
Why Did the Fish Cross The Road Example
For more explanation about these examples, check out the Descriptions of Examples at the end of this page.
Download and open the skeleton starter file by right-clicking on the link and selecting “Save link as…”. Then open it on your computer.
Rock-Paper-Scissors Skeleton
This is your starter file for this assignment.
It contains some pre-designed sprites and scripts to help you get started.
Ignore all chunks of scripts that begin with “When [green flag] clicked”. These are just there to reset your game when you click the green flag in the upper right of the window.
Follow the Assignment Requirements to complete this assignment.
Concepts Covered:

sprites – These are the basic objects in Scratch that can contain scripts, costumes, and sounds associated with them. This assignment will have 3 sprites: Computer, Player, and Go button. Sprites roughly represent “objects”, a fundamental concept of object-oriented programming languages (such as C++ or Java).
costumes – These are images that are associated with a sprite. In this assignment, the Player sprite and Computer sprite will have rock, paper, and scissor costumes. The Computer sprite will have an additional question mark costume. The Go button sprite only has one costume, a green go button.
variables – This is a fundamental concept of computer programming. A variable can contain anything (a number, word, sentence, etc.) that can be stored and used later in the program.
conditionals (such as “if” or “if/else” blocks) – This is another fundamental concept of programming. Conditionals are necessary when comparing the moves of the Player and Computer, and making a decision about who wins or loses.
loops (such as “while” or “for” blocks) – This is another fundamental concept of programming (that might not be necessary in this assignment). Loops allow parts of a program to run multiple times. Loops are often controlled by conditionals and variables.
printing (such as “think” or “say” blocks) – This is a basic feature in most programming languages (not to be confused with printing paper from a printer). Printing basically means displaying words on the computer screen (i.e. printing the words “Player wins!” to the screen if the player wins). In Scratch, this is done by using the “think” or “say” blocks.
delays (such as the “wait” block) – Sometimes the speed at which scripts run is too fast to see the results. Parts of the script can be paused or slowed down by using “wait” blocks. For example, switching to a costume, and then a 2nd costume, can occur too quickly to see. So by placing a “wait 1 second” block in between, you can see the first costume for 1 second before it switches again.
random numbers – A random number block can generate a random number between any two numbers (ex. a random number between 1 and 10).
broadcast messages – Broadcasts let sprites communicate with each other by sending out a message to all other sprites, allowing any other sprite to respond (ex. when the go button is pressed, it broadcasts a message to the computer to select a new random costume). Broadcasts roughly represent the concept of “calling” a function, a fundamental concept of many programming languages.
Overview of Scratch:

The idea behind creating programs in Scratch is to drag and drop blocks you want to use from the Code blocks window into your Scripts window. There are several menus and windows that are important to understand, and they are illustrated in the image below. Blocks/scripts can be rearranged within the Scripts window by dragging the top block wherever you want (all blocks attached under the top block move as one). A white line appears when inserting a block in-between blocks, letting you know where it’ll insert.

Assignment Requirements:

Change the background image for the stage. (100 points)
Tip: Clicking on Stage in the Sprites window will show you some new tabs in the Scripts/Costumes window that might be useful for changing the Background image.
Create a sprite for the player (so the Player sprite can play against the Computer sprite). (100 points)
Tip: There are three star buttons above the Sprite window. You can create a new sprite with any of these. This will create the first costume of your sprite, and then you can add more costumes later.
Add three costumes for the player: a rock, a piece of paper, and scissors (or use three images of your choice – just be consistent!). (50 points)
Tip: Click on the sprite you just created for the player and then look in the Scripts/Costumes window (specifically, the Costumes tab).
Add three additional costumes for the computer (leaving the question mark as the fourth costume). (50 points)
Tip: Use the same order for costumes that you did for your player. Make the question mark costume be costume #4 (you can drag the costumes to re-order them).
Add script to the Player sprite, so it will change costumes when it is clicked. (100 points)
Tip: All scripts must start with a large, yellow, wavy block (for example, “When ___ clicked”). All following scripts plug into that block.
Add script to the Computer sprite, so when the Go button is pressed, the Computer sprite changes costumes to a question mark and then changes to a random costume (either the rock, paper, or scissors costume). (200 points)
Tip: If you followed tip #4, your costume order for both the Player and Computer sprites should be similar to: 1) Rock, 2) Paper, and 3) Scissors. Assuming that is true, you will want the computer to switch costumes to a random number where the random number represents the costume number. In order to kick off this sequence of events, you will want the Go button to broadcast that it wants the computer to change costumes, and then wait for the computer to finish changing costumes. Also note that blocks with rounded edges can fit into blocks with square menus.
Add script to the Go button sprite that determines who the winner of the round was. (200 points)
Tip: If you followed tip #4, then your logic could be: If the costume number of the computer equals the costume number of the player, then it is a draw. Else if the costume of the Player beats the costume of the Computer (or vice versa), then store the winner in the “winner” variable for use in steps #8 and #9.
An example script has already been done for you. You can duplicate chunks of code by right-clicking the top block and selecting “duplicate”.
Add script to the Go button sprite that displays who won the round (Computer, Player, or Draw). (100 points)
Tip: If the winner was the Player, then the Go button sprite would want to display that they won (using the “think” block) – and similarly if the computer won, or if it was a draw.
An example script for #8 and #9 has already been done for you.
Add script to the Go button sprite that increments the score for the winner. (100 points)
Tip: If the winner was the Player, then the player score should increment by a positive number (and similarly if the computer won).
Extra credit (for up to a maximum 100 extra points):

Add motion to the sprites (i.e. make the sprites spin when picking a new costume, walk off and walk back onto the screen, bounce when clicked, etc.). (100 points)
Make the computer cycle through costumes before it selects a random one (i.e. make the computer look like it shuffles through costumes before stopping on the randomized one). (100 points)
Add visual effects (from the Looks category) to the sprites. (50 points)
Add sounds to the game. (50 points)
SUBMIT your Scratch file (with any file name) to eCommons under Assignment 4.

Descriptions of Examples:

Number Guessing game: This game only uses one sprite and one costume, so it focuses on variables, random numbers, input prompts, output messages, loops, and if/else logic. The user is prompted to click on the Go button, and then asked to guess a number between 1 and 10. The Go sprite generates and stores a random number between 1 and 10, and then compares that value to the user’s guess. The user has three tries to guess the correct value, and is told after each guess if they got it right or not. If the user guesses correctly, the script congratulates the user and then stops. If the user runs out of guesses, the script tells the user what the right answer was and then stops.
Why Did the Fish Cross the Road game: This example consists of two sprites each with multiple costumes, input prompts, output messages, broadcast messages, sprite motion, and delays using waits. The user is first prompted to answer the question “Why did the fish cross the road?” which triggers the monkey sprite to change costumes, and then a broadcast message is sent to the fish sprite which then moves out onto the screen. Once the fish is done moving, the monkey sprite continues to ask the fish if it crossed the road for the reason that the user entered. This sequence of events triggers another broadcast message to be sent to the fish sprite, and consequently the fish disputes the user’s answer. The fish then responds that it crossed the road “to get to the other tide”, and moves off the screen. Once the fish finishes this move, the monkey sprite continues again to change its costume and claim “what a load of carp”.
Thank you to Daniel Hiranandani for this assignment. Revised by Jeremy Baumgartner, Spring 2014.

p(2)

Place your order now to enjoy great discounts on this or a similar topic.

People choose us because we provide:

Essays written from scratch, 100% original,

Delivery within deadlines,

Competitive prices and excellent quality,

24/7 customer support,

Priority on their privacy,

Unlimited free revisions upon request, and

Plagiarism free work,

 

Unlike most other websites we deliver what we promise;

  • Our Support Staff are online 24/7
  • Our Writers are available 24/7
  • Most Urgent order is delivered with 6 Hrs
  • 100% Original Assignment Plagiarism report can be sent to you upon request.

GET 15 % DISCOUNT TODAY use the discount code PAPER15 at the order form.

Type of paper Academic level Subject area
Number of pages Paper urgency Cost per page:
 Total: