Scratch programming – 2 players

$5.00

Theme

The “Cat and Mouse” game is a 2-player project where one player controls the cat while the other controls the mouse, each using a separate set of keys on the keyboard. The objective is for the mouse to eat muffins while the cat attempts to catch the mouse to score points.

Content

  • Control – Forever and If: Using “forever” for continuous actions and “if” for conditionals.
  • Sensing – Key … Pressed and Touching: Detecting keyboard input and sprite collision.
  • Duplicate Command Blocks: Duplicating blocks for efficiency.
Category:

Description

Theme

The “Cat and Mouse” game is a 2-player project where one player controls the cat while the other controls the mouse, each using a separate set of keys on the keyboard. The objective is for the mouse to eat muffins while the cat attempts to catch the mouse to score points.

Content

  • Control – Forever and If: Using “forever” for continuous actions and “if” for conditionals.
  • Sensing – Key … Pressed and Touching: Detecting keyboard input and sprite collision.
  • Duplicate Command Blocks: Duplicating blocks for efficiency.

 

Module 12: Multiplayer Games

Lesson 29: 2-Player Cat and Mouse Game

Objective: Teach students how to create a 2-player “Cat and Mouse” game using control and sensing blocks in Scratch.

Introduction:

  • Introduce the “Cat and Mouse” game concept: Two players control a cat and a mouse separately to compete for scores.

Content:

1. Control – Forever and If:

  • Recap the “forever” block and its use in continuous actions.
  • Discuss the “if” block for conditional statements.

2. Sensing – Key … Pressed and Touching:

  • Review using the “key … pressed” block for keyboard input.
  • Introduce the “touching” block for collision detection.

3. Duplicate Command Blocks:

  • Teach the importance of duplicating command blocks.
  • Explain how duplicating blocks saves time and effort.

Scratch Commands Covered:

  • Control – Forever and If: Using “forever” for continuous actions and “if” for conditionals.
  • Sensing – Key … Pressed and Touching: Detecting keyboard input and sprite collision.
  • Duplicate Command Blocks: Duplicating blocks for efficiency.

Activities:

1. Introduction to Game:

  • Present the “Cat and Mouse” game concept and the roles of the cat and mouse players.
  • Explain that the mouse collects muffins, while the cat chases the mouse.

2. Cat and Mouse Sprites:

  • Introduce the cat and mouse sprites.
  • Explain that each player will control one sprite.

3. Keyboard Controls Setup:

  • Teach how to use the “key … pressed” block for keyboard controls.
  • Program the cat and mouse to move based on different keys.

4. Muffin Collection and Score:

  • Set up muffin sprites as collectibles.
  • Use the “touching” block to detect muffin collection and update scores.

5. Chasing and Avoidance:

  • Teach how to use the “if” block to make the cat chase the mouse.
  • Program the mouse to avoid the cat.

6. Duplicate Blocks for Efficiency:

  • Explain the concept of duplicating blocks.
  • Show how to duplicate and adjust command blocks for both players.

7. Win and Lose Conditions:

  • Define win conditions for both players.
  • Display win or lose messages based on the final scores.

Conclusion:

  • Recap the concepts learned: control blocks, sensing blocks, and duplicating blocks.
  • Emphasize the dynamic of two players controlling separate sprites.
  • Discuss the collaborative and competitive nature of the game.

Assessment:

  • Assess understanding through questions during the lesson.
  • Evaluate student projects based on the functioning 2-player Cat and Mouse game.
  • Have students demonstrate their games and explain how they applied the concepts covered.

Encourage students to customize the game with their own graphics and variations to make the Cat and Mouse game unique and engaging.