๐Ÿ
[PY] Intro to Computational Media 2.0
CS4All Resources
  • Curriculum Overview
  • How to Use this Curriculum
  • ๐Ÿ“ฌLeave Us Feedback
  • Curriculum Extras
    • ๐Ÿ”ฎCurriculum Extras Overview
    • Imposter Syndrome (pt. 1)
      • Imposter Syndrome (pt. 2)
    • Timers in Processing.py
    • Time Functions: Crazy Clock Mini Project
    • Pathfinding Algorithms and Facial Scanning
    • Playing with Pixels
  • Unit 1: Draw & Draw With Functions
    • ๐Ÿ”ฎUnit 1 Overview
    • U1LA1.1: Processing.py Introduction & Deconstruction
    • U1LA1.2 Line Functions and Parameters
    • U1LA1.3: Rectangles, Ellipses, and Layering
    • U1LA1.4: Other Shapes & Styling
    • ๐Ÿ—ƒ๏ธU1LA1 Mini Project: Taijitu Symbol
    • U1LA2.1: Intro to Color with RGB and HSB
    • ๐Ÿค“EXTRA: Color & Data Storage
    • ๐Ÿค“EXTRA: Color Palette Practice
    • โœจU1LA3.1: Introducing Variables
    • โœจU1LA3.2: Creating Custom Variables
    • โœจU1LA4.1: What is Abstraction?
    • โœจU1LA4.2: Intro to Functions and Function Calls
    • U1LA4.3: Draw with Functions
    • U1LA4.4: Using the Random Function
    • ๐Ÿ—ƒ๏ธU1LA4 Mini Project: Custom Emoji
    • U1LA5.1: Your Custom Function Library
    • ๐ŸŽจUnit 1 Final Project: Abstract Album Art
  • Unit 2: Respond and Draw On Canvas
    • ๐Ÿ”ฎUnit 2 Overview
    • โœจU2LA1.1: Conditionals and If Statements
    • โœจU2LA1.2: Conditionals and if, elif, and else statements
    • โœจU2LA1.3: Logical Operators And/Or
    • ๐Ÿ—ƒ๏ธU2LA1 Mini Project: Make a Traffic Light
    • U2LA2.1: Draw with Mouse
    • U2LA2.2: The Map Function
    • โœจU2LA3.1: Data Type Scavenger Hunt
    • โœจU2LA3.2: Functions that Return Values
    • ๐Ÿค“U2LA3.3: Functions with Purpose
    • U2LA4.1: Collision Functions and Libraries
    • U2LA4.2: Mouse Clicks and Shapes as Buttons
    • ๐Ÿ—ƒ๏ธU2LA2 Mini Project: Light Switch Game
    • U2LA5.1: Key Presses and Nested Conditionals
    • ๐ŸŽจUnit 2 Final Project: Interactive Drawing App
  • Unit 3: Loops, Arrays, Media
    • ๐Ÿ”ฎUnit 3 Overview
    • U3LA1.1: While Loops
    • U3LA1.2: For Loops Pt. 1
    • U3LA1.3: Nested For Loops (For Loops Pt 2)
    • ๐Ÿ—ƒ๏ธU3LA1 Mini Project: Wallpaper Design
    • U3LA2.1: Introduction to Lists
    • U3LA2.2: Random Values from Lists
    • ๐Ÿ—ƒ๏ธU3LA2 Mini Project 1: Fortune Teller
    • U3LA2.3: Loops and Lists
    • U3LA2.4: Updating and Deleting from Lists
    • ๐Ÿ—ƒ๏ธ๐Ÿค“ U3LA2 Mini Project 2: CodeWars List Challenges
    • U3LA3.1: Loading Images
    • ๐Ÿ—ƒ๏ธU3LA3 Mini Project: Vision Board
    • ๐ŸŽจUnit 3 Final Project: Random Meme Generator
  • Unit 4: Motion, Objects, Transformation
    • ๐Ÿ”ฎUnit 4 Overview
    • U4LA1.1: Intro to Motion with Flipbooks
    • U4LA1.2: Move in All Directions and Make it Bounce
    • U4LA2.1: Introduction to Classes and Objects
    • U4LA2.2: Reading and Updating Object Properties
    • U4LA2.3: Methods Off Canvas
    • U4LA2.4: Objects on Canvas
    • ๐Ÿ—ƒ๏ธU4LA2 Mini Project: Build a Tamagotchi
    • U4LA3.1: Creating Many Objects
    • ๐Ÿค“๐Ÿ—ƒ Optional U4LA3 Mini Project: Rebuild with Objects
    • U4LA4.1: Translation Battleship
    • U4LA4.2: Rotations
    • ๐Ÿค“U4LA5.1: Sine and Oscillating Motion
    • ๐Ÿค“U4LA5.2: Cosine and Circular Motion
    • ๐ŸŽจUnit 4 Final Project: Animated Greeting Card or PSA
  • Unit 5: Final Project
    • ๐Ÿ”ฎUnit 5 Overview
    • ๐ŸŽจCourse Final Project Guide
