5.7 Flappy Cat Day2

This is a visual illusion. The Cat stays in place and the backgrounds move!

OBJECTIVES:



OBJECTIVES: By the end of this lesson, students will:

    • define and decrement a variable

    • comprehend that the stop command, will stop a forever loop.

    • identify the hero attribute jump and brainstorm other potential powers our hero could have.

TEACHER RESOURCES:

Standards

    • CSTA 2-AP-11: Create clearly named variables that represent different data types and perform operations on their values.

    • CSTA 2-AP-12: Design and iteratively develop programs that combine control structures, including nested loops and compound conditionals.

CSTA

DO NOW:

Do Now Careers in Tech (5 minutes)

Students watch the video Made with Code: Ayah Bdeir, (2:06) then dicuss:

    • Ayah says "Everyone wants to play, invent, create. Coding lets you do this".

    • Do you agree?

    • Ayah is an engineer and an artist. Two fields we normally see as separate. How does Ayah see the future in 20 years?

Teacher Guidance

  • Ayah sees the future as a place where you can be a engineer and an artist, a world where everyone is designing their own life, electronics, cloths and career paths.

Mini-Lesson (5-10 minutes)

Mini-Lesson (5-10 minutes)

Recap that the background moves and the cat stays in the same location. Visual Illusion - smoke and mirrors.

Today students have a couple of design decisions.

  1. How should you design code to continually pull the hero downwards due to gravity , and jumps upwards when the user presses spacebar.

  2. What will happen when the hero bangs into a building:

  • Should they use a variable to store health or lives?

  • Should they use a color effect, such as ghost on their hero sprite as he loses health?

See teacher cheatsheet:

A. Add a flying hero.


Add gravity to hero:

Press Spacebar to make hero jump:

B. Explain stop all and it variations.

Stop all will stop all sprites. Stop this script will stop only this thread.

C. Add a variable called "lives".


If hero bangs into a wall,

  • make a sound,

  • decrease lives,

  • change look (health).

Project (20-30 minutes)

Today students will continue with their flappy cat game.

  • In pairs, using page 2 of student handout,
    students spend 5 minutes strategizing over how to design a flying hero that gravity pulls downwards, unless you press spacebar.
    what will happen when the hero bangs into a building?

  • Students continue working on their project.

Close-Out (5 minutes)

Close-Out (5 minutes)

Discuss the following questions:

    1. How do you stop a forever loop?

    2. What power does your hero cat have? What extra powers could it have?

    3. What condition are you testing for the hero cat?

    4. For variable "Lives", what does increment mean? What would decrement mean?

Potential Responses

  1. Press the red stop button. Use the command "Stop"

  2. Jump power. Speed, armor, etc.

  3. If he bangs into buildings

  4. Add to health. Subtract from Health.