CSCI 210 Homework 3.RAR

CSCI 210 Homework 3

This assignment focuses on:● Programming in Python● Using Pygame● Understanding event-handling in Pygame● Understanding using infinite loops in a gameThis is an individual assignment. You must work on your own. You may contact the instructor if youhave difficulty with the assignment. Start early so you may ask for help in class, if you run into anyproblems.AssignmentExtend the Tamagochi you created in Homework 2 by incorporating a game-like interface usingPygame. Create a loop which captures the user input, updates your Tamagochi's state and renders theresulting state to the screen. Make sure to use the same keyboard input as was used in Homework 2(i.e., 'F' adds food, 'T' add or removes a toy, 'Q' quits the game). Note that you will not need toimplement the 'N'othing command.Implementation of the game will have the following constraints:1. Make sure the game runs at 30 FPS maximum.2. Every frame, the Tamagochi looses 3 nutrition points. Nutrition will never go below 0.3. When food is added, set the amount of food to 1000 units. When the Tamagochi is eating,he/she consumes 5 units of food per frame (subtract this from the amount of food, and add it tonutrition). So, food should be completely consumed in roughly 6 seconds or so.4. Make sure each state is distinguishable with different sprites. Also, make sure that food andtoys are displayed with a sprite.5. Each state of the Tamagochi should be animated with at least two images. You can simply swapbetween the images every 15 frames or so (keep a variable with the number of frames untilswitching images, for instance).6. Place a background image in the game (rather than filling with black).You can simply copy over the functionality from Homework 2, rather than importing the file.Your program should be legible and easily understood. This includes ensuring that variable andfunction names reflect what the variable / function does, and appropriately commenting your code.Furthermore, your program must have the following comment header (or something equivalent):## Author: <Your Name# Class: <Class AND Section number# Assignment: <Assignment number# Due Date: <The assignment's due date## Certification of Authenticity <remove one of the following:## I certify that this assignment is entirely my own work.## I certify that this assignment is my own work, but I received# some assistance from: <Name(s)## TASK: <Provide a simple, yet complete description of the task being# performed by this program. It may be several sentences long.#Submission1. Submit your Python file(s) ( to Homework 3 in the dropbox. If youhave modified the state machine for your Tamagochi, include that in the submission (this maybe submitted in class).AssessmentYour grade will be based on how well you followed the above instructions. Grades will be brokendown as follows:• 10% Keyboard Input: 'F', 'T' and 'Q' keys perform required functions.• 20% Content: Game contains a background image, images for each state of theTamagochi, and images for food and toy.• 10% Animation: Each Tamagochi state is animated by at least two images.• 30% Behavior: Program behaves properly and reflects the state machine.• 30% Program Quality: Variable names reflect their role, comments are appropriatelywritten, header information is properly included.Late assignments will be deducted 10% per day late.
Powered by