6.4 Animation Cycles Day 2. wip

Students use make-a-block to create two "animation cycle" blocks: Jump and Spin. Students create an animation using these new blocks.

OBJECTIVES:

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

    • identify reasons to use a procedure:

    • easier to read; reusable, more outcomes.

    • observe flow of control: that calling a procedure block will execute code within that procedure block, before returning to next command.

TEACHER RESOURCES:

Standards

    • CSTA 2-AP-14: Create procedures with parameters to organize code and make it easier to reuse

    • CSTA 2-AP-16: Incorporate existing code, media, and libraries into original programs, and give attribution.

CSTA

DO NOW:

    1. Watch Ups and Downs of Digital Life (4:07)

    2. Discuss:

      • Name two ups and two downs in a digital life?

      • Have you experienced the pros and cons of a digital life?

Mini-Lesson (5-10 minutes)

Mini-Lesson (10-20 minutes)

Students continue working on their animation using blocks they have created.

Question: Why make your own blocks? Video: Why make your own block?

                  • It keeps code simple, so it is easier to read.

                  • It keeps reuses code, so less code is needed.

                  • Making a block with Parameters will increase the number of outcomes you get from the block.

Students will then use these blocks and others, to create an animation.

Allow time for reflection.

Reflection 1. Trace the flow of a procedure through sequential code. student handout.

Reflection 2. Animation cycles in games. See below.

TEACHER GUIDANCE: Make-a-Block is known in other languages as a Procedure or Routine.

Make-a-Block does not return information, so it is not a Function.

Project (20-30 minutes)

TEACHER GUIDANCE:

In scratch, Procedures do not return values: This means that arguments passed to a procedure block are never changed within that block.

Vocabulary: Arguments: values passed into a procedure call: "10". Parameters are variables defined in the procedure that receive them: "Height".


Close-Out (5 minutes)

Question 1: Why would an animator want to use an animation cycle?

    • It saves time. Creating realistic animation takes a long time. Using a reusable block, will save a lot of time.

    • A reusable block, means that a characters' unique traits can consistently be propagated across all scenes. (e.g a characters' style of walking).

Question 2: Why do games with real-time user input, need animation cycles?

Short answer: Animation cycles create efficient code, which allow the game engine to response fast.

Long Answer: Animation in games happens in real-time and need immediate responses.

  • When the gamer uses the game controller to turn left, the character on screen has turn left immediately.

  • When the gamer inputs a jump high, the animated sprite needs jump to that height. ( parameter input)

  • When the gamer inputs a speed, the animation needs to change to that speed. ( parameter input)

Animation in games needs to be

          • modular - small chunks of code (animation cycles) that can immediately be called when the gamer activates an action.

          • efficient for the game engine - less lines of code in memory

          • flexible - an animation cycle that can be stretched out over distance and time, or pulled in. (using parameters within a block).


Make-a-Block in scratch, (also know as a procedure), allows us to

      • reuse chunks of code.

      • creates efficiency by keeping code short, modular and flexible.

      • It allows for many outcomes. (if using a parameter). -This is the beauty and power of a procedure, that it can be customizable. e.g. Jump( height ), Spin( number of times ), Speak( sentence ).