Collecting Game

School Wide Learning Expectation:

Think critically and solve problems

Learning Objectives:

Understand and apply the programming concepts of events, parallel processing, and conditional processing based on Boolean operators.

Apply what was learned in prior lessons regarding collecting information from the person using your program, and giving feedback that varies depending on Boolean expressions and variable values.

Apply the computational thinking technique of decomposition to break the task up into separate manageable pieces.

Assignment Requirements:

Make a game where the goal is to collect items placed on the screen.

Display a score and some directions.

Ask the person using your program what their name is.  At the end of the game, give them feedback that includes their name, their score, and one of at least two possible appropriate messages (“great job”, “better luck next time”, etc.)

To collect items, steer a moving “collector” sprite until it touches an item and scores one point.

Set all sprites, backdrops, and variables to a consistent initial position, appearance, and value as appropriate.

Everything that can be named will have an appropriate and descriptive name.  Sprites, costumes, variables, broadcast messages, etc.

Handle the end of game by stopping the collector and summarizing the game results with a message including the player’s name, their score, and an appropriate message.

Your game must have a minimum of three objects to be collected (coins, flowers, treasure, food, etc.)

Use your imagination to set the scene and story.

A remix template is available to get you started, and there are two instructional videos to help if you get started:  moving the collector sprite and collecting items.

Things you need to be aware of:

Information such as a score is set in variables, defined under the Data blocks

“Initialization” is important:  set the initial score (and any other variables used such as a timer if you use one) and the position and appearance of all sprites.

The simplest way to implement the items to be collected is as separate sprites.  Once you have one sprite scripted, drag its script(s) onto other sprites to copy them.

To help you organize your efforts, this assignment is broken down into four parts that build on one another.

Part 1:  Design

Use your imagination to design a setting that meets the assignment’s requirements.  You could have a shopping cart collecting groceries, a space ship collecting asteroids, a dog collecting treats, a bee collecting pollen, etc.

How will you score your game?  Scoring based on the time to collect a fixed number of items is one approach.  You could also make items continue to appear over a set amount of time, and score the number of items collected before the time expires.

Design one sprite for your “collector” and at least three sprites to be collected.  Use the existing Scratch sprites or draw your own.

Part 2:  Moving the collector

Keep the motion control simple:  make the collector move constantly (forever, move 2 steps), and then let the player steer using the left and right arrow keys.

Alternate solutions using the mouse or other keys are OK.  Consider the impact your decision has on how fun your game is for the player:  if you just use a “go to mouse pointer” approach to moving the collector, it is a bit of a “whack-a-mole” design approach and you should make your collectable items more challenging to catch by moving them around or making them rapidly disappear and re-appear in different spots.

Start the game with the sprite in a consistent position.  Initialization of this sprite is also a fine place to put any game-wide initialization blocks such as setting the initial score.

All of this can be accomplished using the following blocks on your collector sprite:

  • Events: When green flag clicked, when ___ key pressed
  • Motion: go to x: __ y: __, turn clockwise __ degrees, turn counter-clockwise __ degrees, move __ steps
  • Data: Set variable to __
  • Control: Forever

Part 3:  Items

Productivity tip:  You can complete this assignment using multiple “item” sprites that each have identical scripts.  If this is your approach, get one item sprite’s scripts as close to 100% complete and tested as possible, then just drag the completed script(s) onto the other item sprites to copy.

Your item scripts need to make the item appear, detect if the item has been collected, and respond to being collected, including making any scoring changes and disappearing.  You can give your items random or consistent positions, but you know which option is more fun, right?

You may need to pause or “debounce” on collecting an item to be sure you only score and handle it as one event.  Scoring multiple hits for collecting one item will be considered a defect in your game.

This can be accomplished using the following blocks on your item sprite:

  • Events: When green flag clicked
  • Operators: pick random from __ to __
  • Motion: go to x: __ y: __
  • Looks: Show, Hide
  • Control: Forever, If, Wait __ secs
  • Sensing: touching ___?
  • Data: Change variable by __

Part 4:  User Experience Optimization

Set the stage with the backstory.  Give the player some motivation.  Help them identify with the collector.

Provide some directions on how to control the collector.

Display information such as the score and timer.

Acknowledge the end of the game and stop the collector.

Pick an appropriate backdrop.

Imbue your messages with some personality and humor as opposed to simple “GAME OVER” and other robotic two word phrases.

To convey your messages and instructions, you can make simple sprites that just have text in their costumes, or you can have your collector looks/say things.  Use the operators/join block to put variables and words together if you are using the say or think blocks.

To handle the end of the game, instead of just a move block inside the collector’s forever loop, you can put an if/else control block inside the collector’s forever block.  If the game is over: tell the player how the game ended; else: move.

Exceeding Expectations

All projects exceeding expectations demonstrate have a consistent theme in which each sprite and all text support the theme and rewards the user for engaging with your project.  Correct spelling, grammar, and providing instructions are expected of a project which exceeds expectations.  A project which exceeds expectations does not frustrate, confuse, punish, or insult the user but rather it is fun and a source of delight that encourages continued exploration and use.

Meeting the bare requirements makes for a pretty basic game.  To exceed expectations, implement two or more of the following:

Turbo mode:  periodically (not always!) let the player press a key (“T”) to engage TURBO MODE!  Make the collector move more quickly while turbo mode is engaged.

Minefield:  Place some unfriendly items on the stage.  Their appearance should scream DANGER! and colliding with one ends the game.

Animations:  As they are collected, make the items go through spectacular animations before disappearing.  Add start of game and end of game animations for the collector sprite.

Sound:  Spice it up with some sound.  Add music to play during the game and sound effects when each item is collected.  Play a special song at the end.

Increasing Difficulty:  Increase the game difficulty as time progresses.  Not too frustrating, but enough that getting a high score is a challenge.

Your Great Idea:  Dream up a neat spin on the project and get it approved.