Setup
The setup for this assignment is largely the same as it was for assignment 0, adjusted to use the A2 repo:
https://github.coecis.cornell.edu/Intro-To-Graphics-F2024/A2-Intro-To-Graphics-FA2024Starter Code
When you run the starter code, you should see 5 cats lined up nearly in a row (with real-time tail waving dynamics!), facing the Prince of Cosmos in the center of the screen. You will be able to move the prince with your arrow keys, but you won't be able to roll up any cats yet---we need to implement the assignment for that. It should look like this:
Demo Video:
I recorded these videos last year and have since upgraded the code to make it more compatible with C1. For this reason, the video may not appear 100% the same as what you see when you run. Small styling differences and control panel aside, the functionality in these videos should still be the same as what your code does.
Code Structure
The code for this assignment will be mostly the same as the starter code for Creative 1 (we may add more example code, but otherwise it should be the same). As such, the files are organized in a way that should make swapping Catamari-specific code for your own creations easier in C1.
- The src/A2/ directory is a kind of landing point for your application. Code in this directory will load a selected model and controller for the scene, set up the application, and start things running.
- The Polygon2D/ directory has some classes for representing basic 2D game objects. Completing these basic classes will be the main focus of A2. The weird
Polygon2D/Polygon2D/
path structure is meant to let us slip in a reference implementation later.
The Anatomy of a Node
AniGraph, the framework built for this web-based assignments in this class, is designed to make it easy for you to write customizable and reusable components that become nodes in a scene graph. A given node combines an ANodeModel subclass, which holds all of the data associated with the logic and behavior of that node, and an ANodeView subclass, which holds all of the data associated with a particular visualization (rendering) of the node.Most of the work in A2 will focus on writing an ANodeModel subclass that represents a 2D polygonal shape. In particular, we will focus on supporting collision detection between shapes, and re-parenting (i.e., changing the parent of a node in our scene graph).
Game Configs
The file CatamariGameConfigs.ts defines a simple class with a few static properties that may be useful for debugging:
export class GameConfigs{
static WanderingCats=false; // Determines whether the cats will wander around the screen. Turn off for easier debugging.
static CustomCatPlacement=true // If true, the placement of cats will be determined by CatamariGameSceneModel.initializeCustomCats()
static nCats=10; // number of cats in non-custom random placement
static GameWorldScale=10; // scales the size of the game world. Probably don't change this one...
static UseTextures=true; // Don't worry about this for now. Included just in case any students have certain device-specific problems. It can make debugging easier.
static LabCatIsWatching:boolean=true; // Lab Cat is always watching, but since this is a simulation we can choose to simulate a world where that is no longer true.
}