Witty.ca - Mr. Rich's Professional Archives

  • Home
    • Lunch
    • Support
    • Intro
    • Cyber
  • Courses
    • Course Listing & Updates
    • DMS 2022-2023 >
      • Tech and Design Grade 6
      • Tech and Design Grade 7
      • Tech and Design Grade 8
    • -----------------------
    • DMS Archive 2021-2022 >
      • Tech and Design Grade 6 2021-22
      • Tech and Design Grade 7 2021-22
      • Tech and Design Grade 8 2021-22
    • HCS Archive 2015-2016 >
      • HCS'15 Media Studies 120
      • HCS'15 Nutrition for Healthy Living 120
      • HCS'15 Visual Art 9
      • HCS'16 Intro to Electronics 110 >
        • Purchasing a Computer in 2016 >
          • HCS'15 Visual Art 110/120
      • HCS'16 Housing & Design 120
      • HCS'16 Visual Arts 10
      • HCS Winter Decoration Ideas
    • HCS Archive 2014-2015 >
      • HCS'15 - Digital Production 12
      • HCS'15 - Graphic Art & Design 11
      • HCS'15 - Media Studies 12
      • HCS'15 - Visual Art 10
      • HCS'14 - BBT 10
      • HCS'14 - Info Tech 11/12
      • HCS'14 - Visual Art 9
      • HCS'14 - Visual Art 11/12
      • HCS Art Club
      • HCS Announcement Text
    • HCS Archive 2013-2014 >
      • HCS'14 - English 12
      • HCS'14 - Graphic Design 11
      • HCS'14 - Individual & Family Dynamics 12
      • HCS'14 - Info Tech 12
      • HCS'14 - Social Studies 8
    • Student Introduction Form
  • Tech Units
    • Safety & Citizenship >
      • Work Place Safety
      • Digital Safety & Citizenship
      • Digital Communication
      • Digital Rights & Responsibilities
      • Digital Etiquette
      • Digital Wellness
      • Digital Business
      • Digital Access
      • Digital Literacy
      • Digital Law
    • Scratch Coding >
      • Scratch Explained
      • Scratch 3 - Crossy Road 1
      • Scratch 3 - Crossy Road 2
      • Scratch 3 - Teacher Notes
      • OLD - Scratch 2 (Coding) >
        • Scratch 2 - Introduction to Coding
        • Scratch 2 - How to
        • Scratch 2 - Introduction
        • Scratch 2 - Frogger (p1)
        • Scratch 2 - Frogger (p2)
        • Scratch 2 - Frogger (p3)
        • Scratch 2 - Frogger (p4)
        • Scratch 2 - Frogger (p5)
        • Scratch 2 (Coding) >
          • Scratch 2 - A 2nd Project
          • Scratch 2 - Teacher Notes
          • Scratch 2 - Choosing another language
      • OLD - Scratch 1 (Coding) >
        • Scratch 1 (Coding)
        • Scratch (Scripts 1 & 2)
        • Scratch (Script 3)
        • Scratch (Frogger)
        • Scratch (Frogger 2)
        • Scratch (Frogger 3)
        • Scratch (Frogger 4)
        • Scratch Mini-Challenge 1
        • Scratch Final Project
        • Notes for Teachers >
          • Teaching Scratch
    • Graphic Design with Inkscape >
      • Graphic Design Overview
      • Inkscape Act.1
      • Inkscape Act.2
      • Inkscape Act.3
      • Inkscape Act.4
      • Inkscape Act.5
      • Inkscape Act.6
      • Inkscape Bonus Challenge
    • Photoshop with The GIMP >
      • GIMP Overview
      • GIMP Install & Setup
      • GIMP Activity 0
      • GIMP Activity 1
      • GIMP Activity 3
      • GIMP Activity 4a
      • GIMP Activity 4b
      • GIMP Activity 6b
      • GIMP Activity 6e/f
      • GIMP Final Project - Cereal-Box
      • GIMP Final Project - Magazine Cover >
        • HCS'16 Graphic Art & Design 110
      • GIMP Bonus Assignment
      • GIMP Marking Breakdown
      • Raster Graphics Explained
      • Old GIMP Activities >
        • GIMP Activity 2
        • GIMP Activity 6a
        • GIMP Activity 6c
        • GIMP Activity 6d
    • Excel
    • Audio / Video >
      • Sound (Audacity)
      • Video (One Minute PSA)
      • Make a Movie Trailer
      • Blender Video Editor - Test
    • Automotive >
      • Auto - Careers
      • Auto - Engines
      • Auto - 4-Stroke vs 2-Stroke
    • Coding - Teacher Start
    • Python (Coding) >
      • Python - CS 110 PD - July 2016
      • Python - CS 110 PD Part 2 (Projects)
      • Python - CS 110 PD Part 3 (GUI)
      • Install Python 3.5 + PyGame
    • Design (AutoCAD) >
      • Design Act. 1
      • Design Act. 2
      • Design Act. 3
      • Design Act. 4
      • Design Act. 5
      • Design Act. 5b and 5c
      • Design Act. 6
      • Design Act. 7
      • Design Act. 8
      • Design Act. 9
      • Design Act. 10
      • Design Act. 11
      • Design Act. 12
    • Design (Sketchup) >
      • Sketchup House Setup
    • Portable Apps >
      • Cam Studio
      • Virtual Dub
      • Scratch (and Zip File for Students)
      • TuxPaint (and Zip File for Students)
      • TuxTyping (and Zip File for Students)
      • Google Chrome
    • Project Management >
      • Intro to Project Mgmt.
      • Assignment for Project Management
    • Database >
      • Tasks Database
    • Final Projects and Exam Review >
      • Final Project - BBT 10 - 2015
      • Final Project - Digital Production 2015
      • Final Project - Media Studies 2015
      • Exam Review 2013
    • Cybersecurity
  • Art Units
    • Elements and Principles >
      • Elements of Art
      • Principles of Design
    • Photographic Composition
    • Visual Art 9
    • Graphic Art & Design 110 >
      • Colour Theory
      • Layout
      • Fonts and Type
    • Visual Art 110
    • Previous Box Projects - Visual Art 10
  • Other Units
    • Housing >
      • How to Design a House
    • Media Studies >
      • Media Studies Handouts
      • What is media? Why study media?
      • Film, Television and Video
      • Advertising, Marketing and You
      • Media and the Internet
      • Self-Study Project
    • Nutrition >
      • Recipes >
        • Black Bean Cake and Cupcake
  • Sports
    • Volleyball >
      • NMS Volleyball 2019
      • Volleyball Contact
      • (Old) Volleyball 2017
      • (Old) Volleyball Spring 2016
      • (Old) 2016 Tournament - MS Boys Volleyball
      • (Old) Volleyball Spring 2015
      • (Old) 2015 Tournament - MS Boys Volleyball
    • Soccer >
      • (Old) Soccer Fall 2015
    • Basketball
  • Blogs
    • Computer Science Blog
    • Personal Blog
  • Contact
  • About
    • About Mr. Rich
    • About Technology and Computer Science
  • Archives
    • Teaching Software >
      • Purchasing a Computer (notes) >
        • Purchasing a Computer
        • Computer Scenarios
        • Computer Presentation
        • PAC Test Instructions
        • PAC Peer Review
        • How to Submit Computer Comparisons
        • How to Submit Computer for Helen
      • Scratch 2 (Coding)
      • Scratch 1.4 (Programming)
      • ARCHIVED - GIMP (Raster Graphics)
      • ARCHIVED - Inkscape (Vector Graphics)
      • AutoCAD (2D Design)
      • Sketchup (3D Design) >
        • Google Sketchup (2011)
        • Google Sketchup (2012)
      • Excel vs Calc (Spreadsheet)
      • Cam Studio (Screen Capture Videos)
      • TuxPaint (for young kids)
      • TuxTyping (Typing Tutor)
    • Links >
      • Career Links in Fredericton
      • Job Hunting Tips
    • Presentations >
      • Scratch Workshop Oct 11, 2013
      • Scratch Workshop Sept 18, 2013
      • Math for French Immersion
    • Software That Is No More >
      • Setup (for an older version of Weebly) >
        • Setup - Day 1
        • How To Setup Your Weebly Pages
        • Marks (link to Canvas)
        • Web Portfolio
    • Previous Teaching >
      • Old Teacher's Logs >
        • Teacher's Log 2015-2016
        • Teacher's Log 2014-2015
        • Teaching Notes - Hartland 2014
        • BBT9 Teacher's Log (Apr-June2013)
        • BBT9 Teacher's Log (Jan - Apr 2013)
        • BBT9 2012
      • Sept2010-Jan2012 >
        • Old Home
        • Middle School >
          • Literacy
          • Social Studies 6
          • Social Studies 7 >
            • Online Test - Canada at Confederation
      • Jan2012-Nov2012 >
        • Book Blog >
          • Blog to Book
        • About Mr Rich
    • PD Sessions >
      • BBT9-10 Oct6 2016
      • BBT Teachers PD (Jan 2013)
      • Cyber-bullying (May 2013)

