Computer Science6-8
The Draw Loop and Variable Updates for Animation
By Andrea M.
A practice worksheet for 7th graders introducing the draw loop in block-based Java (Game Lab) and how updating variables inside it makes sprites animate. It builds understanding of loops, variables, and the idea that animation is a rapid series of still frames, with key-term definitions and worked examples to anchor each concept.
Customize for your classroom
Teacher Guide & Tips
- Use this as a 45-minute computer science lesson, pairing students at computers so they can test each code change in Game Lab and watch the sprite respond.
- Discussion question: Why does `x = 0` belong outside the draw loop while `x = x + 1` belongs inside it, and what would happen if you swapped them?
- Scaffold for struggling readers: Have them trace the first two or three frames on paper, writing the value of x after each pass through the loop before running the code.
- Extension for advanced students: Ask them to make a sprite move in two directions at once using separate variables for x and y, then to make it bounce off the edges of the canvas.
- Estimated time: about 45 minutes for the reading and guided practice, plus 15 minutes for the extension activities.
Computer Science6-8
The Draw Loop and Variable Updates for Animation
By Andrea M.
A practice worksheet for 7th graders introducing the draw loop in block-based Java (Game Lab) and how updating variables inside it makes sprites animate. It builds understanding of loops, variables, and the idea that animation is a rapid series of still frames, with key-term definitions and worked examples to anchor each concept.
Customize for your classroom
Teacher Guide & Tips
- Use this as a 45-minute computer science lesson, pairing students at computers so they can test each code change in Game Lab and watch the sprite respond.
- Discussion question: Why does `x = 0` belong outside the draw loop while `x = x + 1` belongs inside it, and what would happen if you swapped them?
- Scaffold for struggling readers: Have them trace the first two or three frames on paper, writing the value of x after each pass through the loop before running the code.
- Extension for advanced students: Ask them to make a sprite move in two directions at once using separate variables for x and y, then to make it bounce off the edges of the canvas.
- Estimated time: about 45 minutes for the reading and guided practice, plus 15 minutes for the extension activities.