Your name is required for this document. It is only stored on this local computer and no where else. Please enter your name below:

Extension TaskCoin Collector

Knox badge
Extension TaskCoin Collector

In this game you will be building a coin collecting game. Follow the steps in the tasks to complete it.

Finished product

You can see a preview of the finished game below:

Rename and resize the cat

Your first task is to rename the initial sprite to Cat and then resize the cat. 30 seems like a good size for the cat.

Add controls for the cat

Next we need to add controls for the cat. We are going to do this in a different way to what we normally would do and use the code shown to do this.

This works differently from the when right arrow pressed as the user can hold the key down and the cat will continue to move.

You will need to add in the remainder of the movement blocks to ensure that the cat moves in each direction as each key is pressed.

Try out what you have just created.

Creating the coin sprite

Next you will need to paint a new sprite that will be used as the collectible coins.

First select the Paint option in the sprite menu. When you click on it will bring up the Scratch sprite editor. You will need to use the circle tool and the text tool to draw a sprite similar to the one shown.

Setting up variables

To setup the points and lives systems we will need to use variables. A variable is like a container and has a name as well as a value. It stores information that can change whilst the computer program is running.

To do this, first open the Variables tab on the left and then find the Add Variable button as shown.

You will only need two variables in this program. You will need one for the lives and the other for the points the player has. When naming your variables, name them appropraitely.

Code for the coin

You will need to add code to the coin so that when the cat picks it up the coin adds a point and disappears. This code will also play a sound when the coin is picked up.

Before adding the code, start by adding the sound. First select the coin sprite and then clicking on the Sounds tab at the top.

When in there, select the Choose a Sound option (pictured) and find the sound called Coin.

Next add the following blocks to the coin.

These blocks will place the coin at a random point on the screen in the game, as well as increase points when the player touches it.

When the player touches the coin the coin jumps to a random location on screen.

Resize and duplicate the coin

At present, the coin is very large. Resize the coin to 20.

Rename the coin to Coin1.

Next we will need to duplicate the coin. Do this 9 times so that you have 10 coins. Your game should look something like the following image.

Try out what you have just created. Check that the coins move when they are collected and that they appear in random locations.

Add in the opponent

Next you will need to add in an opponent player. This player should constantly move towards the player.

First, add in a sprite for the bad guy. In this example, the Dragon sprite has been used.

After creating the sprite, add the following blocks:

This code will ensure that the dragon follows the cat, and if the cat touches the dragon touches the cat it takes away a life and broadcasts a message.

Broadcasting a message isn't visible to the player, it just allows sprites to interact with each other.

The following code should be added to the cat to send the cat away from the dragon after touching it.

Victory conditions

Now we need to add in victory conditions for the cat.

Since it's easy to get to 20 or 30 points, it might be better to aim for 100 points to win. Add the following code in the cat.

Try out what you have just created.
S1 Scratch Lessons
S1 Scratch Extension Tasks
S1 Scratch Assessment
Provide Feedback

What did you think of this lesson?

-- DragonDocs version 0.9 --


Started on DragonDocs
Created a YASS/PHP and HTML-based system for saving and retrieving data

Added CSS styles to page
Added JavaScript code to the page

Added the multipage option (used in my dissertation)
Added the XMLHttpRequest-based multipage requests

Added the Accessibility features
Filters added

Purple filter added

Added the Note class
Added the Did You Know class

-- DragonDocs version 1.0 (Yosemite) --

First trial of DragonDocs in teaching

Added the Task, Starter, Review your learning sections

Added the feedback feature
Added the Dark Mode toggle

Performance gains through the removal of unnecessary code
Added the Learning Intentions and Success Criteria features
Added the school badge

Changed the headings (h2) to be more consistent with my website
Added sections to the pages - sections must be preceded by a h2
Added the "I have read this section" buttons
Changed the main heading zone to gradient text like my website
Added the table of contents feature

Added the Print feature
Updated the footer to feature a new gradient
Added the Test It! class
Added the green flag
Automated the table of contents using JavaScript

Added the 'includes' feature to the document, allowing inclusion of other files easily
Removed the requirement that the IP address must be one of the schools I have taught at, opening these documents to the public

Once a section has been read or completed, the user can now hide that section

Added the Extension task class
Changed the scrollbar on Windows to match that of macOS

-- DragonDocs version 2.0 (Kilimanjaro) --

Added the Save button and the ability to save 'results' or answers to a Word document

Added the large numbers class
Removed the background of the page navigation

-- DragonDocs version 2.1 (Aurora) --

Added the active class to active links in the bottom section

Added the image upload feature

Added a fix that prevents the upload of non-image files into an image upload
Added pasting images to the upload feature

Added the ability to view the changelog from a document
Improved the feedback system by recording the DragonDocs User ID and the Document ID data
The feedback from DragonDocs can be accessed much easier

Added the new step_by_step_mode feature, allowing sections to be viewed individually
Added the ability to lock and unlock DragonDocs

Added new checkboxes to each list item in a .task or .step
Added functionality to said checkboxes to add a strikeout to steps completed

Added the new 'step' class
Steps are now auto incremented in CSS so the name displays the step number
Activities are now also auto incremented to display the activity number

Added the 'matcher' feature to DragonDocs
Fixed an issue in which a closed section would retain it's original height within the document navigation
Added starters and the lesson review to the navigation on the side
The learning intentions and success criteria in teaching documents have now been redesigned to match my slides design

All buttons are now on the right hand side
The accessibility button now has WAI under it

-- DragonDocs version 2.2 (Serengeti) --

Code has been rewritten from the ground up to be object-oriented, making additional features easier to add

Changed the look of grouped multiple choice buttons

Added the new dragondocs_name feature and the requires_name property which allows names to be prepended to saved documents

Added code so when the user types in their name and hits the enter key it will save that data and close the modal window
Added the new DragonShow and DragonDocs Link - a connection between both services that allows the presenter to communicate with users of DragonDocs from a DragonShow
Added the new timer option which is sent from DragonShows

The matcher feature is no longer embed from but actually a feature of DragonDocs
Made DragonDocs 100% object-oriented, meaning much better management and better performance

Made subtle changes to the interface to tidy it up a bit

The multiple choice questions are now also part of the object oriented interface

As requested, h3 elements are now included in the 'floating navigation'
The active navigation element now becomes bold and the left border has been retired

Time left