Crossy Road - Page 1
    Let's make a Game with Scratch

We will be making a simplified version of Crossy Road.  The game was originally marketed as Frogger but my students now know the game as "Crossy Road". 

Never heard of the Frogger video game?  Here's the history on wikipedia or on Konami, the original game developer, or learn visit the official site for the Frogger game on Konami. 

If you complete this game, you can post it on scratch.mit.edu and please let me know!

Picture
Picture
Scratch Cat (from http://nagelelo.wikispaces.com)

Getting used to Scratch

If you haven't used Scratch before, then check out:
  • Introduction to Coding
  • How to use Scratch
  • Introduction to Scratch (with exercises)
If you use these tutorials, please let me know.

About Scratch

Scratch is an entry-level  free and open source software programming environment developed by MIT.

Let's Make a Video Game!

Picture
In this unit of study, we'll be building our own Frogger-style video game.

In this unit, we'll cover:
  • positive & negative numbers
  • X and Y coordinates
  • loops and conditions
  • variables and "broadcasts"
  • object-oriented programming
  • input devices (keyboard)
  • event sequences
  • ... and more




    

What you will need:

  • Scratch installed on your computer.
  • Have completed some Scratch tutorials
    (Previous Scripts 1,2&3 will do.)
  • A sense of adventure!

Replace the Cat with a Frog and ​edit its Costume - Vid1

  1. Let's delete the Cat sprite.
  2. Let's create a new sprite to be our hero.  I've chosen a Frog but you can choose any object you wish.
  3. Let's edit the new sprite's Costume so it's just what you want.
​
Click here to view the full playlist on YouTube
Click here to view the full playlist on YouTube

About Costumes and Graphics in Scratch

Scratch has 2 very different graphics editors for drawing and editing sprites:

Vector Toolbar (Edit by objects)
This is very different so if you are not used to vectors, try the Inkscape lessons by Mr. Rich.

Mr. Rich recommends using these cartoon drawings that are called "Vector Graphics".  They are easier to edit and recolour.  Also, do NOT use the eraser.  Instead select the part and then click the "Delete" or "Backspace" keys on your keyboard.  (This is how Mr. Rich deleted the frog's tongue in the first video.)
Picture
Bitmap Toolbar (Edit by pixels)
The other graphics editor uses photographs or pixel graphics that look like photographs and are edited using "Raster Graphics".
Picture

DEFINITION of "SPRITE"

A Sprite is an object in Scratch.  You can add pre-made sprites or draw one yourself!
​
Each Sprite has 3 tabs:
- Code: This is where you drag-and-drop the code for your scripts.
Picture
- Costume: This is where you draw and edit your object.  You can have many costumes!
- Sound: This is where you add sounds that you want to use with this Sprite.

WARNING about SPRITES !!!

The code that you create is attached to whatever specific sprite you are using when you create the code.  Therefore, IF YOU DELETE a Sprite, then all of that code is also deleted.  You've been warned!

​Get the Frog moving - Vid2

We are going to build our Frogger video game will only accept input from the arrow keys on the keyboard. 

So, after we remove the cat and get a frog (or other animal), then what?

First, get the right blocks:
    if 
          a key is pressed
    then 
          change the frog's location

And those pieces look like this:
Picture
Click here to view the full playlist on YouTube
Click here to view the full playlist on YouTube
Now, you have the building blocks,
so change the settings that:
    if
          the up arrow key is pressed
    then 
          move the frog up by 3
Can you create this code on your own?  
(See solution images posted to the right.)
SOLUTION #1
Picture
Click image to see solution
​with speed of 3.
​

SOLUTION #2
Picture
Click image to see solution
​with speed of 10.

Common Problem

Picture
"I clicked the green flag and then nothing happened!"

Answer:  Did you press the arrow key on your keyboard?  

Remember:  Your script is waiting for you to press an arrow key (Up, Down, Right or Left).


Picture

​Make all 4 Arrow Keys Work - Vid3

Here's a video showing how to get the solution.
Here's a video showing how to get the solution.

Edit the STAGE to make Start and Finish - Vid4

To create start and finish areas, let's click on the STAGE and then edit the BACKDROP (Costume). 
​
Start is usually at the bottom and Finish is usually at the top.

Also, you will want to create a road across screen, so vehicles can be moving to create obstacles for the frog.

Here's what your highway backdrop could look something like when finished:
Finished Highway
A finished Highway
Click for larger image
Click here to view the full playlist on YouTube
Click here to view the full playlist on YouTube

Frog Starts at Start-Vid5

At the beginning of each game, the frog should be at the START position.

And since that won't happen automatically, we have to code it!

You'll need to use a GLIDE code block.  Here's a sample, but where should it be added?
Picture
Click here to view the full playlist on YouTube
Click here to view the full playlist on YouTube

Create a Moving Car (But it won't kill the frog just yet) - Vid6

To make a car move, we use the same basic structure as when we wanted the cat to bounce around inside the fence.

However, in this case, we have highway lanes that are perfectly horizontal.  So, to make sure that the cars stay in their lanes, instead of  "moving 10 steps", we're going to just "change x by 10".

Trust me, this will keep everything nice and orderly!


NEAT TRICK:
Rather than making hundreds of cars, we're going to re-use our car so that (for now) only one car travels in each lane.

To do this, we're going to make our car drive across the video game screen, and then "teleport" back to the beginning of the lane.

Watch this video to get the idea.

When you're done, you should have a car object in your list of sprites, like this:
Picture
Click here to view the full playlist on YouTube
Click here to view the full playlist on YouTube
And in your car object, you should have code like one of these.  
You will need to change your X values to match your code.
(Mine is -202 for both Start and Respawn in the image below.)
​I recommend moving your vehicle so the back bumper is almost touching the edge, and then using whatever X values are there.
Picture
Basic Car Code -- Click for larger image.

ADVANCED CAR CODE
If you want, this advanced car code will make your car will appear mostly off the screen and then drive mostly off the screen.

You will need to adjust your X numbers to match your vehicle.  These X values match my Green Convertible set to Size=50.

This code solves the problem of your car touching the edge when it respawns (and then gets stuck and won't go anywhere).
Picture
Advanced Car Code - Click for Larger Image

Common Problem

Picture
Adding a second car is not as easy as it sounds.
If you want to try it now, go ahead!
​We will teach you that later on.


​Part 1 - Set the Car to Kill the Frog - Vid7

Sadly, in a video game called "Frogger", the whole point is to see how long the frog lasts before it dies.

In this video, we set the car to send a message ("FrogIsAlive") to the frog. We use a Data Variable, and a code blocks that look like this.  But where do they go?
Picture
We want this code above to go into every killer vehicle (or whatever you have that will kill the frog).

So now your killer vehicle code should look something like this.

WARNING:  The Frog doesn't actually die ... yet

So we have created the code for the killer car to set a variable that the frog is dead.  However, the frog doesn't know it yet.  So, in the next video, we have to get the frog to listen to the FrogIsAlive variable to see if the frog is alive or not.

WARNING:  The Frog doesn't come back to life ... yet

So far, we only have the frog die when it touches a car.  
Click here to view the full playlist on YouTube
Click here to view the full playlist on YouTube
Picture
Click for larger image

Part 2 - Kill the Frog! - Vid8

WARNING!  Your Frog will die and NOT come back to life. 
(That's in the next video.)

When the Killer Car sends a message to the Frog ("FrogIsAlive" =0), then the Frog must die!

Remember, nothing will happen unless we code it. What should happen when the frog dies?

Oh, and should the frog come back to life so the game can continue?  Then we'll need to code that too.
​
Click here to view the full playlist on YouTube
Click here to view the full playlist on YouTube
So, here's a list of all the things that need to happen so the frog can die and come back to life again.

In the Car:
  • Sense the Frog and then set
    ​FrogIsAlive variable to 0 (zero)​
​
Picture
Code for the Car. -- Click for larger image
In the Frog:
  • Check if FrogIsAlive variable is now 0 (zero)
  • Later we will add that the Frog makes dying sound (may need to use the Sounds tab to add sounds)
​
In our next video, we will find all the things that are going wrong and fix them.  This is definitely not done.
​
Picture
Code for the Frog. It's wrong but an important first step. -- Click for larger image.

Part 3 - Bring the Frog back to LIFE! - Vid9

Let's bring the Frog back to life.  We need to do this in the code for the Frog.

First, let's have some fun and add a sound effect for when the Frog dies.  And this is how we discover our first problem: the frog is dead but still somehow alive and keeps gliding back to the start and the sound effect keeps playing.
​
Click here to view the full playlist on YouTube
Click here to view the full playlist on YouTube
To fix this, we need an "IF ELSE" code block AND we need the IF part to check if the Frog is dead and the ELSE part to have all the keyboard arrow movement code. 
​
In the Frog:
  • Receive the message by checking the FrogIsAlive variable is 0 (zero)
  • Then Frog stops moving as the arrow keys should NOT work anymore (use the else)
  • Frog goes back to start (use a glide code block)
  • Frog comes back to life (FrogIsAlive set to 1)

Options:
  • Frog can say something like "Ahhhhhhh"(Looks palette)
  • Frog can change to a "dead" costume (also Looks palette)
Picture
Better code but still not done. -- Click for larger image




Next:  Crossy Road - Page 2
Up:     Return to Scratch 3 (Coding)


Copyright © Graham Rich 2010-2023.   Site made using Weebly.com.