Powered by GitBook
On this page
  • Overview && Teacher Feedback
  • Prompt
  • Suggested Duration
  • Sample Output
  • Extensions
  1. Unit 4: Motion, Objects, Transformation

U4LA2 Mini Project: Build a Tamagotchi

How can I use Classes/Objects on canvas to build a digital pet?

PreviousU4LA2.4: Objects on CanvasNextU4LA3.1: Creating Many Objects

Last updated 1 year ago

Overview && Teacher Feedback

Before students advance to making many objects on a canvas, we want them to practice making a Class that will generate a single object but have many properties and methods. Intro: the Tamagotchi!

The most basic version of this project does not requier anything extra, although some students may benefit from learning about modulos. If you'd like to up to the ante, consider teaching the lesson on timers before this project so that students can have needs decrease based on time.

Prompt

In this project, you'll be making your own computer-based version of the Tamagotchi! The end result will be a little character that moves around the screen, bouncing off edges, that you can interact with.

Requirements:

  1. Create a digital pet Class (named whatever you want) that has all properties and methods related to your virtual pet. You will be creating a single object instance of this pet.

  2. Design your digital pet - make a display() method so it displays on the screen.

  3. Create methods to move your pet around the screen and ensure it bounces on the edges or is otherwise unable to leave the screen.

  4. While moving, the pet should get hungrier every few 'steps' - the hunger property should change accordingly.

  5. When the pet bumps into an edge, the health should decrease.

  6. Adjust the display method so that the digital pet has a different look if it becomes too hungry or too unhealthy. (You can also make a ๐Ÿ˜ต version if both are true.)

  7. Create a method that will allow you to feed your pet by interacting via clicks or keys.

  8. Create a method that will allow you to heal your pet by interacting via clicks or keys.

Suggested Duration

~3 - 5 Periods. An easy way to shorten this project is to have students use images to make their pets rather than coding their own design - then the focus can be on the newer and more algorithmic skills.

Sample Output

Extensions

There are so many ways to extend this project:

  • Learn about and utilize modulos in your program

  • Give the Tamagotchi more properties that control different thins about it. (An easy one is age, and have the Tamagotchi 'grow up' over time.)

  • Give the project a very 90s look

  • Tamagotchi meet Pokรฉmon: think about attributes like HP, attack, defense, etc and make a pet that can train and battle

One of the biggest toy fads of the mid '90s to early '00s was the ( | ). As kids may need more context, consider this . This was a little virtual pet that lived on a small piece of hardware attached to the keychain. When users turned it on, the pet would begin as an egg, and using simple buttons you would care for it's needs (feeding it, playing with it, training it, etc) which changed in real time. Early versions did not have a pause button, making it very stressful to keep a Tamagotchi alive.

๐Ÿ—ƒ๏ธ
Tamagotchi
commercial 1
commercial 2
4 minute 90s rewind on digital pets
Sample Code
Tamagotchi
Tamagotchi gif with person feeding it a meal
Sample project with bouncing pet and buttons to feed and heal